fopen + mmap

Andreas Schwab schwab@suse.de
Sat Jan 19 14:22:00 GMT 2002


Roland McGrath <roland@frob.com> writes:

|> > Are you sure that POSIX.1-1996 has this?  The C Standard has never
|> > defined fflush on input streams, and SUS2, which is based on
|> > POSIX.1-1996 IIRC, doesn't have it either.
|> 
|> I already cited the section.  It's 8.2.3(1)(g), p 213 ll 323-325:
|> 
|> 	(g) If the stream is open with a mode that allows reading and
|> 	    the underlying open file description refers to a device
|> 	    that is capable of seeking, either an fflush() shall occur
|> 	    or the stream shall be closed.
|> 
|> This is in the list of things to do on the first handle that are
|> sufficient to make the file position well-defined on the the next
|> handle used.

It only talks about a mode that _allows_ reading.  It does not make fflush
on an input stream, or an update stream that was last read, a defined
operation (you must call fclose instead to be compliant).

The whole section is about shared file descriptions, the actions to be
taken before a file descriptions may be accessed through a second handle.
It does not define the semantics of a non-shared stream.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
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."



More information about the Libc-hacker mailing list