annotate m4/fdatasync.m4 @ 15622:814138b4cfed

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>
author Eric Blake <eblake@redhat.com>
date Fri, 16 Sep 2011 09:59:23 -0600
parents
children eab059ee71cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15622
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
1 # fdatasync.m4 serial 1
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
2 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
6
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_FDATASYNC],
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
8 [
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
10 AC_CHECK_FUNCS_ONCE([fdatasync])
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
11 if test $ac_cv_func_fdatasync = no; then
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
12 HAVE_FDATASYNC=0
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
13 fi
814138b4cfed fdatasync: new module
Eric Blake <eblake@redhat.com>
parents:
diff changeset
14 ])