A few things to make the Linux clone(2) emulation work a bit better:
- When the exit signal is specified to be 0, don't just assume they meant SIGCHLD. In the Linux world, this appears to mean "don't deliver an exit signal at all". - Simplify P_EXITSIG(); don't check against initproc here, just change the exit signal to SIGCHLD if reparenting to initproc. A very simple clone(2) test program now works, and the MpegTV package starts, but doesn't run properly yet (I believe there is a separate bug which keeps it from working properly).
This commit is contained in:
parent
e4cffe98ac
commit
c581bf97c5
sys
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_misc.c,v 1.58 1999/05/17 19:26:33 thorpej Exp $ */
|
||||
/* $NetBSD: linux_misc.c,v 1.59 1999/07/15 23:18:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -955,10 +955,6 @@ linux_sys_clone(p, v, retval)
|
||||
return (EINVAL);
|
||||
sig = linux_to_native_sig[sig];
|
||||
|
||||
/* XXX Is this the right thing? */
|
||||
if (sig == 0)
|
||||
sig = SIGCHLD;
|
||||
|
||||
/*
|
||||
* Note that Linux does not provide a portable way of specifying
|
||||
* the stack area; the caller must know if the stack grows up
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_exit.c,v 1.69 1999/05/13 17:28:30 thorpej Exp $ */
|
||||
/* $NetBSD: kern_exit.c,v 1.70 1999/07/15 23:18:43 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -377,7 +377,7 @@ reaper()
|
||||
LIST_INSERT_HEAD(&zombproc, p, p_list);
|
||||
|
||||
/* Wake up the parent so it can get exit status. */
|
||||
if ((p->p_flag & P_FSTRACE) == 0)
|
||||
if ((p->p_flag & P_FSTRACE) == 0 && p->p_exitsig != 0)
|
||||
psignal(p->p_pptr, P_EXITSIG(p));
|
||||
wakeup((caddr_t)p->p_pptr);
|
||||
}
|
||||
@ -416,8 +416,8 @@ loop:
|
||||
* if WALTSIG is set; wait for processes with p_exitsig ==
|
||||
* SIGCHLD only if WALTSIG is clear.
|
||||
*/
|
||||
if ((SCARG(uap, options) & WALTSIG) ? P_EXITSIG(p) == SIGCHLD :
|
||||
P_EXITSIG(p) != SIGCHLD)
|
||||
if ((SCARG(uap, options) & WALTSIG) ?
|
||||
(p->p_exitsig == SIGCHLD) : (P_EXITSIG(p) != SIGCHLD))
|
||||
continue;
|
||||
|
||||
nfound++;
|
||||
@ -451,7 +451,8 @@ loop:
|
||||
proc_reparent(p, t ? t : initproc);
|
||||
p->p_oppid = 0;
|
||||
p->p_flag &= ~(P_TRACED|P_WAITED|P_FSTRACE);
|
||||
psignal(p->p_pptr, P_EXITSIG(p));
|
||||
if (p->p_exitsig != 0)
|
||||
psignal(p->p_pptr, P_EXITSIG(p));
|
||||
wakeup((caddr_t)p->p_pptr);
|
||||
return (0);
|
||||
}
|
||||
@ -537,6 +538,9 @@ proc_reparent(child, parent)
|
||||
if (child->p_pptr == parent)
|
||||
return;
|
||||
|
||||
if (parent == initproc)
|
||||
child->p_exitsig = SIGCHLD;
|
||||
|
||||
LIST_REMOVE(child, p_sibling);
|
||||
LIST_INSERT_HEAD(&parent->p_children, child, p_sibling);
|
||||
child->p_pptr = parent;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: proc.h,v 1.77 1999/05/13 21:58:37 thorpej Exp $ */
|
||||
/* $NetBSD: proc.h,v 1.78 1999/07/15 23:18:42 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1986, 1989, 1991, 1993
|
||||
@ -232,11 +232,10 @@ struct proc {
|
||||
#define P_NOCLDWAIT 0x20000 /* No zombies if child dies */
|
||||
|
||||
/*
|
||||
* Macro to compute the exit signal.
|
||||
* Macro to compute the exit signal to be delivered.
|
||||
*/
|
||||
#define P_EXITSIG(p) ((((p)->p_flag & (P_TRACED|P_FSTRACE)) || \
|
||||
(p)->p_pptr == initproc) ? \
|
||||
SIGCHLD : p->p_exitsig)
|
||||
#define P_EXITSIG(p) (((p)->p_flag & (P_TRACED|P_FSTRACE)) ? SIGCHLD : \
|
||||
p->p_exitsig)
|
||||
|
||||
/*
|
||||
* MOVE TO ucred.h?
|
||||
|
Loading…
x
Reference in New Issue
Block a user