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/unistd_h.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/unistd_h.m4')
-rw-r--r-- | m4/unistd_h.m4 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 33897ae927..29f3947b5e 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 58 +# unistd_h.m4 serial 59 dnl Copyright (C) 2006-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, @@ -40,7 +40,7 @@ AC_DEFUN([gl_UNISTD_H], # endif #endif ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat - fsync ftruncate getcwd getdomainname getdtablesize getgroups + fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups gethostname getlogin getlogin_r getpagesize getusershell setusershell endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat @@ -67,6 +67,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) + GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) @@ -110,6 +111,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) + HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) |