Re: [PATCH] waitid system call

From: Roland McGrath
Date: Tue Aug 31 2004 - 01:06:20 EST


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@xxxxxxxxxx>

--- 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/