diff lib/stdio.in.h @ 12099:01c66cf797b5

renameat: new module Passes on Linux and cygwin 1.7 native renameat, and on systems lacking renameat, but fails on Solaris 9 and 10 for now. * modules/renameat: New file. * lib/renameat.c (renameat): Likewise. * m4/renameat.m4 (gl_FUNC_RENAMEAT): Likewise. * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Add witnesses. * modules/stdio (Makefile.am): Substitute them. * lib/stdio.in.h (renameat): Declare it. * MODULES.html.sh (systems lacking POSIX:2008): Mention module. * doc/posix-functions/renameat.texi (renameat): Likewise. * modules/renameat-tests: New test. * tests/test-renameat.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 07 Sep 2009 06:45:59 -0600 (2009-09-07)
parents 73e9ab6e2c90
children 8e81b30aa8b7
line wrap: on
line diff
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -444,6 +444,18 @@
     rename (o, n))
 #endif
 
+#if @GNULIB_RENAMEAT@
+# if !@HAVE_RENAMEAT@
+extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef renameat
+# define renameat(d1,f1,d2,f2)		   \
+    (GL_LINK_WARNING ("renameat is not portable - " \
+                      "use gnulib module renameat for portability"), \
+     renameat (d1, f1, d2, f2))
+#endif
+
 #if @GNULIB_SNPRINTF@
 # if @REPLACE_SNPRINTF@
 #  define snprintf rpl_snprintf