- if ((p->p_flag & SVFORK) == 0)
- vrelvm();
- else {
- p->p_flag &= ~SVFORK;
- wakeup((caddr_t)p);
- while ((p->p_flag & SVFDONE) == 0)
- sleep((caddr_t)p, PZERO - 1);
- p->p_flag &= ~SVFDONE;
- }
- for(i=0; i<NOFILE; i++) {
- f = u.u_ofile[i];
- u.u_ofile[i] = NULL;
- closef(f);
- }
- plock(u.u_cdir);
- iput(u.u_cdir);
- if (u.u_rdir) {
- plock(u.u_rdir);
- iput(u.u_rdir);
- }
- u.u_limit[LIM_FSIZE] = INFINITY;
- acct();
- vrelpt(u.u_procp);
- vrelu(u.u_procp, 0);
- multprog--;
-/* spl7(); /* clock will get mad because of overlaying */
- p->p_stat = SZOMB;
- noproc = 1;
- i = PIDHASH(p->p_pid);
- x = p - proc;
- if (pidhash[i] == x)
- pidhash[i] = p->p_idhash;
- else {
- for (i = pidhash[i]; i != 0; i = proc[i].p_idhash)
- if (proc[i].p_idhash == x) {
- proc[i].p_idhash = p->p_idhash;
- goto done;
- }
- panic("exit");
- }
-done:
- ((struct xproc *)p)->xp_xstat = rv; /* overlay */
- ((struct xproc *)p)->xp_vm = u.u_vm; /* overlay */
- vmsadd(&((struct xproc *)p)->xp_vm, &u.u_cvm);
- for(q = &proc[0]; q < &proc[NPROC]; q++)
- if(q->p_pptr == p) {
- q->p_pptr = &proc[1];
- q->p_ppid = 1;
- wakeup((caddr_t)&proc[1]);
- /*
- * Traced processes are killed
- * since their existence means someone is screwing up.
- * Stopped processes are sent a hangup and a continue.
- * This is designed to be ``safe'' for setuid
- * processes since they must be willing to tolerate
- * hangups anyways.
- */
- if (q->p_flag&STRC) {
- q->p_flag &= ~STRC;
- psignal(q, SIGKILL);
- } else if (q->p_stat == SSTOP) {
- psignal(q, SIGHUP);
- psignal(q, SIGCONT);
- }
- /*
- * Protect this process from future
- * tty signals, clear TSTP/TTIN/TTOU if pending,
- * and set SDETACH bit on procs.
- */
- spgrp(q, -1);
- }
- wakeup((caddr_t)p->p_pptr);
- psignal(p->p_pptr, SIGCHLD);
- swtch();
-}