Lines Matching refs:job
89 static struct job *jobtab; /* array of jobs */
95 static int curjob = -1; /* current job */
99 STATIC void restartjob(struct job *);
100 STATIC void freejob(struct job *);
101 STATIC struct job *getjob(const char *, int);
102 STATIC int dowait(int, struct job *);
104 STATIC int waitproc(int, struct job *, int *);
131 * Turn job control on and off.
135 * System V doesn't have job control yet, this isn't a problem now.
184 out2str("sh: Need FIOCLEX or FD_CLOEXEC to support job control");
190 out2str("sh: can't access tty; job control turned off\n");
205 out2str("sh: need new tty driver to run job control; job control turned off\n");
221 } else { /* turning job control off */
258 struct job *jp;
265 error("job not created under job control");
288 set_curjob(struct job *jp, int mode)
290 struct job *jp1, *jp2;
309 case 0: /* job being deleted */
312 case 1: /* newly created job or backgrounded job,
327 case 2: /* newly stopped job - becomes curjob */
337 struct job *jp;
344 error("job not created under job control");
358 restartjob(struct job *jp)
370 error("Cannot continue job (%s)", strerror(errno));
382 showjob(struct output *out, struct job *jp, int mode)
427 TRACE(("showjob: freeing job %d\n", jp - jobtab + 1));
528 * If the shell is interrupted in the process of creating a job, the
529 * result may be a job structure containing zero processes. Such structures
537 struct job *jp;
542 /* If not even one one job changed, there is nothing to do */
580 * Mark a job structure as unused.
584 freejob(struct job *jp)
604 struct job *job;
606 struct job *jp;
624 if (dowait(1, (struct job *)NULL) == -1)
631 job = getjob(*argptr, 1);
632 if (!job) {
637 while (job->state == JOBRUNNING) {
638 if (dowait(1, (struct job *)NULL) == -1)
641 status = job->ps[job->nprocs].status;
653 freejob(job);
663 struct job *jp;
678 struct job *jp;
687 * Convert a job name to a job structure.
690 STATIC struct job *
694 struct job *jp;
697 const char *err_msg = "No such job: %s";
703 err_msg = "No current job";
714 err_msg = "No current job";
720 err_msg = "No previous job";
727 struct job *found;
770 * Return a new job structure,
773 struct job *
777 struct job *jp;
832 * Fork off a subshell. If we are doing job control, give the subshell its
833 * own process group. Jp is a job structure that the job is to be added to.
839 * process group even if job control is on.
841 * When job control is turned off, background processes have their standard
847 forkshell(struct job *jp, union node *n, int mode)
867 forkparent(struct job *jp, union node *n, int mode, pid_t pid)
896 forkchild(struct job *jp, union node *n, int mode, int vforked)
912 jobctl = 0; /* do job control only in root shell */
962 * Wait for job to finish.
964 * Under job control we have the problem that while a child process is
967 * active user may be hard to kill. With job control turned off, an
981 waitforjob(struct job *jp)
1013 TRACE(("waitforjob: job %d, nproc %d, status %x, st %x\n",
1019 * If we're doing job control, then we did a TIOCSPGRP which
1042 dowait(int block, struct job *job)
1047 struct job *jp;
1048 struct job *thisjob;
1055 pid = waitproc(block, job, &status);
1070 TRACE(("Job %d: changing status of proc %d from 0x%x to 0x%x\n", jp - jobtab + 1, pid, sp->status, status));
1082 TRACE(("Job %d: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state));
1097 if (job == thisjob)
1102 TRACE(("Not printing status, rootshell=%d, job=%p\n",
1103 rootshell, job));
1115 * Do a wait system call. If job control is compiled in, we accept
1153 waitproc(int block, struct job *jp, int *status)
1193 struct job *jp;