This is the mail archive of the 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: mmap stdio breaks GNU ld

Paul Eggert <> writes:

|> > Date: Tue, 22 Jan 2002 02:13:31 -0600
|> > From: Mark Brown <>
|> > Yes, POSIX doesn't make clear that "the position indicated by the
|> > file offset" could be anywhere".
|> That's being generous, as POSIX obscures the issue so much that light
|> barely escapes.  For example, here's a quote from the POSIX 1003.1-2001
|> section "Interaction of File Descriptors and Standard I/O Streams":
|>    * If any previous active handle has been used by a function that
|>      explicitly changed the file offset, except as required above for
|>      the first handle, the application shall perform an lseek( ) or
|>      fseek( ) (as appropriate to the type of handle) to an appropriate
|>      location.
|> I still can't parse the phrase "except as required above for the first
|> handle", and I've read the context several times.

It refers to the items above the last paragraph, where it states what you
have to do before you can use a file description through a second handle.
There it says, that if you have an input or update stream you need to call
either fflush (if defined at all, I would add) or fclose on it.  In other
words, you don't need to call fseek again after fflush, this is the
exception as described in your quote.


Andreas Schwab, SuSE Labs,
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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