Thread (1 message) 1 message, 1 author, 2012-02-27

Re: [PATCH] fsync.2 updates

From: Michael Kerrisk <hidden>
Date: 2012-02-27 01:08:37

Guillem,

On Sun, Jan 1, 2012 at 3:49 PM, Guillem Jover [off-list ref] wrote:
Hi!

On 2011-11-04 6:12:04, Christoph Hellwig wrote:
quoted
- fsync works on any fd and does not require a writeable one,
  correct the EBADF error code explanation.
The problem is, while this is true for Linux, that's not a safe portable
assumption to make on POSIX in general as that behaviour is not
specified and as such is implementation specific, some Unix systems
do actually fail on read-only file descriptors, for example:

 <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V50_HTML/MAN/MAN2/0033____.HTM>
 <http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/fsync.htm>

So if this part of the patch gets applied it would be nice to add a
note stating this is Linux specific behaviour, and that other systems
might still fail on such condition.
Good catch! I applied the patch below.

Cheers,

Michael

--- a/man2/fsync.2
+++ b/man2/fsync.2
@@ -139,6 +139,12 @@ to a value greater than 0.
 .\" -1: unavailable, 0: ask using sysconf().
 .\" glibc defines them to 1.
 .SH NOTES
+On some UNIX systems (but not Linux),
+.I fd
+must be a
+.I writable
+file descriptor.
+
 In Linux 2.2 and earlier,
 .BR fdatasync ()
 is equivalent to
-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help