mmap stdio breaks GNU ld
Mark Brown
bmark@us.ibm.com
Mon Jan 21 18:57:00 GMT 2002
On Friday, January 18, 2002, at 05:06 PM, Ulrich Drepper wrote:
> Bruno Haible <haible@ilog.fr> writes:
>
>> I.e. 'fileno' has become useless because the file pointer
>> is positioned at the end of the file right after opening it.
>
> It is wrong to assume anything about the position of the file
> descriptor after fopen(). The standard dosn't guarantee anything.
Here is a quote from ISO C 99:
7.19.3 Files
A stream is associated with an external file (which may be a
physical device)
by opening a file, which may involve creating a new file.
Creating an existing
file causes its former contents to be discarded, if necessary.
If a file can
support positioning requests (such as a disk file, as opposed to
a terminal),
then a file position indicator associated with the stream is
positioned at
the start (character number zero) of the file, unless the file is
opened with append mode in which case it is
implementation-defined whether
the file position indicator is initially positioned at the
beginning or the
end of the file. The file position indicator is maintained by subsequent
reads, writes, and positioning requests, to facilitate an orderly
progression through the file.
---
Mark S. Brown
Senior Technical Staff Member, IBM Server Group
512.838.3926 fax 512.838.3882
bmark@us.ibm.com
More information about the Libc-alpha
mailing list