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


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   `------------------------


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