summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-07-18 09:02:50 +0000
committerkib <kib@FreeBSD.org>2015-07-18 09:02:50 +0000
commit48ccbdea817fb25a05eb4024844eec6ec81249a7 (patch)
tree5d1411f5124df7d1ff8fb76e514e51a232fa0406 /sys/kern/sys_process.c
parentcad9ad69e50ec0e79836106ef79f5c6e37973b3d (diff)
downloadFreeBSD-src-48ccbdea817fb25a05eb4024844eec6ec81249a7.zip
FreeBSD-src-48ccbdea817fb25a05eb4024844eec6ec81249a7.tar.gz
The si_status field of the siginfo_t, provided by the waitid(2) and
SIGCHLD signal, should keep full 32 bits of the status passed to the _exit(2). Split the combined p_xstat of the struct proc into the separate exit status p_xexit for normal process exit, and signalled termination information p_xsig. Kernel-visible macro KW_EXITCODE() reconstructs old p_xstat from p_xexit and p_xsig. p_xexit contains complete status and copied out into si_status. Requested by: Joerg Schilling Reviewed by: jilles (previous version), pho Tested by: pho Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index d82fda0..cb88034 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
+#include <sys/pioctl.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/vnode.h>
@@ -975,7 +976,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
sx_xunlock(&proctree_lock);
proctree_locked = 0;
}
- p->p_xstat = data;
+ p->p_xsig = data;
p->p_xthread = NULL;
if ((p->p_flag & (P_STOPPED_SIG | P_STOPPED_TRACE)) != 0) {
/* deliver or queue signal */
@@ -1300,7 +1301,8 @@ stopevent(struct proc *p, unsigned int event, unsigned int val)
CTR3(KTR_PTRACE, "stopevent: pid %d event %u val %u", p->p_pid, event,
val);
do {
- p->p_xstat = val;
+ if (event != S_EXIT)
+ p->p_xsig = val;
p->p_xthread = NULL;
p->p_stype = event; /* Which event caused the stop? */
wakeup(&p->p_stype); /* Wake up any PIOCWAIT'ing procs */
OpenPOWER on IntegriCloud