+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.
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
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)));
_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
-# 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,
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
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
-# 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,
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
])
-# 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,
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])
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])
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:
-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' \
-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' \