[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#119974: marked as done (libc6-dev: fsync() doesn't get declared on unistd.h without __USE_BSD or __USE_XOPEN)



Your message dated Sun, 15 Apr 2007 17:17:02 +0200
with message-id <20070415151702.GA27549@artemis>
and subject line Bug#119974: Bug confirmed
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6-dev
Version: 2.2.4-5
Severity: normal


Function fsync(), which is considered as POSIX.1b by manpages-dev and POSIX
by glibc-doc, doesn't get declared #including /usr/include/unistd.h
without defining __USE_BSD or __USE_XOPEN.

That is, compiling with -D_POSIX_C_SOURCE=2, and including unistd.h, there
is still no function prototype included.

Taking a glance to /usr/include/unistd.h:

/*
 ...
   _POSIX_FSYNC                 The fsync function is present.
 ...
*/

but:

#if defined __USE_BSD || defined __USE_XOPEN
/* Make all changes done to FD actually appear on disk.  */
extern int fsync (int __fd) __THROW;
#endif /* Use BSD || X/Open.  */


Nothing about POSIX. Please, if this function is not POSIX compliant,
remove the _POSIX_FSYNC line, update documentation on glibc-doc (on * Library
Summary) and manpages-dev. Else add checks for __USE_POSIX (or whatever
appropiate macro) to the function prototype inclusion.


Not important because compiling without function prototypes works, but
ugly anyway (gcc may warn about it).


-- System Information
Debian Release: testing/unstable
Kernel Version: Linux caballero 2.4.14 #1 mié nov 14 19:56:24 CET 2001 i586 unknown

Versions of the packages libc6-dev depends on:
ii  libc6          2.2.4-5        GNU C Library: Shared libraries and Timezone


--- End Message ---
--- Begin Message ---
On Sun, Apr 15, 2007 at 12:32:59PM +0200, Pierre HABOUZIT wrote:
> tag 119974 + pending
> thanks
> 
>   I checked in the POSIX doc, FWIW here is what I found:
> 
>   fsync was first introduced it seems as an XOPEN extension. Hence the
> __USE_XOPEN guard, and defining _XOPEN_SOURCE indeed works.
> 
>   Else, wrt POSIX, fsync last updates are in posix 1003.1-2001.
> 
> > Just saying POSIX does not tell you if its POSIX.1 or POSIX.1b.  Given
> > the current messy use of test macros, it would be natural to think POSIX
> > refers to whatever _POSIX_SOURCE buys you by default (POSIX.1);
> > otherwise the manual page would state clearly the standard revision so
> > you could define the test macro to the appropiate number.  On the other
> > hand, the fsync(2) manual page (which I had read) clearly labels fsync()
> > as POSIX.1b, so I was a bit confused for the precise revision, but it is
> > clearly a POSIX function.
> 
>   Current man page advertise it as POSIX 1003.1-2001 which is correct.
> 
>   So FWIW compiling with:
>   gcc -ansi -Wall -D_POSIX_SOURCE=1 -D_POSIX_C_SOURCE=200112 a.c
> 
>   should work. The correct fix is to add an || defined(__USE_POSIX2K) in
> the guard.


  You may want to read the rationale in
http://sourceware.org/bugzilla/show_bug.cgi?id=4366 but indeed, fsync is
only defined in POSIX Realtime extensions or XSI, hence you'll need some
kind of _XOPEN_SOURCE define to enable fsync, and that's correct
behaviour. Closing the bug.


-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpF0tRvSVaBO.pgp
Description: PGP signature


--- End Message ---

Reply to: