This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED] manual/filesys.texi: O_WRONLY files also fail with EBADF when used with posix_fallocate emulation.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 29 Sep 2015 11:32:25 -0400
- Subject: [COMMITTED] manual/filesys.texi: O_WRONLY files also fail with EBADF when used with posix_fallocate emulation.
- Authentication-results: sourceware.org; auth=none
In the posix_fallocate description in the manual we list various
drawbacks with the emulation, including the fact that a file opened
with O_APPEND fails with EBADF. Similarly a file opened with O_WRONLY
fails with EBADF. We must be able to emulate a compare-and-swap via
pread/compare/pwrite in order to make the emulation as safe as possible.
It is not acceptable to ignore the read failure because it could result
in significant data loss across all of the blocks. There is no other way
to make this work without a true atomic CAS and SIGBUS handler (which
is looking more attractive as a way to remove the race condition).
This patch adds O_WRONLY to the manual as another bullet to clarify the
limits of the emulation.
Manual looks good in PDF.
Committed.
Cheers,
Carlos.
2015-09-29 Carlos O'Donell <carlos@redhat.com>
* manual/filesys.texi (Storage Allocation): Document that
posix_fallocate emulation fails when fd is open with O_WRONLY.
diff --git a/manual/filesys.texi b/manual/filesys.texi
index ed4f5fd..4064885 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -3300,6 +3300,10 @@ underlying file in the to-be-allocated area. Non-null bytes could be
overwritten with null bytes.
@item
+If @var{fd} has been opened with the @code{O_WRONLY} flag, the function
+will fail with an @code{errno} value of @code{EBADF}.
+
+@item
If @var{fd} has been opened with the @code{O_APPEND} flag, the function
will fail with an @code{errno} value of @code{EBADF}.