diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2018-01-01 22:31:52 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2018-01-01 22:31:52 +0000 |
| commit | b0125116ca90c301f31ae96e32504f7586f07730 (patch) | |
| tree | 5e317ec7214812f94886d369a9c14e077737a5cf /bin/sh | |
| parent | 88791bd8f6320a942ab6a8c8ba260ff42acda9c3 (diff) | |
Notes
Diffstat (limited to 'bin/sh')
| -rw-r--r-- | bin/sh/jobs.c | 36 | ||||
| -rw-r--r-- | bin/sh/jobs.h | 35 |
2 files changed, 37 insertions, 34 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index d5293a08158e..60cd1484911d 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -75,6 +75,42 @@ __FBSDID("$FreeBSD$"); #include "builtins.h" +/* + * A job structure contains information about a job. A job is either a + * single process or a set of processes contained in a pipeline. In the + * latter case, pidlist will be non-NULL, and will point to a -1 terminated + * array of pids. + */ + +struct procstat { + pid_t pid; /* process id */ + int status; /* status flags (defined above) */ + char *cmd; /* text of command being run */ +}; + + +/* states */ +#define JOBSTOPPED 1 /* all procs are stopped */ +#define JOBDONE 2 /* all procs are completed */ + + +struct job { + struct procstat ps0; /* status of process */ + struct procstat *ps; /* status or processes when more than one */ + short nprocs; /* number of processes */ + pid_t pgrp; /* process group of this job */ + char state; /* true if job is finished */ + char used; /* true if this entry is in used */ + char changed; /* true if status has changed */ + char foreground; /* true if running in the foreground */ + char remembered; /* true if $! referenced */ +#if JOBS + char jobctl; /* job running under job control */ + struct job *next; /* job used after this one */ +#endif +}; + + static struct job *jobtab; /* array of jobs */ static int njobs; /* size of array */ static pid_t backgndpid = -1; /* pid of last background process */ diff --git a/bin/sh/jobs.h b/bin/sh/jobs.h index 888d6042a3f5..d0caf0638617 100644 --- a/bin/sh/jobs.h +++ b/bin/sh/jobs.h @@ -40,40 +40,7 @@ #include <signal.h> /* for sig_atomic_t */ -/* - * A job structure contains information about a job. A job is either a - * single process or a set of processes contained in a pipeline. In the - * latter case, pidlist will be non-NULL, and will point to a -1 terminated - * array of pids. - */ - -struct procstat { - pid_t pid; /* process id */ - int status; /* status flags (defined above) */ - char *cmd; /* text of command being run */ -}; - - -/* states */ -#define JOBSTOPPED 1 /* all procs are stopped */ -#define JOBDONE 2 /* all procs are completed */ - - -struct job { - struct procstat ps0; /* status of process */ - struct procstat *ps; /* status or processes when more than one */ - short nprocs; /* number of processes */ - pid_t pgrp; /* process group of this job */ - char state; /* true if job is finished */ - char used; /* true if this entry is in used */ - char changed; /* true if status has changed */ - char foreground; /* true if running in the foreground */ - char remembered; /* true if $! referenced */ -#if JOBS - char jobctl; /* job running under job control */ - struct job *next; /* job used after this one */ -#endif -}; +struct job; enum { SHOWJOBS_DEFAULT, /* job number, status, command */ |
