This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

LOCK_* macros in <fcntl.h>


The LOCK_* macros are defined both in the Linux versions of <bits/fcntl.h>
and in the generic file <sys/file.h> (misc/sys/file.h).  

Why are these defined in <bits/fcntl.h> on Linux?  The values in
<sys/file.h> are identical, and the same exact values are in fact used on
every platform.

The effect of the current situation is that buggy user code that includes
<fcntl.h> but not <sys/file.h>, and then uses the BSD flock interface,
compiles ok on Linux but not on other glibc platforms.  

LOCK_* are the constants for use with the BSD flock function, which has a
prototype declared in <sys/file.h> (and nowhere else).  

Newer BSD systems define the LOCK_* and the flock prototype both in
<fcntl.h>, and <sys/file.h> essentially just #include's <fcntl.h>.

Any objection to making similar changes here?  Specifically, I would move
the LOCK_* defns now in misc/sys/file.h into the various bits/fcntl.h files
that don't already have them, move the flock prototype into a __USE_BSD
section of <fcntl.h>.  This leaves sys/file.h doing nothing but including
fcntl.h and defining the L_* macros; I'm inclined to follow BSD here too,
and move the L_* macros (under __USE_MISC) to <unistd.h>, leaving
<sys/file.h> to do nothing at all but #include <fcntl.h>.

Ok?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]