This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: mmap stdio breaks GNU ld
- From: Mark Brown <bmark at us dot ibm dot com>
- To: drepper at redhat dot com (Ulrich Drepper)
- Cc: Bruno Haible <haible at ilog dot fr>, libc-alpha at sources dot redhat dot com
- Date: Mon, 21 Jan 2002 15:06:36 -0600
- Subject: Re: mmap stdio breaks GNU ld
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