Niko Tyni wrote:

> From fsync(2):
>
>        EBADF  fd is not a valid file descriptor open for writing.

*digs*  Looks like that description was added between man-pages-1.10
(16-Jan-1996) and man-pages-1.11 (15-Apr-1996).  From a look at Linux
0.99.10, I think fsync has just looked at the dirent and inode from
the start and not paid much mind to the file descriptor.  Maybe the
text was added to help compatibility with Unixen like AIX which are
documented to require a file descriptor open for writing, as Guillem
mentioned.

Here's the full change from back then, for reference.

diff --git man-pages-1.10/man2/fsync.2 man-pages-1.11/man2/fsync.2
index 5222a42e..e29c214d 100644
--- man-pages-1.10/man2/fsync.2
+++ man-pages-1.11/man2/fsync.2
@@ -25,11 +25,12 @@
 .\" Modified 21 Aug 1994 by Michael Chastain (m...@shell.portal.com):
 .\"   Removed note about old libc (pre-4.5.26) translating to 'sync'.
 .\" Modified 15 Apr 1995 by Michael Chastain (m...@shell.portal.com):
-.\"   Added 'see also' section.
-.\"
-.TH FSYNC 2 "15 April 1995" "Linux 1.2.4" "Linux Programmer's Manual"
+.\"   Added `see also' section.
+.\" Modified 13 Apr 1996 by Markus Kuhn (msk...@cip.informatik.uni-erlangen.de)
+.\"   Added remarks about fdatasync.
+.TH FSYNC 2 "1994-04-13" "Linux 1.3.85" "Linux Programmer's Manual"
 .SH NAME
-fsync \- synchronize a file's in-core state with that on disk
+fsync \- synchronize a file's complete in-core state with that on disk
 .SH SYNOPSIS
 .B #include <unistd.h>
 .sp
@@ -37,6 +38,11 @@ fsync \- synchronize a file's in-core state with that on disk
 .SH DESCRIPTION
 .B fsync
 copies all in-core parts of a file to disk.
+
+In some applications,
+.B fdatasync
+is a more efficient alternative to
+.BR fsync .
 .SH "RETURN VALUE"
 On success, zero is returned.  On error, \-1 is returned, and
 .I errno
@@ -44,15 +50,20 @@ is set appropriately.
 .SH ERRORS
 .TP 0.8i
 .B EBADF
-.B fd
-is not a valid open file descriptor.
+.I fd
+is not a valid file descriptor open for writing.
 .TP
-.B EROFS
-.B EINVAL
-.B fd
-is bound to a special file which doesn't support synchronization.
+.BR EROFS ", " EINVAL
+.I fd
+is bound to a special file which does not support synchronization.
 .TP
 .B EIO
 An error occurred during synchronization.
+.SH "CONFORMING TO"
+POSIX.1b
 .SH "SEE ALSO"
-.BR bdflush "(2), " fsync "(2), " update "(8), " sync "(8)"
+.BR bdflush (2),
+.BR fdatasync (2),
+.BR sync (2),
+.BR update (8),
+.BR sync (8)




-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to