changeset 11876:cc0527e5d2f4

fcntl-h: rename from fcntl, in preparation for fcntl(2) * modules/fcntl: Move <fcntl.h> header replacement... * modules/fcntl-h: ...to new name, so as not to collide with like-named function. * tests/test-fcntl.c: Rename... * tests/test-fcntl-h.c: ...to this. Test FD_CLOEXEC. * modules/fcntl-tests: Rename... * modules/fcntl-h-tests: ...to this. Update test file name. * modules/chdir-long (Depends-on): Update clients. * modules/chdir-safer (Depends-on): Likewise. * modules/fcntl-safer (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/mkancesdirs (Depends-on): Likewise. * modules/mkdir-p (Depends-on): Likewise. * modules/open (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * MODULES.html.sh (systems lacking POSIX:2008): Update name. * doc/posix-headers/fcntl.texi (fcntl.h): Update documentation. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Fri, 21 Aug 2009 08:26:40 -0600
parents b4dc18431377
children 18205f9302ac
files ChangeLog MODULES.html.sh doc/posix-headers/fcntl.texi modules/chdir-long modules/chdir-safer modules/fcntl modules/fcntl-h modules/fcntl-h-tests modules/fcntl-safer modules/fcntl-tests modules/fts modules/mkancesdirs modules/mkdir-p modules/open modules/savewd tests/test-fcntl-h.c tests/test-fcntl.c
diffstat 17 files changed, 160 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2009-08-23  Eric Blake  <ebb9@byu.net>
+
+	fcntl-h: rename from fcntl, in preparation for fcntl(2)
+	* modules/fcntl: Move <fcntl.h> header replacement...
+	* modules/fcntl-h: ...to new name, so as not to collide with
+	like-named function.
+	* tests/test-fcntl.c: Rename...
+	* tests/test-fcntl-h.c: ...to this.  Test FD_CLOEXEC.
+	* modules/fcntl-tests: Rename...
+	* modules/fcntl-h-tests: ...to this.  Update test file name.
+	* modules/chdir-long (Depends-on): Update clients.
+	* modules/chdir-safer (Depends-on): Likewise.
+	* modules/fcntl-safer (Depends-on): Likewise.
+	* modules/fts (Depends-on): Likewise.
+	* modules/mkancesdirs (Depends-on): Likewise.
+	* modules/mkdir-p (Depends-on): Likewise.
+	* modules/open (Depends-on): Likewise.
+	* modules/savewd (Depends-on): Likewise.
+	* MODULES.html.sh (systems lacking POSIX:2008): Update name.
+	* doc/posix-headers/fcntl.texi (fcntl.h): Update documentation.
+
 2009-08-22  Bruno Haible  <bruno@clisp.org>
 
 	* modules/binary-io (License): Relicense under LGPL.
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2251,7 +2251,7 @@
   func_module errno
   func_module fchdir
   func_module fclose
-  func_module fcntl
+  func_module fcntl-h
   func_module flock
   func_module fopen
   func_module fprintf-posix
--- a/doc/posix-headers/fcntl.texi
+++ b/doc/posix-headers/fcntl.texi
@@ -3,13 +3,14 @@
 
 POSIX specification: @url{http://www.opengroup.org/susv3xbd/fcntl.h.html}
 
-Gnulib module: fcntl
+Gnulib module: fcntl-h
 
 Portability problems fixed by Gnulib:
 @itemize
 @item
 @samp{O_NOCTTY}, @samp{O_DSYNC}, @samp{O_NONBLOCK}, @samp{O_RSYNC},
-@samp{O_SYNC} are not defined on some platforms.
+@samp{O_SYNC}, @samp{O_DIRECTORY}, and @samp{O_NOFOLLOW} are not
+defined on some platforms.
 
 @item
 @samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for
@@ -17,11 +18,41 @@
 others.
 
 @item
-@samp{O_DIRECT}, @samp{O_DIRECTORY}, @samp{O_NDELAY}, @samp{O_NOATIME},
-@samp{O_NOFOLLOW}, @samp{O_NOLINKS} (not specified by POSIX) are defined
+@samp{O_DIRECT}, @samp{O_NDELAY}, @samp{O_NOATIME},
+and @samp{O_NOLINKS} (not specified by POSIX) are defined
 on some platforms but not on others.
+
+@item
+@samp{FD_CLOEXEC} is not defined on some platforms:
+mingw
+
+@item
+@samp{AT_FDCWD} and friends are provided by modules like openat.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+@samp{O_CLOEXEC} is not defined on some platforms.  The gnulib
+replacement is not atomic on these platforms.
+
+@item
+@samp{O_TTY_INIT}, @samp{O_SEARCH}, and @samp{O_EXEC} are not defined
+on some platforms.
+
+@item
+@samp{F_DUPFD}, @samp{F_DUPFD_CLOEXEC}, @samp{F_GETFD}, and
+@samp{F_SETFD} are not defined on some platforms:
+mingw
+
+@item
+@samp{F_GETFL}, @samp{F_SETFL}, @samp{F_GETLK}, @samp{F_SETLK},
+@samp{F_SETLOKW}, @samp{F_GETOWN}, and @samp{F_SETOWN} are not defined
+on some platforms.
+
+@item
+@samp{POSIX_FADV_DONTNEED}, @samp{POSIX_FADV_NOREUSE},
+@samp{POSIX_FADV_NORMAL}, @samp{POSIX_FADV_RANDOM},
+@samp{POSIX_FADV_SEQUENTIAL}, and @samp{POSIX_FADV_WILLNEED} are not
+defined on some platforms.
 @end itemize
--- a/modules/chdir-long
+++ b/modules/chdir-long
@@ -9,7 +9,7 @@
 Depends-on:
 atexit
 fchdir
-fcntl
+fcntl-h
 openat
 memchr
 mempcpy
--- a/modules/chdir-safer
+++ b/modules/chdir-safer
@@ -8,7 +8,7 @@
 
 Depends-on:
 fchdir
-fcntl
+fcntl-h
 open
 same-inode
 stdbool
--- a/modules/fcntl
+++ b/modules/fcntl
@@ -1,35 +1,14 @@
 Description:
-Like <fcntl.h>, but with non-working flags defined to 0.
+Placeholder for eventual fcntl() replacement.
 
 Files:
-lib/fcntl.in.h
-m4/fcntl_h.m4
 
 Depends-on:
-include_next
-unistd
-extensions
+fcntl-h
 
 configure.ac:
-gl_FCNTL_H
 
 Makefile.am:
-BUILT_SOURCES += $(FCNTL_H)
-
-# We need the following in order to create <fcntl.h> when the system
-# doesn't have one that works with the given compiler.
-fcntl.h: fcntl.in.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-	      -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
-	      -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
-	      -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
-	      < $(srcdir)/fcntl.in.h; \
-	} > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += fcntl.h fcntl.h-t
 
 Include:
 #include <fcntl.h>
@@ -38,4 +17,4 @@
 LGPL
 
 Maintainer:
-all
+Eric Blake
new file mode 100644
--- /dev/null
+++ b/modules/fcntl-h
@@ -0,0 +1,41 @@
+Description:
+Like <fcntl.h>, but with non-working flags defined to 0.
+
+Files:
+lib/fcntl.in.h
+m4/fcntl_h.m4
+
+Depends-on:
+include_next
+unistd
+extensions
+
+configure.ac:
+gl_FCNTL_H
+
+Makefile.am:
+BUILT_SOURCES += $(FCNTL_H)
+
+# We need the following in order to create <fcntl.h> when the system
+# doesn't have one that works with the given compiler.
+fcntl.h: fcntl.in.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+	      -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
+	      -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
+	      -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
+	      < $(srcdir)/fcntl.in.h; \
+	} > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += fcntl.h fcntl.h-t
+
+Include:
+#include <fcntl.h>
+
+License:
+LGPL
+
+Maintainer:
+all
new file mode 100644
--- /dev/null
+++ b/modules/fcntl-h-tests
@@ -0,0 +1,13 @@
+Files:
+tests/test-fcntl-h.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fcntl-h
+check_PROGRAMS += test-fcntl-h
+
+License:
+LGPL
--- a/modules/fcntl-safer
+++ b/modules/fcntl-safer
@@ -10,7 +10,7 @@
 m4/mode_t.m4
 
 Depends-on:
-fcntl
+fcntl-h
 open
 unistd-safer
 
deleted file mode 100644
--- a/modules/fcntl-tests
+++ /dev/null
@@ -1,13 +0,0 @@
-Files:
-tests/test-fcntl.c
-
-Depends-on:
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-fcntl
-check_PROGRAMS += test-fcntl
-
-License:
-LGPL
--- a/modules/fts
+++ b/modules/fts
@@ -13,7 +13,7 @@
 d-type
 dirfd
 fchdir
-fcntl
+fcntl-h
 fcntl-safer
 hash
 i-ring
--- a/modules/mkancesdirs
+++ b/modules/mkancesdirs
@@ -8,7 +8,7 @@
 
 Depends-on:
 dirname
-fcntl
+fcntl-h
 savewd
 stat-macros
 sys_stat
--- a/modules/mkdir-p
+++ b/modules/mkdir-p
@@ -10,7 +10,7 @@
 
 Depends-on:
 error
-fcntl
+fcntl-h
 gettext-h
 lchmod
 lchown
--- a/modules/open
+++ b/modules/open
@@ -7,7 +7,7 @@
 m4/mode_t.m4
 
 Depends-on:
-fcntl
+fcntl-h
 
 configure.ac:
 gl_FUNC_OPEN
--- a/modules/savewd
+++ b/modules/savewd
@@ -11,7 +11,7 @@
 exit
 fchdir
 fcntl-safer
-fcntl
+fcntl-h
 raise
 stdbool
 xalloc
new file mode 100644
--- /dev/null
+++ b/tests/test-fcntl-h.c
@@ -0,0 +1,38 @@
+/* Test of <fcntl.h> substitute.
+   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
+
+#include <config.h>
+
+#include <fcntl.h>
+
+/* Check that the various O_* macros are defined.  */
+int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK
+	| O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC
+	| O_BINARY | O_TEXT;
+
+/* Check that the various SEEK_* macros are defined.  */
+int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
+
+/* Check that the FD_* macros are defined.  */
+int fd = FD_CLOEXEC;
+
+int
+main ()
+{
+  return 0;
+}
deleted file mode 100644
--- a/tests/test-fcntl.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Test of <fcntl.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
-
-#include <config.h>
-
-#include <fcntl.h>
-
-/* Check that the various O_* macros are defined.  */
-int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK
-	| O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC
-	| O_BINARY | O_TEXT;
-
-/* Check that the various SEEK_* macros are defined.  */
-int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
-
-int
-main ()
-{
-  return 0;
-}