summaryrefslogtreecommitdiff
path: root/m4/fcntl.m4
Commit message (Collapse)AuthorAgeFilesLines
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* fcntl: Work around NetBSD bug with F_DUPFD_CLOEXEC.Bruno Haible2020-11-291-14/+38
| | | | | | | | | | * m4/fcntl.m4 (gl_FUNC_FCNTL): Test whether F_DUPFD_CLOEXEC actually works. * lib/fcntl.c (rpl_fcntl_DUPFD_CLOEXEC): On NetBSD, use the same fallback implementation as on Haiku. * tests/test-fcntl.c (main): Add a test whether F_DUPFD_CLOEXEC is effective. * doc/posix-functions/fcntl.texi: Mention the NetBSD bug.
* Support compiling without -loldnames on native Windows.Bruno Haible2020-08-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-common.m4 (GL_MDA_DEFINES, _GL_MDA_DEFINES): New macros. * m4/chown.m4 (AC_FUNC_CHOWN): In the test programs, use GL_MDA_DEFINES. (gl_FUNC_CHOWN, gl_FUNC_CHOWN_FOLLOWS_SYMLINK): Likewise. * m4/dup.m4 (gl_FUNC_DUP): Likewise. * m4/dup2.m4 (gl_FUNC_DUP2): Likewise. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise. * m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Likewise. * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Likewise. * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): Likewise. * m4/fcntl.m4 (gl_FUNC_FCNTL): Likewise. * m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise. * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise. * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Likewise. * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Likewise. * m4/freopen.m4 (gl_FUNC_FREOPEN): Likewise. * m4/futimens.m4 (gl_FUNC_FUTIMENS): Likewise. * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise. * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL, gl_FUNC_GETCWD_SIGNATURE): Likewise. * m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Likewise. * m4/linkat.m4 (gl_FUNC_LINKAT): Likewise. * m4/lseek.m4 (gl_FUNC_LSEEK): Likewise. * m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise. * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise. * m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Likewise. * m4/open-slash.m4 (gl_OPEN_TRAILING_SLASH_BUG): Likewise. * m4/poll.m4 (gl_FUNC_POLL): Likewise. * m4/posix_spawn.m4 (gl_POSIX_SPAWN_WORKS): Likewise. * m4/pread.m4 (gl_FUNC_PREAD): Likewise. * m4/pselect.m4 (gl_FUNC_PSELECT): Likewise. * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Likewise. * m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise. * m4/putenv.m4 (gl_FUNC_PUTENV): Likewise. * m4/pwrite.m4 (gl_FUNC_PWRITE): Likewise. * m4/rename.m4 (gl_FUNC_RENAME): Likewise. * m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise. * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise. * m4/select.m4 (gl_FUNC_SELECT): Likewise. * m4/setenv.m4 (gl_FUNC_UNSETENV): Likewise. * m4/strncat.m4 (gl_FUNC_STRNCAT): Likewise. * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise. * m4/unlink-busy.m4 (gl_FUNC_UNLINK_BUSY_TEXT): Likewise. * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise. * m4/utimens.m4 (gl_UTIMENS): Likewise. * m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise. * m4/utimes.m4 (gl_FUNC_UTIMES): Likewise. * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): On native Windows, don't test for getcwd. * m4/utime.m4 (gl_FUNC_UTIME): On native Windows, don't test for utime. * m4/wcsdup.m4 (gl_FUNC_WCSDUP): To test for wcsdup, use a test program with GL_MDA_DEFINES. * lib/c++defs.h (_GL_CXXALIAS_MDA): New macro. * lib/fcntl.in.h (creat, open): On native Windows, use the underscore- prefixed symbol. * lib/search.in.h (lfind, lsearch): Likewise. * lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam): Likewise. * lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise. * lib/string.in.h (memccpy, strdup): Likewise. * lib/sys_stat.in.h (chmod, umask): Likewise. * lib/time.in.h (tzset): Likewise. * lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle, execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek, read, rmdir, swab, unlink, write): Likewise. * lib/utime.in.h (utime): Likewise. * lib/wchar.in.h (wcsdup): Likewise. * lib/math.in.h (j0, j1, jn, y0, y1, yn): Likewise. (isfinite, isinf, isnan, signbit): On native Windows, don't define as an rpl_-prefixed macro. * lib/canonicalize-lgpl.c (__getcwd): On native Windows, use _getcwd. * lib/close.c (close_nothrow): On native Windows, use _close. * lib/creat.c (orig_creat): On native Windows, use _creat. * lib/dup.c (dup_nothrow): On native Windows, use _dup. * lib/dup2.c (dup2_nothrow): Use _dup2. * lib/fdopen.c (fdopen_nothrow): On native Windows, use _fdopen. * lib/getcwd-lgpl.c: On native Windows, use _getcwd. * lib/getcwd.c (getcwd_nothrow): Use _getcwd also on mingw. * lib/open.c (orig_open): On native Windows, use _open. * lib/read.c (read_nothrow): Use _read. * lib/rmdir.c: On native Windows, use _rmdir. * lib/unlink.c: On native Windows, use _unlink. * lib/write.c (write_nothrow): Use _write. * lib/sys_select.in.h (close): With clang, don't attach a warning on an undefined symbol. * lib/sys_socket.in.h (close): Likewise. * lib/sys_time.in.h (close): Likewise. * tests/test-spawn-pipe-child.c: On native Windows, use _fdopen.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* dup, dup2, fcntl: support a directory fd on OS/2 kLIBCKO Myung-Hun2016-01-141-1/+12
| | | | | | | | | | | | | | On OS/2 kLIBC, dup(), dup2() and fcntl() do not work on a directory fd. * lib/dup.c (dup_nothrow): New. * lib/dup2.c (klibc_dup2dirfd): New. dup2() for a directory fd. (klibc_dup2): New. * lib/fcntl.c (klibc_fcntl): New. * m4/dup.m4 (gl_FUNC_DUP): Check if dup() works on a directory fd. * m4/dup2.m4 (gl_FUNC_DUP2): Check if dup2() works on a directory fd. * m4/fcntl.m4 (gl_FUNC_FCNTL): Check if F_DUPFD works on a directory fd.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* Android doesn't define RLIM_SAVED_*Paul Eggert2015-02-221-1/+7
| | | | | | | | | | | | Portability problem reported by Kevin Cernekee in: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00122.html * doc/posix-headers/sys_resource.texi (sys/resource.h): Mention the portability problem. * lib/getdtablesize.c (RLIM_SAVED_CUR, RLIM_SAVED_MAX): Define if not defined. * m4/dup2.m4 (gl_FUNC_DUP2): * m4/fcntl.m4 (gl_FUNC_FCNTL): Likewise.
* fcntl: Fix cross compilingKevin Cernekee2015-02-191-2/+2
| | | | | * m4/fcntl.m4 (gl_FUNC_FCNTL): Assign the guessed result to the correct variable name (gl_cv_func_fcntl_f_dupfd_works).
* dup2, fcntl: cross-compiler better for AndroidPaul Eggert2015-02-181-5/+5
| | | | | | | | | | Problem reported by Kevin Cernekee in: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00109.html * m4/dup2.m4 (gl_FUNC_DUP2): Don't guess no when cross-compiling for a Linux kernel. That kernel bug was fixed on 2009-05-11, and there's little need to cross-compile for older kernels nowadays. * m4/fcntl.m4 (gl_FUNC_FCNTL): When cross-compiling, guess no only for systems where the bug is known to occur (AIX, Cygwin, Haiku).
* dup2, fcntl: port to AIXPaul Eggert2015-02-171-18/+22
| | | | | | | | | * m4/dup2.m4 (gl_FUNC_DUP2): * m4/fcntl.m4 (gl_FUNC_FCNTL): Prefer getrusage (RLIM_NOFILE ...)/rlim_cur to sysconf (_SC_OPEN_MAX). The former works on AIX 7.1 but the latter does not. Also, this may work better with Android; see: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00100.html
* getdtablesize, dup2, fcntl: port to AndroidPaul Eggert2015-02-161-9/+9
| | | | | | | | | | | | | | | | | Problem reported by Kevin Cernekee in: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00092.html * doc/glibc-functions/getdtablesize.texi (getdtablesize): Mention that getdtablesize doesn't work on Android. * lib/getdtablesize.c: Use getrlimit substitute only if getdtablesize is declared. This should suffice for Cygwin while not breaking Android. * m4/dup2.m4 (gl_FUNC_DUP2): * m4/fcntl.m4 (gl_FUNC_FCNTL): Prefer sysconf (_SC_OPEN_MAX) to getdtablesize, as the former is standardized but the latter is not, and sysconf works on Android. * m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Also check that getdtablesize is declared. This removes the need for a special case for Android.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* dup2, fcntl, fcntl-h: port to AIX 7.1Paul Eggert2014-05-311-1/+11
| | | | | | | | | | | | | | | | | This fixes some porting problems discovered when testing the latest grep snapshot on AIX 7.1. I don't think if fixes any bugs in grep but it could be important for other applications. * doc/posix-functions/dup2.texi: * doc/posix-functions/fcntl.texi: * doc/posix-headers/fcntl.texi: Document AIX bugs. * lib/fcntl.in.h (O_CLOEXEC, O_NOFOLLOW, O_TTY_INIT) [_AIX]: Define to 0 if outside 'int' range. * m4/dup2.m4 (gl_FUNC_DUP2): * m4/fcntl.m4 (gl_FUNC_FCNTL): Check for getdtablesize. If it's available, test a value just outside its range instead of testing 1000000. When cross-compiling, guess that AIX will fail this improved test.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* fcntl: Move AC_LIBOBJ invocation to module description.Bruno Haible2011-07-261-1/+0
| | | | | * m4/fcntl.m4 (gl_REPLACE_FCNTL): Don't invoke AC_LIBOBJ. * modules/fcntl (configure.ac): Invoke AC_LIBOBJ.
* fcntl: Remove call-in from fchdir.m4.Bruno Haible2011-07-261-1/+9
| | | | | * m4/fcntl.m4 (gl_FUNC_FCNTL): Conditionally invoke gl_TEST_FCHDIR. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_FCNTL.
* fcntl: work around Haiku F_DUPFD bugsEric Blake2011-01-261-2/+7
| | | | | | | | | * m4/fcntl.m4 (gl_FUNC_FCNTL): Also catch Haiku errno bug. * lib/fcntl.c (rpl_fcntl) [F_DUPFD]: Work around Haiku losing cloexec bit on duplication. * doc/posix-functions/fcntl.texi (fcntl): Document the bug. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* fcntl: port portions of fcntl to mingwEric Blake2009-12-161-6/+8
| | | | | | | | | | | | | | | | | | | | | | | Borrow ideas from dup_cloexec and dup3 to implement F_DUPFD and F_DUPFD_CLOEXEC. Support querying the inheritance status via F_GETFD, but for now, no support for changing with F_SETFD. The remaining portions of fcntl fail with EINVAL. * m4/fcntl.m4 (gl_FUNC_FCNTL): Also build fcntl.c on mingw. * lib/fcntl.c (fcntl) <F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD>: Provide replacement for mingw. * modules/fcntl (Description): Update. (Depends-on): Add dup2. * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness. * modules/fcntl-h (Makefile.am): Substitute it. * lib/fcntl.in.h (fcntl): Update declaration. (F_DUPFD, F_GETFD): New macros, when needed. * doc/posix-headers/fcntl.texi (fcntl.h): Update documentation. * doc/posix-functions/fcntl.texi (fcntl): Likewise. * tests/test-fcntl.c (check_flags, main): Enhance test for items we now guarantee. Signed-off-by: Eric Blake <ebb9@byu.net>
* fcntl: work around cygwin bug in F_DUPFDEric Blake2009-12-161-5/+37
| | | | | | | | | | | | | fcntl(0,F_DUPFD,10000000) mistakenly failed with EMFILE instead of EINVAL, and fcntl(0,F_DUPFD,-1) mistakenly passed. * m4/fcntl.m4 (gl_REPLACE_FCNTL): New macro. (gl_FUNC_FCNTL): Use it. Test for F_DUPFD bug. * lib/fcntl.c (rpl_fcntl) <F_DUPFD>: Work around it. <F_DUPFD_CLOEXEC>: Reduce calls to _gl_register_dup. * doc/posix-functions/fcntl.texi (fcntl): Document it. Signed-off-by: Eric Blake <ebb9@byu.net>
* fcntl: support F_DUPFD_CLOEXEC on systems with fcntlEric Blake2009-12-161-0/+49
Implement F_DUPFD_CLOEXEC. The unit test still fails on systems with other fcntl bugs (such as cygwin 1.5 mishandling F_DUPFD, or mingw lacking fcntl altogether). Passes on Linux, both with and without kernel support, and on cygwin 1.7. * modules/fcntl (Files): List new files. (configure.ac): Run a test. * m4/fcntl.m4 (gl_FUNC_FCNTL): New file. * lib/fcntl.c (rpl_fcntl): Likewise. * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness defaults. (gl_FCNTL_H): Always replace fcntl.h. * modules/fcntl-h (Makefile.am): Substitute witnesses. * lib/fcntl.in.h (fcntl): Declare replacement. (F_DUPFD_CLOEXEC, GNULIB_defined_F_DUPFD_CLOEXEC): New macro when needed, plus a witness. * doc/posix-functions/fcntl.texi (fcntl): Document this. * doc/posix-headers/fcntl.texi (fcntl.h): Likewise. * tests/test-fcntl.c: New file. * modules/fcntl-tests: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>