From nobody@FreeBSD.org  Tue Aug 20 21:58:15 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 9F44716A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Aug 2013 21:58:15 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 8C3522FB4
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Aug 2013 21:58:15 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7KLwFJh038367
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 20 Aug 2013 21:58:15 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7KLwEoM038366;
	Tue, 20 Aug 2013 21:58:14 GMT
	(envelope-from nobody)
Message-Id: <201308202158.r7KLwEoM038366@oldred.freebsd.org>
Date: Tue, 20 Aug 2013 21:58:14 GMT
From: Dmitrijs Ledkovs <xnox@debian.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sys/wait.h is not enough to use waitid(), but kind of should be.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         181439
>Category:       kern
>Synopsis:       [headers] sys/wait.h is not enough to use waitid(), but kind of should be.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jilles
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 20 22:00:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Sat Feb  8 23:10:00 UTC 2014
>Originator:     Dmitrijs Ledkovs
>Release:        9.2-rc2
>Organization:
>Environment:
>Description:
"[CX] The <signal.h> header shall define the siginfo_t type as a structure."
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html

"
#include <sys/wait.h>
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
"
http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitid.html

To use waitid() one needs to pass "siginfo_t *" to it, thus it's reasonable to expect that "siginfo_t" would be defined if <sys/wait.h> is included.

When the below code sample is compiled:
* on linux - there is one error too few arguments to function call waitid
* on freebsd - there are two errors (a) unknown type name 'siginfo_t' (b) too few arguments to function call waitid

I'm not sure if it's a bug in the standard, linux implementation, or freebsd implementation. But it would be nice, if both linux & freebsd implementations interpreted the standard the same, i.e. "#include <sys/wait.h> is enough to call waitid()"
>How-To-Repeat:
#include <sys/wait.h>
siginfo_t info;
int main(){
        waitid();
        return 0;
}

>Fix:
<sys/wait.h> header should include <signal.h> header.

>Release-Note:
>Audit-Trail:

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, xnox@debian.org
Cc:  
Subject: Re: kern/181439: [headers] sys/wait.h is not enough to use waitid(),
 but kind of should be.
Date: Thu, 22 Aug 2013 00:30:50 +0200

 In PR kern/181439, you wrote:
 > [<sys/wait.h> does not define siginfo_t]
 
 POSIX says that <sys/wait.h> shall define siginfo_t and may make visible
 all symbols from <signal.h>.
 
 This means that POSIX requires the application to #include <signal.h>
 explicitly if it wants to use the constants like SIGCHLD and CLD_EXITED.
 Therefore, I expect most applications to need an explicit #include
 <signal.h> anyway.
 
 To minimize namespace pollution, it would be best to create a new header
 that defines siginfo_t and include it from <signal.h> and <sys/wait.h>,
 or to duplicate the definition.
 
 Adding the #include to <sys/wait.h> would be simpler. If this is the way
 it should work, then it would be best to try to change POSIX to allow
 only this.
 
 -- 
 Jilles Tjoelker
State-Changed-From-To: open->analyzed 
State-Changed-By: jilles 
State-Changed-When: Sat Nov 16 11:25:20 UTC 2013 
State-Changed-Why:  
This should be referred to the Austin group, since the specified behaviour 
seems not useful: almost all real applications will need to #include <signal.h> 
anyway for the CLD_* constants. 


Responsible-Changed-From-To: freebsd-bugs->jilles 
Responsible-Changed-By: jilles 
Responsible-Changed-When: Sat Nov 16 11:25:20 UTC 2013 
Responsible-Changed-Why:  
I'm handling this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=181439 

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, xnox@debian.org
Cc:  
Subject: Re: kern/181439: [headers] sys/wait.h is not enough to use waitid(),
 but kind of should be.
Date: Sun, 9 Feb 2014 00:05:11 +0100

 Jilles Tjoelker wrote:
 > This should be referred to the Austin group, since the specified
 > behaviour seems not useful: almost all real applications will need to
 > #include <signal.h> anyway for the CLD_* constants.
 
 My proposal has been rejected, see
 http://austingroupbugs.net/view.php?id=804 . Making this change could
 break implementations, and this kind of weak specification is common in
 headers (where implementations may expose more than required and an
 application may happen to work on one implementation and break when
 moved to an implementation that only exposes what the standard
 requires).
 
 -- 
 Jilles Tjoelker
>Unformatted:
