Commit | Line | Data |
---|---|---|
c43d617f | 1 | /*- |
d1b73048 KB |
2 | * Copyright (c) 1991, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
c43d617f KB |
4 | * |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Kenneth Almquist. | |
7 | * | |
8 | * %sccs.include.redist.c% | |
9 | * | |
d1b73048 | 10 | * @(#)jobs.h 8.1 (Berkeley) %G% |
c43d617f KB |
11 | */ |
12 | ||
13 | /* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ | |
14 | #define FORK_FG 0 | |
15 | #define FORK_BG 1 | |
16 | #define FORK_NOJOB 2 | |
17 | ||
18 | ||
19 | /* | |
20 | * A job structure contains information about a job. A job is either a | |
21 | * single process or a set of processes contained in a pipeline. In the | |
22 | * latter case, pidlist will be non-NULL, and will point to a -1 terminated | |
23 | * array of pids. | |
24 | */ | |
25 | ||
26 | struct procstat { | |
27 | short pid; /* process id */ | |
28 | short status; /* status flags (defined above) */ | |
29 | char *cmd; /* text of command being run */ | |
30 | }; | |
31 | ||
32 | ||
33 | /* states */ | |
34 | #define JOBSTOPPED 1 /* all procs are stopped */ | |
35 | #define JOBDONE 2 /* all procs are completed */ | |
36 | ||
37 | ||
38 | struct job { | |
39 | struct procstat ps0; /* status of process */ | |
40 | struct procstat *ps; /* status or processes when more than one */ | |
41 | short nprocs; /* number of processes */ | |
42 | short pgrp; /* process group of this job */ | |
43 | char state; /* true if job is finished */ | |
44 | char used; /* true if this entry is in used */ | |
45 | char changed; /* true if status has changed */ | |
46 | #if JOBS | |
47 | char jobctl; /* job running under job control */ | |
48 | #endif | |
49 | }; | |
50 | ||
51 | extern short backgndpid; /* pid of last background process */ | |
0dc9f70e | 52 | extern int job_warning; /* user was warned about stopped jobs */ |
c43d617f KB |
53 | |
54 | ||
55 | #ifdef __STDC__ | |
56 | void setjobctl(int); | |
57 | void showjobs(int); | |
58 | struct job *makejob(union node *, int); | |
59 | int forkshell(struct job *, union node *, int); | |
60 | int waitforjob(struct job *); | |
85774404 | 61 | char *commandtext(union node *); |
c43d617f KB |
62 | #else |
63 | void setjobctl(); | |
64 | void showjobs(); | |
65 | struct job *makejob(); | |
66 | int forkshell(); | |
67 | int waitforjob(); | |
85774404 | 68 | char *commandtext(); |
c43d617f KB |
69 | #endif |
70 | ||
71 | #if ! JOBS | |
72 | #define setjobctl(on) /* do nothing */ | |
73 | #endif |