This is the mail archive of the libc-alpha@sources.redhat.com 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



On Monday, January 21, 2002, at 09:34  PM, Ulrich Drepper wrote:

> Mark Brown <bmark@us.ibm.com> writes:
>
>> Here is a quote from ISO C 99:
>
> ISO C cannot possibly talk about file descriptors.  The wording used
> "file position indicator" refers to the possibly abstract position in
> the file which is maintained by computations of the buffer pointer and
> possibly an offset variable:

Yes, I understand this. I was pointing out where the expectation
comes from.

> The only standard which could talk about file descriptors is
> Unix/POSIX and the fopen man page says nothing.

And here is the relevant text. Note that C talks about associating a
stream with a file (and thus the file position indicator must be at
the start) while POSIX talks about associating a stream with a
file descriptor. Yes, POSIX doesn't make clear that "the position
indicated by the file offset" could be anywhere". But you can see where
the expectation comes from. This sounds like a minor documentation
issue.

BTW: a search of the POSIX and TOG interps archives yields no hits
for this topic, it really is not directly specified.

---relevant text---

1003.1-1996v 8.2 C Langauge I/O Functions
The type FILE and the terms file position indicator and stream are those
defined by the C Standard {2}.


1003.1-1996 8.2.2 fdopen():
The file position indicator associated with the new stream is set to the
position indicated by the file offset associated with the file
descriptor. The error indicator and end-of-file indicator for the stream
shall be cleared.


ISO C 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		


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