1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

fchdir: Override properly on OS/2 kLIBC.

* lib/unistd.in.h (fchdir): Override if REPLACE_FCHDIR is 1.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_FCHDIR.
* modules/unistd (Makefile.am): Substitute REPLACE_FCHDIR.
* modules/fchdir (Depends-on, configure.ac): Test REPLACE_FCHDIR.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Instead of setting HAVE_FCHDIR to 0,
set REPLACE_FCHDIR to 1.
This commit is contained in:
Bruno Haible
2023-09-29 10:46:15 +02:00
parent d8163d7f66
commit abb0e725ea
6 changed files with 50 additions and 32 deletions
+10
View File
@@ -1,3 +1,13 @@
2023-09-29 Bruno Haible <bruno@clisp.org>
fchdir: Override properly on OS/2 kLIBC.
* lib/unistd.in.h (fchdir): Override if REPLACE_FCHDIR is 1.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_FCHDIR.
* modules/unistd (Makefile.am): Substitute REPLACE_FCHDIR.
* modules/fchdir (Depends-on, configure.ac): Test REPLACE_FCHDIR.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Instead of setting HAVE_FCHDIR to 0,
set REPLACE_FCHDIR to 1.
2023-09-29 KO Myung-Hun <komh78@gmail.com>
fdopendir: Use Windows code path on OS/2 kLIBC
+14 -9
View File
@@ -971,23 +971,28 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
# if ! @HAVE_FCHDIR@
# if @REPLACE_FCHDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fchdir
# define fchdir rpl_fchdir
# endif
_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/));
_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
# else
# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
# endif
_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
# endif
_GL_CXXALIASWARN (fchdir);
# if @REPLACE_FCHDIR@ || !@HAVE_FCHDIR@
/* Gnulib internal hooks needed to maintain the fchdir metadata. */
_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
_GL_ARG_NONNULL ((2));
_GL_EXTERN_C void _gl_unregister_fd (int fd);
_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
_GL_EXTERN_C const char *_gl_directory_name (int fd);
# else
# if !@HAVE_DECL_FCHDIR@
_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
# endif
# endif
_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
_GL_CXXALIASWARN (fchdir);
#elif defined GNULIB_POSIXCHECK
# undef fchdir
# if HAVE_RAW_DECL_FCHDIR
+2 -2
View File
@@ -1,4 +1,4 @@
# fchdir.m4 serial 30
# fchdir.m4 serial 31
dnl Copyright (C) 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,7 @@ AC_DEFUN([gl_FUNC_FCHDIR],
AC_REQUIRE([gl_DIRENT_DIR])
if test $DIR_HAS_FD_MEMBER = 0; then
dnl fchdir() should be replaced if dirfd() does not work.
HAVE_FCHDIR=0
REPLACE_FCHDIR=1
fi
fi
+2 -1
View File
@@ -1,4 +1,4 @@
# unistd_h.m4 serial 94
# unistd_h.m4 serial 95
dnl Copyright (C) 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -234,6 +234,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP])
REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE])
REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT])
REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
REPLACE_FDATASYNC=0; AC_SUBST([REPLACE_FDATASYNC])
REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
+21 -20
View File
@@ -8,29 +8,30 @@ m4/fchdir.m4
Depends-on:
dirent
unistd
assure [test $HAVE_FCHDIR = 0]
chdir [test $HAVE_FCHDIR = 0]
close [test $HAVE_FCHDIR = 0]
dirfd [test $HAVE_FCHDIR = 0]
dup2 [test $HAVE_FCHDIR = 0]
fcntl [test $HAVE_FCHDIR = 0]
fcntl-h [test $HAVE_FCHDIR = 0]
filename [test $HAVE_FCHDIR = 0]
filenamecat-lgpl [test $HAVE_FCHDIR = 0]
free-posix [test $HAVE_FCHDIR = 0]
fstat [test $HAVE_FCHDIR = 0]
getcwd-lgpl [test $HAVE_FCHDIR = 0]
malloc-posix [test $HAVE_FCHDIR = 0]
open [test $HAVE_FCHDIR = 0]
realloc-posix [test $HAVE_FCHDIR = 0]
stat [test $HAVE_FCHDIR = 0]
stdbool [test $HAVE_FCHDIR = 0]
strdup-posix [test $HAVE_FCHDIR = 0]
sys_stat [test $HAVE_FCHDIR = 0]
assure [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
chdir [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
close [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
dirfd [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
dup2 [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
fcntl [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
fcntl-h [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
filename [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
filenamecat-lgpl [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
free-posix [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
fstat [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
getcwd-lgpl [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
malloc-posix [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
open [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
realloc-posix [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
stat [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
stdbool [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
strdup-posix [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
sys_stat [test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1]
configure.ac:
gl_FUNC_FCHDIR
gl_CONDITIONAL([GL_COND_OBJ_FCHDIR], [test $HAVE_FCHDIR = 0])
gl_CONDITIONAL([GL_COND_OBJ_FCHDIR],
[test $HAVE_FCHDIR = 0 || test $REPLACE_FCHDIR = 1])
AM_COND_IF([GL_COND_OBJ_FCHDIR], [
gl_PREREQ_FCHDIR
])
+1
View File
@@ -192,6 +192,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \
-e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \
-e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-e 's|@''REPLACE_FDATASYNC''@|$(REPLACE_FDATASYNC)|g' \
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \