From nobody@FreeBSD.ORG Mon Sep 13 04:46:33 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id DED3C14E59; Mon, 13 Sep 1999 04:46:33 -0700 (PDT)
Message-Id: <19990913114633.DED3C14E59@hub.freebsd.org>
Date: Mon, 13 Sep 1999 04:46:33 -0700 (PDT)
From: bgregor@buphy.bu.edu
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: typo in /usr/include/sys/mman.h
X-Send-Pr-Version: www-1.0

>Number:         13722
>Category:       kern
>Synopsis:       typo in /usr/include/sys/mman.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dufault
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 04:50:00 PDT 1999
>Closed-Date:    Mon Sep 13 07:50:25 PDT 1999
>Last-Modified:  Mon Sep 13 12:20:00 PDT 1999
>Originator:     Brian Gregor
>Release:        3.2-19990903-STABLE
>Organization:
>Environment:
FreeBSD bsd.bkgregor.com 3.2-19990903-STABLE FreeBSD 3.2-19990903-STABLE #2: Fri Sep 10 08:51:13 EDT 1999     
brian@bsd.bkgregor.com:/usr/src/sys/compile/K6  i386             
>Description:
In line 124 of /usr/include/sys/mman.h there is an extra comma 
before 'mode_t':
int shm_open __P((const char *, int, mode_t));
			

>How-To-Repeat:
I came across this while compiling a homegrown GTK+ application.
>Fix:
Remove the comma after 'int' and before 'mode_t':
	int     shm_open __P((const char *, int mode_t));


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dufault 
Responsible-Changed-By: ru 
Responsible-Changed-When: Mon Sep 13 05:20:06 PDT 1999 
Responsible-Changed-Why:  
Over to Peter (the author of mman.h,v 1.21). 

From: Bruce Evans <bde@zeta.org.au>
To: bgregor@buphy.bu.edu
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 23:51:34 +1000 (EST)

 > >Description:
 > In line 124 of /usr/include/sys/mman.h there is an extra comma 
 > before 'mode_t':
 > int shm_open __P((const char *, int, mode_t));
 
 No, this is the correct declaration.  mode_t is a type, not a
 parameter name.
 
 > >How-To-Repeat:
 > I came across this while compiling a homegrown GTK+ application.
 > >Fix:
 > Remove the comma after 'int' and before 'mode_t':
 > 	int     shm_open __P((const char *, int mode_t));
 
 The application apparently doesn't include <sys/types.h> before
 <sys/mman.h> to get the typedef for mode_t.
 
 <sys/types.h> is not a prerequisite of <sys/mman.h> in POSIX.1-1996,
 so the bug is in <sys/mman.h>.
 
 Bruce
 
 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Mon Sep 13 07:50:25 PDT 1999 
State-Changed-Why:  
Incorrect PR. 

From: Dag-Erling Smorgrav <des@flood.ping.uio.no>
To: bgregor@buphy.bu.edu
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: 13 Sep 1999 16:50:17 +0200

 bgregor@buphy.bu.edu writes:
 > In line 124 of /usr/include/sys/mman.h there is an extra comma 
 > before 'mode_t':
 > int shm_open __P((const char *, int, mode_t));
 
 No, this prototype is correct. Your program is wrong. For reference,
 see the Single Unix Specification v2:
 
  <URL:http://www.opengroup.org/onlinepubs/007908799/xsh/shm_open.html>
 
 DES
 -- 
 Dag-Erling Smorgrav - des@flood.ping.uio.no
 

From: Brian Gregor <bgregor@buphy.bu.edu>
To: Bruce Evans <bde@zeta.org.au>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 10:52:08 -0400

 On Mon, 13 Sep 1999, Bruce Evans wrote:
 
 > > >Description:
 > > In line 124 of /usr/include/sys/mman.h there is an extra comma 
 > > before 'mode_t':
 > > int shm_open __P((const char *, int, mode_t));
 > 
 > No, this is the correct declaration.  mode_t is a type, not a
 > parameter name.
 >
 
 Yes.  Whoops.  
  
 > > >How-To-Repeat:
 > > I came across this while compiling a homegrown GTK+ application.
 > > >Fix:
 > > Remove the comma after 'int' and before 'mode_t':
 > > 	int     shm_open __P((const char *, int mode_t));
 > 
 > The application apparently doesn't include <sys/types.h> before
 > <sys/mman.h> to get the typedef for mode_t.
 > 
 > <sys/types.h> is not a prerequisite of <sys/mman.h> in POSIX.1-1996,
 > so the bug is in <sys/mman.h>.
 > 
 > Bruce
 > 
 
 
 Thanks for the info - I misread the function prototype!
 
 
 Brian
 
 
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: bgregor@buphy.bu.edu
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h 
Date: Mon, 13 Sep 1999 19:39:25 +0200

 On Mon, 13 Sep 1999 04:46:33 MST, bgregor@buphy.bu.edu wrote:
 
 > Remove the comma after 'int' and before 'mode_t':
 > 	int     shm_open __P((const char *, int mode_t));
 
 That doesn't make much sense, since your change effectively suggests
 that one of the parameters should be called mode_t. :-)
 
 Could you provide more details indicating what leads you to believe that
 this is a problem?
 
 Ciao,
 Sheldon.
 

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: bgregor@buphy.bu.edu
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 14:23:40 -0400 (EDT)

 <<On Mon, 13 Sep 1999 04:46:33 -0700 (PDT), bgregor@buphy.bu.edu said:
 
 > In line 124 of /usr/include/sys/mman.h there is an extra comma 
 > before 'mode_t':
 > int shm_open __P((const char *, int, mode_t));
 
 No, it is correct as written.  shm_open(), if we actually implemented
 it, takes three arguments.
 
 -GAWollman
 
 --
 Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
 wollman@lcs.mit.edu  | O Siem / The fires of freedom 
 Opinions not those of| Dance in the burning flame
 MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick
 

