diff options
author | Eric Blake <eblake@redhat.com> | 2011-09-16 09:59:23 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-09-16 11:18:56 -0600 |
commit | 64da7b6c00400c0a5e5b02df98faec97c0954a3c (patch) | |
tree | 7f5dacf7c2c31dab750f2889ef58ff6f20db2291 /m4/fdatasync.m4 | |
parent | 9a0a67e426f31b06f0e3f202618094f6f582c5db (diff) | |
download | gnulib-64da7b6c00400c0a5e5b02df98faec97c0954a3c.tar.gz |
fdatasync: new module
At least libvirt would like to use the lighter-weight fdatasync
on platforms where it is supported, while still guaranteeing full
sync (via the heavy-weight fsync fallback) on all platforms.
I've got an open question to the Austin Group, since the POSIX 2008
wording is self-contradictory (unlike fsync, fdatasync requires
EBADF on non-writable fds, but still mentions that read() errors
must be propagated). I can see how fsync() would affect atime after
read() while fdatasync() can skip that, explaining why fdatasync()
might have the EBADF requirement, but on the other hand, that prevents
an implementation (like ours) where fdatasync is a straight alias of
fsync. At any rate, glibc allows fdatasync on read-only fds.
* modules/fsync (Description): Document difference to fdatasync.
* modules/fdatasync: New module.
* m4/fdatasync.m4 (gl_FUNC_FDATASYNC): New file.
* lib/fdatasync.c (fdatasync): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H, gl_UNISTD_H_DEFAULTS): Set up
defaults.
* modules/unistd (Makefile.am): Set witnesses.
* lib/unistd.in.h (fdatasync): Declare.
* MODULES.html.sh: Document it.
* doc/posix-functions/fdatasync.texi (fdatasync): Likewise.
* modules/fdatasync-tests: New test.
* tests/test-fdatasync.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'm4/fdatasync.m4')
-rw-r--r-- | m4/fdatasync.m4 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/m4/fdatasync.m4 b/m4/fdatasync.m4 new file mode 100644 index 0000000000..8eceeb547b --- /dev/null +++ b/m4/fdatasync.m4 @@ -0,0 +1,14 @@ +# fdatasync.m4 serial 1 +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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FDATASYNC], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([fdatasync]) + if test $ac_cv_func_fdatasync = no; then + HAVE_FDATASYNC=0 + fi +]) |