This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: BZ#10254: Explain additional fopen parameters


On 04/09/2012 02:43 PM, Kalle Olavi Niemitalo wrote:
Andreas Jaeger<aj@suse.com> writes:

+@item x
+Insist on creating a new file---if a file @var{filename} already
+exists, @code{fopen} fails rather than opening it.  If you use
+@samp{x} you are guaranteed that you will not clobber an existing
+file.  This is equivalent to the @code{O_EXCL} option to the
+@code{open} function (@pxref{Opening and Closing Files})

This meaning of "x" is also in the N1570 draft of C11. Unless the ratified C11 standard differs in this, I think the glibc manual should mention that "x" is not solely a glibc extension, and that portable programs using "x" should make it the last character of the string.

Thanks for the info, I've updated the patch.


Ok now to commit?

Andreas

2012-04-09 Andreas Jaeger <aj@suse.de>

    [BZ #10254]
    * manual/stdio.texi (Opening Streams): Document additional fopen
    parameters.

diff --git a/manual/stdio.texi b/manual/stdio.texi
index 0d23daa..3ba0cac 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -196,13 +196,30 @@ Additional characters may appear after these to specify flags for the
call. Always put the mode (@samp{r}, @samp{w+}, etc.) first; that is
the only part you are guaranteed will be understood by all systems.


-@Theglibc{} defines one additional character for use in
-@var{opentype}: the character @samp{x} insists on creating a new
-file---if a file @var{filename} already exists, @code{fopen} fails
-rather than opening it.  If you use @samp{x} you are guaranteed that
-you will not clobber an existing file.  This is equivalent to the
-@code{O_EXCL} option to the @code{open} function (@pxref{Opening and
-Closing Files}).
+@Theglibc{} defines additional character fors use in @var{opentype}:
+
+@table @samp
+@item c
+The file is opened with cancellation in the I/O functions disabled.
+
+@item e
+The file is opened with the flag @code{O_CLOEXEC}, thus it is closed
+if you use any of the @code{exec@dots{}} functions (@pxref{Executing a
+File}).
+
+@item m
+The file is opened and accessed using @code{mmap}. This is only
+supported with files opened for reading.
+
+@item x
+Insist on creating a new file---if a file @var{filename} already
+exists, @code{fopen} fails rather than opening it.  If you use
+@samp{x} you are guaranteed that you will not clobber an existing
+file.  This is equivalent to the @code{O_EXCL} option to the
+@code{open} function (@pxref{Opening and Closing Files})
+
+The @samp{x} modifier is part of @w{ISO C 11}.
+@end table

 The character @samp{b} in @var{opentype} has a standard meaning; it
 requests a binary stream rather than a text stream.  But this makes no

--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]