| Summary: | typo in /usr/include/sys/mman.h | ||
|---|---|---|---|
| Product: | Base System | Reporter: | bgregor <bgregor> |
| Component: | kern | Assignee: | dufault |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
bgregor
1999-09-13 12:50:00 UTC
Responsible Changed From-To: freebsd-bugs->dufault Over to Peter (the author of mman.h,v 1.21). > >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 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 State Changed From-To: open->closed Incorrect PR. 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 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. <<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 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
<<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 >
> 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
<<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 |