unistd: work around cygwin bug
authorEric Blake <ebb9@byu.net>
Thu, 24 Dec 2009 01:42:59 +0000 (18:42 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 24 Dec 2009 04:12:40 +0000 (21:12 -0700)
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 <ebb9@byu.net>
ChangeLog
doc/posix-functions/symlinkat.texi
doc/posix-functions/unlinkat.texi
lib/unistd.in.h

index 2133dc5373f1bc3c87ce95c3cadf7f77ea1e6415..8c4fe25ee487e7492e0615cd39089490f3d8f641 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-23  Eric Blake  <ebb9@byu.net>
+
+       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  <bruno@clisp.org>
 
        localename: More tests.
index d5ef9dca850b7cfb9393a3dd696691438c29476f..32760a4150cacbe549c16b5139fd28f95050a992 100644 (file)
@@ -13,6 +13,10 @@ This function is missing on some platforms:
 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:
index 1ec724e4ed73d42260553a482dc1861bbc550347..cf334098a219aeb42758261b86cce54c15195d71 100644 (file)
@@ -16,6 +16,10 @@ But the replacement function is not safe to be used in libraries and is not mult
 @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:
index a3a49ed60e62ad9578f32ff4804960a5232cc9f9..d0188f58ed4a1bad961e94e28dfa1f160982b3d3 100644 (file)
 #include <stddef.h>
 
 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
+#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
+     || @GNULIB_SYMLINKAT@)
 # include <stdio.h>
 #endif
 
+/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
+#if @GNULIB_UNLINKAT@
+# include <fcntl.h>
+#endif
+
 /* mingw fails to declare _exit in <unistd.h>.  */
 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */