* such as copying to/ from the exiting process, before it is gone.
*/
sys_nice(proc_nr_e, PRIO_STOP); /* stop the process */
- if(vm_willexit(proc_nr_e) != OK) {
- panic(__FILE__, "pm_exit: vm_willexit failed", proc_nr_e);
+ if((r=vm_willexit(proc_nr_e)) != OK) {
+ panic(__FILE__, "pm_exit: vm_willexit failed", r);
}
if (proc_nr_e == INIT_PROC_NR)
if ((rmp->mp_flags & (IN_USE | ZOMBIE)) != IN_USE) {
printf("PM: handle_ksig: %d?? zombie / not in use\n", proc_nr_e);
return;
-}
+ }
proc_id = rmp->mp_pid;
mp = &mproc[0]; /* pretend signals are from PM */
mp->mp_procgrp = rmp->mp_procgrp; /* get process group right */
/* Signal should not or cannot be caught. Take default action. */
if (sigismember(&ign_sset, signo)) {
return;
-}
-
- /* This process will exit, with or without dumping core.
- * Announce this fact to VM.
- */
- if((s=vm_willexit(rmp->mp_endpoint)) != OK) {
- panic(__FILE__,"sig_proc: vm_willexit failed", s);
}
rmp->mp_sigstatus = (char) signo;
* such as copying to/ from the exiting process, before it is gone.
*/
sys_nice(proc_nr_e, PRIO_STOP); /* stop the process */
+ if((r=vm_willexit(proc_nr_e)) != OK) {
+ panic(__FILE__,"dump_core: vm_willexit failed", r);
+ }
if(proc_nr_e != FS_PROC_NR) /* if it is not FS that is exiting.. */
{
return(OK);
}
- if ((child=find_proc(m_in.pid))==NIL_MPROC || !(child->mp_flags & STOPPED)) {
- return(ESRCH);
- }
/* all the other calls are made by the parent fork of the debugger to
* control execution of the child
*/
+ if ((child=find_proc(m_in.pid))==NIL_MPROC || child->mp_parent != who_p)
+ return(ESRCH);
+
+ if (m_in.request == T_STOP) {
+ if ((r = sys_trace(T_STOP, child->mp_endpoint, 0L, (long *) 0)) != OK)
+ return(r);
+
+ child->mp_flags |= STOPPED;
+ child->mp_sigstatus = 0;
+
+ mp->mp_reply.reply_trace = 0;
+ return(OK);
+ }
+
+ /* for calls other than T_STOP, the child must be stopped and the parent
+ * must have waited for it
+ */
+ if (!(child->mp_flags & STOPPED) || child->mp_sigstatus > 0)
+ return(ESRCH);
+
switch (m_in.request) {
case T_EXIT: /* exit */
pm_exit(child, (int) m_in.data, TRUE /*for_trace*/);
register struct mproc *rmp;
for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++)
- if (rmp->mp_flags & IN_USE && rmp->mp_pid == lpid) return(rmp);
+ if ((rmp->mp_flags & (IN_USE | ZOMBIE)) == IN_USE &&
+ rmp->mp_pid == lpid) {
+ return(rmp);
+ }
return(NIL_MPROC);
}
register struct mproc *rpmp = mproc + rmp->mp_parent;
int r;
- r= sys_trace(-1, rmp->mp_endpoint, 0L, (long *) 0);
+ r= sys_trace(T_STOP, rmp->mp_endpoint, 0L, (long *) 0);
if (r != OK) panic("pm", "sys_trace failed", r);
rmp->mp_flags |= STOPPED;