mmap stdio breaks GNU ld

Ulrich Drepper drepper@redhat.com
Mon Jan 21 19:34:00 GMT 2002


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:

   +-----------------------------------------------------------------+
   |                                                                 |
   +-----------------------------------------------------------------+
   ^                           ^                                     ^
   |                           |                                     |
   readstart             readptr                               readend

Given this the file position if computed as

  offset - (readend - readptr)

where 'offset' is the offset of the byte following the last byte in
the buffer.  'offset' can also be the actual file descriptor position.
And note, this was always in the case even with the file descriptor
not being at the beginning of the file.

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

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------



More information about the Libc-alpha mailing list