changeset 37357:5a08ea195c98

fchdir: port 'open' and 'close' redefinitions to AIX 7.1 * lib/chown.c, lib/clean-temp.c, lib/copy-file.c, lib/execute.c: * lib/fsusage.c, lib/gc-gnulib.c, lib/javacomp.c, lib/mountlist.c: * lib/openat-proc.c, lib/pagealign_alloc.c, lib/progreloc.c: * lib/spawn-pipe.c: Do not #undef 'open' and 'close'. AIX 7 does '#define open open64' and then 'int open64(const char *, int, ...);', which means the declaration for 'open' gets lost if we later '#undef open'. Discovered while building grep pretest 2.18.151-1c770 on AIX 7.1, where the compilation reported the non-fatal error "In function 'openat_proc_name' ... warning: implicit declaration of function 'open'". In this case the error is relatively harmless, but in other cases it might not be so minor.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 22 May 2014 00:05:01 -0700
parents 9f5ed51ad7c6
children 282948bfce77
files ChangeLog lib/chown.c lib/clean-temp.c lib/copy-file.c lib/execute.c lib/fsusage.c lib/gc-gnulib.c lib/javacomp.c lib/mountlist.c lib/openat-proc.c lib/pagealign_alloc.c lib/progreloc.c lib/spawn-pipe.c
diffstat 13 files changed, 16 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 21 15:53:19 2014 -0700
+++ b/ChangeLog	Thu May 22 00:05:01 2014 -0700
@@ -1,3 +1,19 @@
+2014-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+	fchdir: port 'open' and 'close' redefinitions to AIX 7.1
+	* lib/chown.c, lib/clean-temp.c, lib/copy-file.c, lib/execute.c:
+	* lib/fsusage.c, lib/gc-gnulib.c, lib/javacomp.c, lib/mountlist.c:
+	* lib/openat-proc.c, lib/pagealign_alloc.c, lib/progreloc.c:
+	* lib/spawn-pipe.c:
+	Do not #undef 'open' and 'close'.  AIX 7 does '#define open open64'
+	and then 'int open64(const char *, int, ...);', which means the
+	declaration for 'open' gets lost if we later '#undef open'.
+	Discovered while building grep pretest 2.18.151-1c770 on AIX 7.1,
+	where the compilation reported the non-fatal error "In function
+	'openat_proc_name' ... warning: implicit declaration of function
+	'open'".  In this case the error is relatively harmless, but in
+	other cases it might not be so minor.
+
 2014-05-20  Paul Eggert  <eggert@cs.ucla.edu>
 
 	xalloc: don't potentially generate invalid code for xmemdup calls
--- a/lib/chown.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/chown.c	Thu May 22 00:05:01 2014 -0700
@@ -45,11 +45,6 @@
 /* Below we refer to the system's chown().  */
 # undef chown
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-# undef open
-# undef close
-
 /* Provide a more-closely POSIX-conforming version of chown on
    systems with one or both of the following problems:
    - chown doesn't treat an ID of -1 as meaning
--- a/lib/clean-temp.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/clean-temp.c	Thu May 22 00:05:01 2014 -0700
@@ -69,13 +69,6 @@
 # define uintptr_t unsigned long
 #endif
 
-#if !GNULIB_FCNTL_SAFER
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-# undef open
-# undef close
-#endif
-
 
 /* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5))
    ensure that while constructing or modifying the data structures, the field
--- a/lib/copy-file.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/copy-file.c	Thu May 22 00:05:01 2014 -0700
@@ -48,11 +48,6 @@
 
 #define _(str) gettext (str)
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 enum { IO_SIZE = 32 * 1024 };
 
 int
--- a/lib/execute.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/execute.c	Thu May 22 00:05:01 2014 -0700
@@ -48,11 +48,6 @@
 
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 
 #if defined EINTR && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
 
--- a/lib/fsusage.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/fsusage.c	Thu May 22 00:05:01 2014 -0700
@@ -55,11 +55,6 @@
 # include "full-read.h"
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 /* Many space usage primitives use all 1 bits to denote a value that is
    not applicable or unknown.  Propagate this information by returning
    a uintmax_t value that is all 1 bits if X is all 1 bits, even if X
--- a/lib/gc-gnulib.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/gc-gnulib.c	Thu May 22 00:05:01 2014 -0700
@@ -66,11 +66,6 @@
 # include "rijndael-api-fst.h"
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 #ifdef GNULIB_GC_RANDOM
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 #  include <windows.h>
--- a/lib/javacomp.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/javacomp.c	Thu May 22 00:05:01 2014 -0700
@@ -51,11 +51,6 @@
 
 #define _(str) gettext (str)
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 
 /* Survey of Java compilers.
 
--- a/lib/mountlist.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/mountlist.c	Thu May 22 00:05:01 2014 -0700
@@ -143,11 +143,6 @@
 # include "unlocked-io.h"
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 /* The results of opendir() in this file are not used with dirfd and fchdir,
    therefore save some unnecessary work in fchdir.c.  */
 #undef opendir
--- a/lib/openat-proc.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/openat-proc.c	Thu May 22 00:05:01 2014 -0700
@@ -32,14 +32,6 @@
 
 #include "intprops.h"
 
-/* The results of open() in this file are not used with fchdir,
-   and we do not leak fds to any single-threaded code that could use stdio,
-   therefore save some unnecessary work in fchdir.c.
-   FIXME - if the kernel ever adds support for multi-thread safety for
-   avoiding standard fds, then we should use open_safer.  */
-#undef open
-#undef close
-
 #define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s"
 
 #define PROC_SELF_FD_NAME_SIZE_BOUND(len) \
--- a/lib/pagealign_alloc.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/pagealign_alloc.c	Thu May 22 00:05:01 2014 -0700
@@ -48,11 +48,6 @@
 # endif
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 
 #if HAVE_MMAP || ! HAVE_POSIX_MEMALIGN
 
--- a/lib/progreloc.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/progreloc.c	Thu May 22 00:05:01 2014 -0700
@@ -89,11 +89,6 @@
 # define FILE_SYSTEM_PREFIX_LEN(P) 0
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 /* Use the system functions, not the gnulib overrides in this file.  */
 #undef sprintf
 
--- a/lib/spawn-pipe.c	Wed May 21 15:53:19 2014 -0700
+++ b/lib/spawn-pipe.c	Thu May 22 00:05:01 2014 -0700
@@ -48,11 +48,6 @@
 
 #endif
 
-/* The results of open() in this file are not used with fchdir,
-   therefore save some unnecessary work in fchdir.c.  */
-#undef open
-#undef close
-
 
 #ifdef EINTR