Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756028AbZAMWnZ (ORCPT ); Tue, 13 Jan 2009 17:43:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751027AbZAMWnK (ORCPT ); Tue, 13 Jan 2009 17:43:10 -0500 Received: from fk-out-0910.google.com ([209.85.128.185]:18932 "EHLO fk-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbZAMWnI (ORCPT ); Tue, 13 Jan 2009 17:43:08 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=Fk6D1OUrr2P7a7hGQVqZja27x2AenHLKIk6XXV51zxX0HmED7+Iq5Hdmb3ZBZi6+5P Jvk9eyXOFNMs9Jsa1eaHlbqUuI6udOCT750VqDVoUvpKnhYLoty5rMW5+nvM26uu/b0G nCP0opcemdrjNjQQDNr7Zf5sb1e34JPF8fd2Y= Message-ID: Date: Wed, 14 Jan 2009 11:43:05 +1300 From: "Michael Kerrisk" Reply-To: mtk.manpages@gmail.com To: "Roland McGrath" Subject: Re: waitid() return value strangeness when infop is NULL Cc: "kernel list" , "Ulrich Drepper" , "Vegard Nossum" , "linux-man@vger.kernel.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1306 Lines: 59 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 #include #include #include #include #include #include #include #include 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); } -- 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/