+void
+psignal_vfork(p, new_task, thr_act, signum)
+ register struct proc *p;
+ task_t new_task;
+ thread_act_t thr_act;
+ register int signum;
+{
+ int withlock = 1;
+ int pend = 0;
+ register int s, prop;
+ register sig_t action;
+ int mask;
+ kern_return_t kret;
+
+ if ((u_int)signum >= NSIG || signum == 0)
+ panic("psignal signal number");
+ mask = sigmask(signum);
+ prop = sigprop[signum];
+
+#if SIGNAL_DEBUG
+ if(rdebug_proc && (p == rdebug_proc)) {
+ ram_printf(3);
+ }
+#endif /* SIGNAL_DEBUG */
+
+ if ((new_task == TASK_NULL) || (thr_act == (thread_act_t)NULL) || is_kerneltask(new_task))
+ return;
+
+
+ signal_lock(p);
+
+ /*
+ * proc is traced, always give parent a chance.
+ */
+ action = SIG_DFL;
+
+ if (p->p_nice > NZERO && action == SIG_DFL && (prop & SA_KILL) &&
+ (p->p_flag & P_TRACED) == 0)
+ p->p_nice = NZERO;
+
+ if (prop & SA_CONT)
+ p->p_siglist &= ~stopsigmask;
+
+ if (prop & SA_STOP) {
+ /*
+ * If sending a tty stop signal to a member of an orphaned
+ * process group, discard the signal here if the action
+ * is default; don't stop the process below if sleeping,
+ * and don't clear any pending SIGCONT.
+ */
+ if (prop & SA_TTYSTOP && p->p_pgrp->pg_jobc == 0 &&
+ action == SIG_DFL)
+ goto psigout;
+ p->p_siglist &= ~contsigmask;
+ }
+ p->p_siglist |= mask;
+
+ /* Deliver signal to the activation passed in */
+ thread_ast_set(thr_act, AST_BSD);
+
+ /*
+ * SIGKILL priority twiddling moved here from above because
+ * it needs sig_thread. Could merge it into large switch
+ * below if we didn't care about priority for tracing
+ * as SIGKILL's action is always SIG_DFL.
+ */
+ if ((signum == SIGKILL) && (p->p_nice > NZERO)) {
+ p->p_nice = NZERO;
+#if XXX
+ /*
+ * we need to make changes here to get nice to work
+ * reset priority to BASEPRI_USER
+ */
+#endif
+ }
+
+ /*
+ * This Process is traced - wake it up (if not already
+ * stopped) so that it can discover the signal in
+ * issig() and stop for the parent.
+ */
+ if (p->p_flag & P_TRACED) {
+ if (p->p_stat != SSTOP)
+ goto run;
+ else
+ goto psigout;
+ }
+run:
+ /*
+ * If we're being traced (possibly because someone attached us
+ * while we were stopped), check for a signal from the debugger.
+ */
+ if (p->p_stat == SSTOP) {
+ if ((p->p_flag & P_TRACED) != 0 && p->p_xstat != 0)
+ p->p_siglist |= sigmask(p->p_xstat);
+ }
+
+ /*
+ * setrunnable(p) in BSD
+ */
+ p->p_stat = SRUN;
+
+psigout:
+ signal_unlock(p);
+}
+