Author :
Paul Eggert
Date :
2017-08-14 13:04:46
Hash :990fa9d5 Message :open: support O_CLOEXEC
* NEWS, doc/posix-functions/open.texi:
* doc/posix-functions/openat.texi: Document this.
* lib/fcntl.in.h (O_CLOEXEC): Default to a nonzero value.
(GNULIB_defined_O_CLOEXEC): New symbol.
* lib/open.c: Include cloexec.h.
(open): Support O_CLOEXEC.
* lib/openat.c: Include cloexec.h.
(rpl_openat): Support O_CLOEXEC.
* lib/popen-safer.c: Do not include cloexec.h.
(open_noinherit): Remove.
(popen_safer): Use O_CLOEXEC instead of set_cloexec_flag.
* lib/save-cwd.c: Do not include cloexec.h.
(save_cwd): Use O_CLOEXEC instead of set_cloexec_flag.
* m4/open-cloexec.m4: New file.
* m4/open.m4 (gl_FUNC_OPEN): Require gl_PREPROC_O_CLOEXEC.
Replace 'open' if O_CLOEXEC is not present.
* m4/openat.m4 (gl_FUNC_OPENAT): Require gl_PREPROC_O_CLOEXEC.
Replace 'openat' if O_CLOEXEC is not present.
* modules/freopen (Depends-on): Depend on 'open' if replacing freopen.
* modules/open (Files): Add m4/open-cloexec.m4.
(Depends-on): Depend on cloexec if replacing 'open'.
* modules/openat (Files): Add m4/open-cloexec.m4.
(Depends-on): Depend on cloexec if replacing openat.
* modules/popen-safer (Depends-on): Remove cloexec.
* modules/save-cwd (Depends-on): Remove cloexec, and add
fd-safer-flag and 'open'.
modules/openat
Description:
openat() function: Open a file at a directory.
Files:
lib/openat.c
m4/openat.m4
m4/open-cloexec.m4
m4/lstat.m4
m4/mode_t.m4
Depends-on:
fcntl-h
extensions
largefile
openat-h [test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1]
stdbool [test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1]
sys_stat [test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1]
cloexec [test $REPLACE_OPENAT = 1]
fstat [test $REPLACE_OPENAT = 1]
at-internal [test $HAVE_OPENAT = 0]
dosname [test $HAVE_OPENAT = 0]
errno [test $HAVE_OPENAT = 0]
fchdir [test $HAVE_OPENAT = 0]
open [test $HAVE_OPENAT = 0]
openat-die [test $HAVE_OPENAT = 0]
save-cwd [test $HAVE_OPENAT = 0]
configure.ac:
gl_FUNC_OPENAT
if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
AC_LIBOBJ([openat])
gl_PREREQ_OPENAT
fi
gl_MODULE_INDICATOR([openat]) dnl for lib/getcwd.c
gl_FCNTL_MODULE_INDICATOR([openat])
Makefile.am:
Include:
<fcntl.h>
License:
GPL
Maintainer:
Jim Meyering, Eric Blake