From 1500d77252e6158b8e421de52f60057b0feedab8 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 16 Sep 2011 12:47:13 -0600 Subject: [PATCH] fdatasync: minor improvements Picks up some ideas by Paul Eggert from here: https://lists.gnu.org/archive/html/bug-coreutils/2011-07/msg00157.html * modules/fdatasync (Depends-on): Add condition for fsync. * lib/fdatasync.c (fdatasync): Add comment. * tests/test-unistd-c++.cc: Test fdatasync. Signed-off-by: Eric Blake --- ChangeLog | 5 +++++ lib/fdatasync.c | 2 ++ modules/fdatasync | 2 +- tests/test-unistd-c++.cc | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c76f3ae5a..7783d0711 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-09-16 Eric Blake + fdatasync: minor improvements + * modules/fdatasync (Depends-on): Add condition for fsync. + * lib/fdatasync.c (fdatasync): Add comment. + * tests/test-unistd-c++.cc: Test fdatasync. + unistd: update refs to newer POSIX * lib/unistd.in.h: Prefer POSIX 2008 over 2001. Suggested by Bruno Haible. diff --git a/lib/fdatasync.c b/lib/fdatasync.c index 54c10fd91..3d26793f6 100644 --- a/lib/fdatasync.c +++ b/lib/fdatasync.c @@ -21,5 +21,7 @@ int fdatasync (int fd) { + /* This does more work than strictly necessary, but is the best we + can do portably. */ return fsync (fd); } diff --git a/modules/fdatasync b/modules/fdatasync index 7b78a800b..19c1aeeea 100644 --- a/modules/fdatasync +++ b/modules/fdatasync @@ -6,7 +6,7 @@ lib/fdatasync.c m4/fdatasync.m4 Depends-on: -fsync +fsync [test $HAVE_FDATASYNC = 0] unistd configure.ac: diff --git a/tests/test-unistd-c++.cc b/tests/test-unistd-c++.cc index 12e415b00..fb7425bcb 100644 --- a/tests/test-unistd-c++.cc +++ b/tests/test-unistd-c++.cc @@ -60,6 +60,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fchownat, int, (int, char const *, uid_t, gid_t, int)); #endif +#if GNULIB_TEST_FDATASYNC +SIGNATURE_CHECK (GNULIB_NAMESPACE::fdatasync, int, (int)); +#endif + #if GNULIB_TEST_FSYNC SIGNATURE_CHECK (GNULIB_NAMESPACE::fsync, int, (int)); #endif -- 2.11.0