From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Roland McGrath" <roland@redhat.com>
Cc: "kernel list" <linux-kernel@vger.kernel.org>,
"Ulrich Drepper" <drepper@redhat.com>,
"Vegard Nossum" <vegard.nossum@gmail.com>,
"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: Re: waitid() return value strangeness when infop is NULL
Date: Wed, 14 Jan 2009 11:43:05 +1300 [thread overview]
Message-ID: <cfd18e0f0901131443l3a3203c7le2cbbe9b45c0cc38@mail.gmail.com> (raw)
In-Reply-To: <cfd18e0f0901131438n232ba114n27ea2d7964d071de@mail.gmail.com>
Test program below. Two test runs, of which the second shows the
behavior I'm reporting.
$ ./a.out
Created child with PID 7727
infop = 0xbfe608e0
waitid() returned 0
$ ./a.out n
Created child with PID 7729
infop = (nil)
waitid() returned 7729
===
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
siginfo_t info, *infop;
int options, idtype;
long s;
pid_t child;
child = fork();
if (child == 0)
exit(0);
printf("Created child with PID %ld\n", (long) child);
idtype = P_PID;
options = WEXITED;
infop = (argc > 1 && strchr(argv[1], 'n') != NULL) ? NULL : &info;
printf("infop = %p\n", infop);
s = syscall(SYS_waitid, idtype, child, infop, options, NULL);
if (s == -1) {
perror("waitid");
exit(EXIT_FAILURE);
}
printf("waitid() returned %ld\n", s);
exit(EXIT_SUCCESS);
}
next prev parent reply other threads:[~2009-01-13 22:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cfd18e0f0901131436ud2cf61bkf0e6b00f4b765bb5@mail.gmail.com>
2009-01-13 22:38 ` waitid() return value strangeness when infop is NULL Michael Kerrisk
2009-01-13 22:43 ` Michael Kerrisk [this message]
2009-01-13 22:47 ` Roland McGrath
2009-01-13 22:49 ` [PATCH] sys_waitid: return -EFAULT for NULL Roland McGrath
2009-01-13 23:14 ` Michael Kerrisk
2009-01-13 23:24 ` Andrew Morton
2009-01-13 23:36 ` Michael Kerrisk
2009-01-13 23:47 ` Roland McGrath
2009-01-14 0:13 ` Michael Kerrisk
2009-01-14 0:24 ` Ulrich Drepper
2009-01-14 0:33 ` Linus Torvalds
2009-01-14 0:53 ` Michael Kerrisk
2009-01-14 0:57 ` Linus Torvalds
2009-01-14 1:39 ` Michael Kerrisk
2009-01-14 2:10 ` Linus Torvalds
2009-01-14 2:28 ` Michael Kerrisk
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=cfd18e0f0901131443l3a3203c7le2cbbe9b45c0cc38@mail.gmail.com \
--to=mtk.manpages@googlemail.com \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=roland@redhat.com \
--cc=vegard.nossum@gmail.com \
/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