mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: "Michael Kerrisk" <mtk-lkml@gmx.net>
Cc: torvalds@osdl.org, akpm@osdl.org, drepper@redhat.com,
	linux-kernel@vger.kernel.org, michael.kerrisk@gmx.net,
	Tonnerre <tonnerre@thundrix.ch>
Subject: Re: [PATCH] waitid system call
Date: Mon, 30 Aug 2004 23:04:46 -0700	[thread overview]
Message-ID: <200408310604.i7V64k7o010652@magilla.sf.frob.com> (raw)
In-Reply-To: Michael Kerrisk's message of  Tuesday, 24 August 2004 13:51:02 +0200 <12606.1093348262@www48.gmx.net>

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;
 }
 

  reply	other threads:[~2004-08-31  6:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 23:03 Roland McGrath
2004-08-16  5:40 ` Roland McGrath
2004-08-16 17:15   ` Michael Kerrisk
2004-08-16 21:12     ` Roland McGrath
2004-08-19 17:20       ` Michael Kerrisk
2004-08-19 20:53         ` Roland McGrath
2004-08-20  6:00           ` Michael Kerrisk
2004-08-20  9:02             ` Michael Kerrisk
2004-08-20 20:04               ` Roland McGrath
2004-08-24 11:51                 ` Michael Kerrisk
2004-08-31  6:04                   ` Roland McGrath [this message]
2004-08-31  6:26                     ` Jakub Jelinek
2004-08-31  6:37                       ` Roland McGrath
2004-08-31  6:40                       ` Andrew Morton
2004-08-31 15:53                         ` Bill Davidsen
2004-08-31 18:26                       ` Linus Torvalds
2004-08-31 23:51                         ` Roland McGrath
2004-09-01 11:31                           ` Michael Kerrisk
2004-08-31  7:22                     ` Michael Kerrisk
2004-08-22  8:53               ` Tonnerre
     [not found] <2tCiy-8pK-13@gated-at.bofh.it>
2004-08-16  0:03 ` Andi Kleen
2004-08-16  2:10   ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408310604.i7V64k7o010652@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.kerrisk@gmx.net \
    --cc=mtk-lkml@gmx.net \
    --cc=tonnerre@thundrix.ch \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®