Lines Matching refs:job

78 static struct job *jobtab;	/* array of jobs */
81 MKINIT struct job *bgjob = NULL; /* last background process */
83 static struct job *jobmru; /* most recently used job list */
92 static void restartjob(struct job *);
94 static void freejob(struct job *);
95 static struct job *getjob(char *);
96 static pid_t dowait(int, struct job *);
102 static void setcurjob(struct job *);
103 static void deljob(struct job *);
104 static struct job *getcurjob(struct job *);
106 static void printjobcmd(struct job *);
107 static void showjob(struct job *, int);
111 * Turn job control on and off.
155 out: out2fmt_flush("sh: can't access tty; job control turned off\n");
169 } else { /* turning job control off */
187 struct job *jp;
193 error("job not created under job control");
210 struct job *jp;
215 error("job not created under job control");
228 restartjob(struct job *jp)
287 printjobcmd(struct job *jp)
301 showjob(struct job *jp, int mode)
306 struct job *j;
398 * If the shell is interrupted in the process of creating a job, the
399 * result may be a job structure containing zero processes. Such structures
407 struct job *jp;
434 * Mark a job structure as unused.
438 freejob(struct job *jp)
464 struct job *job;
466 struct job *jp;
470 job = getjob(*argptr);
472 job = NULL;
482 if (job != NULL) {
483 if (job->state) {
484 status = job->ps[job->nprocs - 1].status;
493 if (! iflag || ! job->changed)
494 freejob(job);
496 job->remembered = 0;
497 if (job == bgjob)
523 } while (dowait(1, (struct job *)NULL) != -1);
534 struct job *jp;
548 * Convert a job name to a job structure.
551 static struct job *
555 struct job *found, *jp;
562 error("No current job");
565 error("No current job");
581 error("No previous job");
617 error("No such job: %s", name);
626 struct job *jp;
633 * Return a new job structure,
636 struct job *
640 struct job *jp;
703 setcurjob(struct job *cj)
705 struct job *jp, *prev;
723 deljob(struct job *j)
725 struct job *jp, *prev;
739 * Return the most recently used job that isn't `nj', and preferably one
742 static struct job *
743 getcurjob(struct job *nj)
745 struct job *jp;
751 /* Otherwise the most recently used job that isn't `nj' */
762 * Fork of a subshell. If we are doing job control, give the subshell its
763 * own process group. Jp is a job structure that the job is to be added to.
769 * process group even if job control is on.
771 * When job control is turned off, background processes have their standard
777 forkshell(struct job *jp, union node *n, int mode)
795 struct job *p;
808 jobctl = 0; /* do job control only in root shell */
890 vforkexecshell(struct job *jp, char **argv, char **envp, const char *path, int idx, int pip[2])
939 * Wait for job to finish.
941 * Under job control we have the problem that while a child process is
944 * active user may be hard to kill. With job control turned off, an
958 waitforjob(struct job *jp, int *origstatus)
1014 dowait(int block, struct job *job)
1019 struct job *jp;
1020 struct job *thisjob;
1034 if (pid == -1 && errno == ECHILD && job != NULL)
1035 job->state = JOBDONE;
1069 if (jp != job) {
1085 else if ((!rootshell || !iflag || thisjob == job) &&
1105 TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job));
1114 * Do a wait system call. If job control is compiled in, we accept
1141 struct job *jp;