# HG changeset patch # User Eric Blake # Date 1261618979 25200 # Node ID 8d19393d7abe3afbb473555bff33a54ba2526113 # Parent a58429de702ef22b96addf22c8e71fbe0fd2dc7a unistd: work around cygwin bug Cygwin 1.7.1 placed symlinkat and unlinkat in the wrong headers (due to a bug in the Linux man pages). * lib/unistd.in.h (includes): Pick up headers needed for cygwin. * doc/posix-functions/unlinkat.texi (unlinkat): Document the bug. * doc/posix-functions/symlinkat.texi (symlinkat): Likewise. Signed-off-by: Eric Blake diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-23 Eric Blake + + unistd: work around cygwin bug + * lib/unistd.in.h (includes): Pick up headers needed for cygwin. + * doc/posix-functions/unlinkat.texi (unlinkat): Document the bug. + * doc/posix-functions/symlinkat.texi (symlinkat): Likewise. + 2009-12-23 Bruno Haible localename: More tests. diff --git a/doc/posix-functions/symlinkat.texi b/doc/posix-functions/symlinkat.texi --- a/doc/posix-functions/symlinkat.texi +++ b/doc/posix-functions/symlinkat.texi @@ -13,6 +13,10 @@ glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS. But the replacement function is not safe to be used in libraries and is not multithread-safe. +@item +Some platforms declare this function in @code{stdio.h} instead of +@code{unistd.h}: +Cygwin 1.7.1. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/unlinkat.texi b/doc/posix-functions/unlinkat.texi --- a/doc/posix-functions/unlinkat.texi +++ b/doc/posix-functions/unlinkat.texi @@ -16,6 +16,10 @@ @item Some systems mistakenly succeed on @code{unlinkat(fd,"file/",flag)}: GNU/Hurd, Solaris 9. +@item +Some platforms declare this function in @code{fcntl.h} instead of +@code{unistd.h}: +Cygwin 1.7.1. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/unistd.in.h b/lib/unistd.in.h --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -33,10 +33,17 @@ #include /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ -#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) +/* Cygwin 1.7.1 declares symlinkat in , not in . */ +#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ + || @GNULIB_SYMLINKAT@) # include #endif +/* Cygwin 1.7.1 declares unlinkat in , not in . */ +#if @GNULIB_UNLINKAT@ +# include +#endif + /* mingw fails to declare _exit in . */ /* mingw, BeOS, Haiku declare environ in , not in . */ /* Solaris declares getcwd not only in but also in . */