From robert@fledge.watson.org  Thu Feb 24 14:06:32 2005
Return-Path: <robert@fledge.watson.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B0C4216A4D1
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Feb 2005 14:06:32 +0000 (GMT)
Received: from fledge.watson.org (fledge.watson.org [204.156.12.50])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1502643D2F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Feb 2005 14:06:32 +0000 (GMT)
	(envelope-from robert@fledge.watson.org)
Received: from fledge.watson.org (localhost [127.0.0.1])
	by fledge.watson.org (8.13.1/8.13.1) with ESMTP id j1OE4l9L016917
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Feb 2005 09:04:47 -0500 (EST)
	(envelope-from robert@fledge.watson.org)
Received: (from robert@localhost)
	by fledge.watson.org (8.13.1/8.13.1/Submit) id j1OE4l3j016916;
	Thu, 24 Feb 2005 14:04:47 GMT
	(envelope-from robert)
Message-Id: <200502241404.j1OE4l3j016916@fledge.watson.org>
Date: Thu, 24 Feb 2005 14:04:47 GMT
From: Robert Watson <rwatson@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sem_open(3) doesn't mention fnctl.h include requirement
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         78021
>Category:       kern
>Synopsis:       sem_open(3) doesn't mention fnctl.h include requirement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 24 14:10:27 GMT 2005
>Closed-Date:    
>Last-Modified:  Mon Sep 29 03:31:55 UTC 2008
>Originator:     Robert Watson
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:

FreeBSD 5.x and FreeBSD 6.x

>Description:

sem_open(3) identifies semaphore.h as an include requirement for sem_open();
however, sem_open()'s oflag argument can take on values of O_CREAT or O_EXCL,
which are defined in fcntl.h.

>How-To-Repeat:

#include <err.h>
#include <semaphore.h>

...
	if (sem_open(name, O_CREAT, 0) < 0)
		err(-1, "sem_open: %s", name);
...

>Fix:

The fix is either to document the include dependency, or remove it, perhaps
via a nested include.  I don't know which is the right one from a standards
perspective.

>Release-Note:
>Audit-Trail:

From: Robert Watson <rwatson@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/78021: sem_open(3) doesn't mention fnctl.h include 
Date: Thu, 24 Feb 2005 14:44:12 +0000 (GMT)

 On Thu, 24 Feb 2005 FreeBSD-gnats-submit@freebsd.org wrote:
 
 > Thank you very much for your problem report.  It has the internal
 > identification `bin/78021'.  The individual assigned to look at your
 > report is: freebsd-bugs.
 
 Just as a follow-up: stat.h is also needed for the S_IW* flags argument,
 and the example included is a poor copy-and-paste, the S_IW* flags
 argument is needed before the final 0 in a call to sem_open().
 
 Robert N M Watson
 
 

From: Ruslan Ermilov <ru@freebsd.org>
To: Robert Watson <rwatson@freebsd.org>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/78021: sem_open(3) doesn't mention fnctl.h include requirement
Date: Fri, 25 Feb 2005 00:19:08 +0200

 --DocE+STaALJfprDB
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Thu, Feb 24, 2005 at 02:04:47PM +0000, Robert Watson wrote:
 >=20
 > sem_open(3) identifies semaphore.h as an include requirement for sem_open=
 ();
 > however, sem_open()'s oflag argument can take on values of O_CREAT or O_E=
 XCL,
 > which are defined in fcntl.h.
 >=20
 > ...
 >=20
 > The fix is either to document the include dependency, or remove it, perha=
 ps
 > via a nested include.  I don't know which is the right one from a standar=
 ds
 > perspective.
 >=20
 POSIX says:
 
 """
 Inclusion of the <semaphore.h> header may make visible symbols defined in t=
 he
 headers <fcntl.h> and <sys/types.h>.
 """
 
 
 Cheers,
 --=20
 Ruslan Ermilov
 ru@FreeBSD.org
 FreeBSD committer
 
 --DocE+STaALJfprDB
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (FreeBSD)
 
 iD8DBQFCHlLcqRfpzJluFF4RArAUAJ0Tpv2HWMmn9C1KcRMlVfIm5iNe2gCggOy/
 OzaEelQRjNPaH3UMpMqqmow=
 =MQCk
 -----END PGP SIGNATURE-----
 
 --DocE+STaALJfprDB--
>Unformatted:
