lkml.org 
[lkml]   [2004]   [Aug]   [31]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 30 Aug 2004 23:04:46 -0700
FromRoland McGrath <>
SubjectRe: [PATCH] waitid system call
The AIX results someone posted suggested that it does not clear siginfo_t
fields on WNOHANG early returns.  I still maintain that a POSIX application
must not assume that waitid will clear any fields.  However, since the
majority do, I see no harm in making Linux do so as well.

Andrew, please throw this on top of the waitid patches.  This patch is
relative to 2.6.9-rc1-mm1.


Thanks,
Roland

Signed-off-by: Roland McGrath <roland@redhat.com>

--- linux-2.6.9-rc1-mm1/kernel/exit.c.~1~	2004-08-27 13:46:37.000000000 -0700
+++ linux-2.6.9-rc1-mm1/kernel/exit.c	2004-08-30 22:52:54.246036355 -0700
@@ -1369,8 +1369,29 @@ check_continued:
 end:
 	current->state = TASK_RUNNING;
 	remove_wait_queue(&current->wait_chldexit,&wait);
-	if (infop && retval > 0)
+	if (infop) {
+		if (retval > 0)
 		retval = 0;
+		else {
+			/*
+			 * For a WNOHANG return, clear out all the fields
+			 * we would set so the user can easily tell the
+			 * difference.
+			 */
+			if (!retval)
+				retval = put_user(0, &infop->si_signo);
+			if (!retval)
+				retval = put_user(0, &infop->si_errno);
+			if (!retval)
+				retval = put_user(0, &infop->si_code);
+			if (!retval)
+				retval = put_user(0, &infop->si_pid);
+			if (!retval)
+				retval = put_user(0, &infop->si_uid);
+			if (!retval)
+				retval = put_user(0, &infop->si_status);
+		}
+	}
 	return retval;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:05    [from the cache]
©2003-2008