[Glibc-bsd-commits] r5175 - in trunk/kfreebsd-9/debian: . patches

rmh at alioth.debian.org rmh at alioth.debian.org
Thu Nov 28 15:28:19 UTC 2013


Author: rmh
Date: 2013-11-28 12:43:27 +0000 (Èt, 28 lis 2013)
New Revision: 5175

Added:
   trunk/kfreebsd-9/debian/patches/si_status_wait6.diff
Modified:
   trunk/kfreebsd-9/debian/changelog
   trunk/kfreebsd-9/debian/patches/series
Log:
  * si_status_wait6.diff: Chery-pick r258281 from HEAD to fix
    siginfo_t.si_status for wait6/waitid/SIGCHLD. (Closes: #729698)

Modified: trunk/kfreebsd-9/debian/changelog
===================================================================
--- trunk/kfreebsd-9/debian/changelog	2013-11-28 12:41:44 UTC (rev 5174)
+++ trunk/kfreebsd-9/debian/changelog	2013-11-28 12:43:27 UTC (rev 5175)
@@ -5,6 +5,8 @@
 
   [ Robert Millan ]
   * Bump MAXLOGNAME to match with kfreebsd-10.
+  * si_status_wait6.diff: Chery-pick r258281 from HEAD to fix
+    siginfo_t.si_status for wait6/waitid/SIGCHLD. (Closes: #729698)
 
  -- Robert Millan <rmh at debian.org>  Thu, 28 Nov 2013 13:41:13 +0100
 

Modified: trunk/kfreebsd-9/debian/patches/series
===================================================================
--- trunk/kfreebsd-9/debian/patches/series	2013-11-28 12:41:44 UTC (rev 5174)
+++ trunk/kfreebsd-9/debian/patches/series	2013-11-28 12:43:27 UTC (rev 5175)
@@ -2,6 +2,7 @@
 000_cpuclockid2_syscall.diff
 000_cpuclockid2_compat32.diff
 maxlogname.diff
+si_status_wait6.diff
 
 # Other patches that might or might not be mergeable
 cxgbe.diff

Added: trunk/kfreebsd-9/debian/patches/si_status_wait6.diff
===================================================================
--- trunk/kfreebsd-9/debian/patches/si_status_wait6.diff	                        (rev 0)
+++ trunk/kfreebsd-9/debian/patches/si_status_wait6.diff	2013-11-28 12:43:27 UTC (rev 5175)
@@ -0,0 +1,94 @@
+------------------------------------------------------------------------
+r258281 | jilles | 2013-11-17 23:31:23 +0100 (dg, 17 nov 2013) | 15 lines
+
+Fix siginfo_t.si_status for wait6/waitid/SIGCHLD.
+
+Per POSIX, si_status should contain the value passed to exit() for
+si_code==CLD_EXITED and the signal number for other si_code. This was
+incorrect for CLD_EXITED and CLD_DUMPED.
+
+This is still not fully POSIX-compliant (Austin group issue #594 says that
+the full value passed to exit() shall be returned via si_status, not just
+the low 8 bits) but is sufficient for a si_status-related test in libnih
+(upstart, Debian/kFreeBSD).
+
+PR:		kern/184002
+Reported by:	Dmitrijs Ledkovs
+Tested by:	Dmitrijs Ledkovs
+
+--- a/sys/kern/kern_exit.c
++++ b/sys/kern/kern_exit.c
+@@ -979,16 +979,19 @@
+ 		 *  This is still a rough estimate.  We will fix the
+ 		 *  cases TRAPPED, STOPPED, and CONTINUED later.
+ 		 */
+-		if (WCOREDUMP(p->p_xstat))
++		if (WCOREDUMP(p->p_xstat)) {
+ 			siginfo->si_code = CLD_DUMPED;
+-		else if (WIFSIGNALED(p->p_xstat))
++			siginfo->si_status = WTERMSIG(p->p_xstat);
++		} else if (WIFSIGNALED(p->p_xstat)) {
+ 			siginfo->si_code = CLD_KILLED;
+-		else
++			siginfo->si_status = WTERMSIG(p->p_xstat);
++		} else {
+ 			siginfo->si_code = CLD_EXITED;
++			siginfo->si_status = WEXITSTATUS(p->p_xstat);
++		}
+ 
+ 		siginfo->si_pid = p->p_pid;
+ 		siginfo->si_uid = p->p_ucred->cr_uid;
+-		siginfo->si_status = p->p_xstat;
+ 
+ 		/*
+ 		 * The si_addr field would be useful additional
+--- a/sys/kern/kern_sig.c
++++ b/sys/kern/kern_sig.c
+@@ -2956,7 +2956,7 @@
+ }
+ 
+ static void
+-childproc_jobstate(struct proc *p, int reason, int status)
++childproc_jobstate(struct proc *p, int reason, int sig)
+ {
+ 	struct sigacts *ps;
+ 
+@@ -2976,7 +2976,7 @@
+ 	mtx_lock(&ps->ps_mtx);
+ 	if ((ps->ps_flag & PS_NOCLDSTOP) == 0) {
+ 		mtx_unlock(&ps->ps_mtx);
+-		sigparent(p, reason, status);
++		sigparent(p, reason, sig);
+ 	} else
+ 		mtx_unlock(&ps->ps_mtx);
+ }
+@@ -2984,6 +2984,7 @@
+ void
+ childproc_stopped(struct proc *p, int reason)
+ {
++	/* p_xstat is a plain signal number, not a full wait() status here. */
+ 	childproc_jobstate(p, reason, p->p_xstat);
+ }
+ 
+@@ -2997,13 +2998,15 @@
+ childproc_exited(struct proc *p)
+ {
+ 	int reason;
+-	int status = p->p_xstat; /* convert to int */
++	int xstat = p->p_xstat; /* convert to int */
++	int status;
+ 
+-	reason = CLD_EXITED;
+-	if (WCOREDUMP(status))
+-		reason = CLD_DUMPED;
+-	else if (WIFSIGNALED(status))
+-		reason = CLD_KILLED;
++	if (WCOREDUMP(xstat))
++		reason = CLD_DUMPED, status = WTERMSIG(xstat);
++	else if (WIFSIGNALED(xstat))
++		reason = CLD_KILLED, status = WTERMSIG(xstat);
++	else
++		reason = CLD_EXITED, status = WEXITSTATUS(xstat);
+ 	/*
+ 	 * XXX avoid calling wakeup(p->p_pptr), the work is
+ 	 * done in exit1().




More information about the Glibc-bsd-commits mailing list