From: Brian Gregor <bgregor@buphy.bu.edu>
To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 14:33:01 -0400

 On Mon, 13 Sep 1999, Garrett Wollman wrote:
 
 > <<On Mon, 13 Sep 1999 04:46:33 -0700 (PDT), bgregor@buphy.bu.edu said:
 > 
 > > In line 124 of /usr/include/sys/mman.h there is an extra comma 
 > > before 'mode_t':
 > > int shm_open __P((const char *, int, mode_t));
 > 
 > No, it is correct as written.  shm_open(), if we actually implemented
 > it, takes three arguments.
 > 
 
 yes, I erred in suggesting a fix.  Nonetheless, I get the following error
 when compiling my GTK+ (from the ports collection):
 	gcc  -c -O2 `gtk-config --cflags`  functions.c
 	In file included from functions.c:6:
 	/usr/include/sys/mman.h:124: parse error before `mode_t'
 	*** Error code 1
 
 	Stop.
 (this is version 1.2.3 of gtk+)
 This program compiles cleanly without modification with the same version
 of gtk under Irix 6.2 & 6.5, Solaris 2.6 for SPARC, and Redhat Linux 5.2
 using glibc 2.0, so this would appear to be a FreeBSD problem somewhere?
 
 
 
 
 brian
 
 

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: Brian Gregor <bgregor@buphy.bu.edu>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 14:42:51 -0400 (EDT)

 <<On Mon, 13 Sep 1999 14:33:01 -0400, Brian Gregor <bgregor@buphy.bu.edu> said:
 
 > yes, I erred in suggesting a fix.  Nonetheless, I get the following error
 > when compiling my GTK+ (from the ports collection):
 > 	gcc  -c -O2 `gtk-config --cflags`  functions.c
 > 	In file included from functions.c:6:
 > 	/usr/include/sys/mman.h:124: parse error before `mode_t'
 > 	*** Error code 1
 
 The program erroneously fails to include <sys/types.h>, a documented
 prerequisite of <sys/mman.h>.
 
 -GAWollman
 
 --
 Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
 wollman@lcs.mit.edu  | O Siem / The fires of freedom 
 Opinions not those of| Dance in the burning flame
 MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick
 

From: Brian Gregor <bgregor@buphy.bu.edu>
To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 14:57:58 -0400

 > 
 > The program erroneously fails to include <sys/types.h>, a documented
 > prerequisite of <sys/mman.h>.
 > 
 > -GAWollman
 > 
 
 Actually, it does, but in this order:
 	#include <sys/mman.h>
 	#include <sys/types.h>
 which works fine under the previously mentioned types of Unix.  Upon
 swapping the order it works fine under FreeBSD as well - why would the
 behavior here be different? (out of curiosity)
 
 
 brian
 
 

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: Brian Gregor <bgregor@buphy.bu.edu>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/13722: typo in /usr/include/sys/mman.h
Date: Mon, 13 Sep 1999 15:16:23 -0400 (EDT)

 <<On Mon, 13 Sep 1999 14:57:58 -0400, Brian Gregor <bgregor@buphy.bu.edu> said:
 
 > Actually, it does, but in this order:
 > 	#include <sys/mman.h>
 > 	#include <sys/types.h>
 > which works fine under the previously mentioned types of Unix.  Upon
 > swapping the order it works fine under FreeBSD as well - why would the
 > behavior here be different? (out of curiosity)
 
 Because <sys/mman.h> requires types declared in <sys/types.h> --
 specifically, mode_t.
 
 -GAWollman
 
 --
 Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
 wollman@lcs.mit.edu  | O Siem / The fires of freedom 
 Opinions not those of| Dance in the burning flame
 MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick
 
>Unformatted:
