summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--lib/unistd.in.h20
-rw-r--r--m4/fdatasync.m417
-rw-r--r--m4/pipe2.m47
-rw-r--r--m4/unistd_h.m44
-rw-r--r--modules/fdatasync4
-rw-r--r--modules/unistd2
7 files changed, 60 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index a491d5ab6f..0859e1fd87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2023-01-22 Bruno Haible <bruno@clisp.org>
+ Resolve conflicts for functions introduced in Android API level 9.
+ * lib/unistd.in.h (fdatasync): Consider REPLACE_FDATASYNC. Disable
+ _GL_CXXALIASWARN invocation on non-glibc systems.
+ (pipe2): Consider REPLACE_PIPE2. Disable _GL_CXXALIASWARN invocation on
+ non-glibc systems.
+ * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_FDATASYNC,
+ REPLACE_PIPE2.
+ * modules/unistd (Makefile.am): Substitute REPLACE_FDATASYNC,
+ REPLACE_PIPE2.
+ * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Test for fdatasync using
+ gl_CHECK_FUNCS_ANDROID instead of AC_CHECK_FUNCS. Conditionally set
+ REPLACE_FDATASYNC.
+ * modules/fdatasync (Depends-on, configure.ac): Consider
+ REPLACE_FDATASYNC.
+ * m4/pipe2.m4 (gl_FUNC_PIPE2): Conditionally set REPLACE_PIPE2.
+
+2023-01-22 Bruno Haible <bruno@clisp.org>
+
Resolve conflicts for functions introduced in Android API level 8.
* m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Conditionally set
REPLACE_TTYNAME_R.
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index f6d7c8d0a9..9b330286e0 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1002,11 +1002,22 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
Return 0 if successful, otherwise -1 and errno set.
See POSIX:2008 specification
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
-# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
+# if @REPLACE_FDATASYNC@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fdatasync
+# define fdatasync rpl_fdatasync
+# endif
+_GL_FUNCDECL_RPL (fdatasync, int, (int fd));
+_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
+# else
+# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
-# endif
+# endif
_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
+# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fdatasync);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fdatasync
# if HAVE_RAW_DECL_FDATASYNC
@@ -1742,8 +1753,9 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
Return 0 upon success, or -1 with errno set upon failure.
See also the Linux man page at
<https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
-# if @HAVE_PIPE2@
+# if @REPLACE_PIPE2@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef pipe2
# define pipe2 rpl_pipe2
# endif
_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
@@ -1752,7 +1764,9 @@ _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (pipe2);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef pipe2
# if HAVE_RAW_DECL_PIPE2
diff --git a/m4/fdatasync.m4 b/m4/fdatasync.m4
index 201d7ffb27..17cf64cc1d 100644
--- a/m4/fdatasync.m4
+++ b/m4/fdatasync.m4
@@ -1,4 +1,4 @@
-# fdatasync.m4 serial 8
+# fdatasync.m4 serial 9
dnl Copyright (C) 2008-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,
@@ -17,10 +17,13 @@ AC_DEFUN([gl_FUNC_FDATASYNC],
if test $ac_cv_have_decl_fdatasync = no; then
HAVE_DECL_FDATASYNC=0
dnl Mac OS X 10.7 has fdatasync but does not declare it.
- dnl Likewise Android with API level < 9. Cf. gl_CHECK_FUNCS_ANDROID.
- AC_CHECK_FUNCS([fdatasync])
+ dnl Likewise Android with API level < 9.
+ gl_CHECK_FUNCS_ANDROID([fdatasync], [[#include <unistd.h>]])
if test $ac_cv_func_fdatasync = no; then
HAVE_FDATASYNC=0
+ case "$gl_cv_onwards_func_fdatasync" in
+ future*) REPLACE_FDATASYNC=1 ;;
+ esac
fi
else
case "$host_os" in
@@ -35,10 +38,14 @@ AC_DEFUN([gl_FUNC_FDATASYNC],
LIBS=$gl_saved_libs
;;
*)
- dnl Android 4.3 does not have fdatasync but declares it.
- AC_CHECK_FUNCS([fdatasync])
+ dnl Android 4.3 does not have fdatasync but declares it, and future
+ dnl Android versions have it.
+ gl_CHECK_FUNCS_ANDROID([fdatasync], [[#include <unistd.h>]])
if test $ac_cv_func_fdatasync = no; then
HAVE_FDATASYNC=0
+ case "$gl_cv_onwards_func_fdatasync" in
+ future*) REPLACE_FDATASYNC=1 ;;
+ esac
fi
;;
esac
diff --git a/m4/pipe2.m4 b/m4/pipe2.m4
index c7ec02e873..79de69cd1a 100644
--- a/m4/pipe2.m4
+++ b/m4/pipe2.m4
@@ -1,4 +1,4 @@
-# pipe2.m4 serial 3
+# pipe2.m4 serial 4
dnl Copyright (C) 2009-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,
@@ -14,5 +14,10 @@ AC_DEFUN([gl_FUNC_PIPE2],
gl_CHECK_FUNCS_ANDROID([pipe2], [[#include <unistd.h>]])
if test $ac_cv_func_pipe2 != yes; then
HAVE_PIPE2=0
+ case "$gl_cv_onwards_func_pipe2" in
+ future*) REPLACE_PIPE2=1 ;;
+ esac
+ else
+ REPLACE_PIPE2=1
fi
])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index f4384027e3..c7ef46c26d 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 90
+# unistd_h.m4 serial 91
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_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE])
REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT])
REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
+ REPLACE_FDATASYNC=0; AC_SUBST([REPLACE_FDATASYNC])
REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
@@ -248,6 +249,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
+ REPLACE_PIPE2=0; AC_SUBST([REPLACE_PIPE2])
REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
REPLACE_READ=0; AC_SUBST([REPLACE_READ])
diff --git a/modules/fdatasync b/modules/fdatasync
index 6e0f48df21..4d13a97cdb 100644
--- a/modules/fdatasync
+++ b/modules/fdatasync
@@ -6,12 +6,12 @@ lib/fdatasync.c
m4/fdatasync.m4
Depends-on:
-fsync [test $HAVE_FDATASYNC = 0]
+fsync [test $HAVE_FDATASYNC = 0 || test $REPLACE_FDATASYNC = 1]
unistd
configure.ac:
gl_FUNC_FDATASYNC
-gl_CONDITIONAL([GL_COND_OBJ_FDATASYNC], [test $HAVE_FDATASYNC = 0])
+gl_CONDITIONAL([GL_COND_OBJ_FDATASYNC], [test $HAVE_FDATASYNC = 0 || test $REPLACE_FDATASYNC = 1])
gl_UNISTD_MODULE_INDICATOR([fdatasync])
Makefile.am:
diff --git a/modules/unistd b/modules/unistd
index 01da57e23a..80080ede9e 100644
--- a/modules/unistd
+++ b/modules/unistd
@@ -188,6 +188,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \
-e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
+ -e 's|@''REPLACE_FDATASYNC''@|$(REPLACE_FDATASYNC)|g' \
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
@@ -202,6 +203,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
-e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
+ -e 's|@''REPLACE_PIPE2''@|$(REPLACE_PIPE2)|g' \
-e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
-e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
-e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \