summaryrefslogtreecommitdiff
path: root/lib/unistd.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-09-24 02:08:13 +0200
committerBruno Haible <bruno@clisp.org>2011-09-24 02:08:13 +0200
commit4810e2dc1d9b1bf84da97d7869f7ad8743b3b3c4 (patch)
treeefbc34f851da79b1c0aae63b25449a6e7e9c8f62 /lib/unistd.in.h
parent4040b3bddb086e8230b0d9356297e971729a9c44 (diff)
downloadgnulib-4810e2dc1d9b1bf84da97d7869f7ad8743b3b3c4.tar.gz
New module 'dup'.
* lib/unistd.in.h (dup): Declare only if the 'dup' module is in use. Allow replacement. * lib/dup.c: New file. * lib/fchdir.c (rpl_dup): Remove function. * m4/dup.m4: New file. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't set REPLACE_DUP here. * m4/unistd_h.m4 (gl_UNISTD_H): Test whether 'dup' is declared. (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_DUP. * modules/unistd (Makefile.am): Substitute GNULIB_DUP. * modules/dup: New file. * tests/test-unistd-c++.cc: Check the signature of 'dup' only if the 'dup' module is in use. * modules/fdopendir (Depends-on): Add dup. * modules/fdutimensat-tests (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/futimens-tests (Depends-on): Likewise. * modules/posix_spawnp-tests (Depends-on): Likewise. * modules/unistd-safer-tests (Depends-on): Likewise. * modules/utimens-tests (Depends-on): Likewise. * doc/posix-functions/dup.texi: Mention the new module and the problem on MSVC.
Diffstat (limited to 'lib/unistd.in.h')
-rw-r--r--lib/unistd.in.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index bb514dbff0..60a7530b4a 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -301,16 +301,24 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
#endif
-#if @REPLACE_DUP@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define dup rpl_dup
-# endif
+#if @GNULIB_DUP@
+# if @REPLACE_DUP@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define dup rpl_dup
+# endif
_GL_FUNCDECL_RPL (dup, int, (int oldfd));
_GL_CXXALIAS_RPL (dup, int, (int oldfd));
-#else
+# else
_GL_CXXALIAS_SYS (dup, int, (int oldfd));
-#endif
+# endif
_GL_CXXALIASWARN (dup);
+#elif defined GNULIB_POSIXCHECK
+# undef dup
+# if HAVE_RAW_DECL_DUP
+_GL_WARN_ON_USE (dup, "dup is unportable - "
+ "use gnulib module dup for portability");
+# endif
+#endif
#if @GNULIB_DUP2@