bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fdatasync: port to MacOS X 10.7


From: Eric Blake
Subject: [PATCH] fdatasync: port to MacOS X 10.7
Date: Fri, 16 Sep 2011 13:51:42 -0600

MacOS X 10.7 added an fdatasync syscall and exports a symbol for it,
but fails to declare it anywhere.  Lacking any hard evidence that this
syscall is broken, we will just provide the declaration and use it.

* m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Check for present but not
declared.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Another default.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (fdatasync): Declare on MacOS.
* doc/posix-functions/fdatasync.texi (fdatasync): Document it.

Signed-off-by: Eric Blake <address@hidden>
---

Right now, I only have access to MacOS X 10.5, so I couldn't test
this directly; but I did test that priming the cache with
ac_cv_have_decl_fdatasync=no on Linux gives the desired results
(declaration is present in unistd.h, but no .c file is compiled,
thus using the existing symbol from libc).

 ChangeLog                          |    8 ++++++++
 doc/posix-functions/fdatasync.texi |    3 +++
 lib/unistd.in.h                    |    2 +-
 m4/fdatasync.m4                    |    7 ++++++-
 m4/unistd_h.m4                     |    1 +
 modules/unistd                     |    1 +
 6 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7783d07..4a2faf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-09-16  Eric Blake  <address@hidden>

+       fdatasync: port to MacOS X 10.7.
+       * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): Check for present but not
+       declared.
+       * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Another default.
+       * modules/unistd (Makefile.am): Substitute it.
+       * lib/unistd.in.h (fdatasync): Declare on MacOS.
+       * doc/posix-functions/fdatasync.texi (fdatasync): Document it.
+
        fdatasync: minor improvements
        * modules/fdatasync (Depends-on): Add condition for fsync.
        * lib/fdatasync.c (fdatasync): Add comment.
diff --git a/doc/posix-functions/fdatasync.texi 
b/doc/posix-functions/fdatasync.texi
index 8209ecd..2382386 100644
--- a/doc/posix-functions/fdatasync.texi
+++ b/doc/posix-functions/fdatasync.texi
@@ -9,6 +9,9 @@ fdatasync
 Portability problems fixed by Gnulib:
 @itemize
 @item
+This function is present but not declared on some platforms:
+MacOS X 10.7.
address@hidden
 This function is missing on some platforms:
 MacOS X 10.5, FreeBSD 6.0, OpenBSD 3.8, Minix 3.1.8, IRIX 5.3, Solaris 2.4, 
mingw, MSVC 9, Interix 3.5, BeOS.
 @end itemize
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 7c274b4..1c67173 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -489,7 +489,7 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
    Return 0 if successful, otherwise -1 and errno set.
    See POSIX:2008 specification
    <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. 
 */
-# if address@hidden@
+# if address@hidden@ || address@hidden@
 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
 # endif
 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
diff --git a/m4/fdatasync.m4 b/m4/fdatasync.m4
index 8eceeb5..cb11946 100644
--- a/m4/fdatasync.m4
+++ b/m4/fdatasync.m4
@@ -1,4 +1,4 @@
-# fdatasync.m4 serial 1
+# fdatasync.m4 serial 2
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,4 +11,9 @@ AC_DEFUN([gl_FUNC_FDATASYNC],
   if test $ac_cv_func_fdatasync = no; then
     HAVE_FDATASYNC=0
   fi
+  dnl MacOS X 10.7 has fdatasync but does not declare it.
+  AC_CHECK_DECLS_ONCE([fdatasync])
+  if test $ac_cv_have_decl_fdatasync = no; then
+    HAVE_DECL_FDATASYNC=0
+  fi
 ])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 29f3947..720e0fd 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -136,6 +136,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
   HAVE_DECL_FCHDIR=1;     AC_SUBST([HAVE_DECL_FCHDIR])
+  HAVE_DECL_FDATASYNC=1;  AC_SUBST([HAVE_DECL_FDATASYNC])
   HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
   HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
diff --git a/modules/unistd b/modules/unistd
index f843a2f..77ce7a8 100644
--- a/modules/unistd
+++ b/modules/unistd
@@ -108,6 +108,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
+             -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
              -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' 
\
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]