[MinGW-Notify] [mingw] #38225: Emulate _fseeki64()/_ftelli64() API on legacy platforms.

Back to archive index
MinGW Notification List mingw****@lists*****
Tue Nov 27 03:15:29 JST 2018


#38225: Emulate _fseeki64()/_ftelli64() API on legacy platforms.

  Open Date: 2018-04-21 14:26
Last Update: 2018-11-26 18:15

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/38225
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38225

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2018-11-26 18:15 Updated by: keith

Comment:

I have performed a review of Mumit Kahn's mingw-fseek.c implementation; I
observe several minor issues, and at least one critical issue. The critical
issue is:–

  • The fseek() wrapper sets a flag, to indicate that it has been called; this
    flag is then reset on the next call to the fwrite() wrapper. In neither
    case is there any attempt to associate the flag with any particular stream,
    never mind to ensure that the fwrite() is directed to the stream on which
    the fseek() was performed. In consequence, it is entirely possible that the
    flag could have been reset before the fwrite() which needs to act on it is
    performed.

Besides this critical issue, other non-critical issues include:–

  • Unnecessary use of (ugly) low level Windows APIs, leading to excessive
    complexity of the implementation.
  • Unnecessary repeated calls to the _get_osfhandle() API, within a single
    fwrite() wrapper call; this surely has a negative impact on performance.
  • Two fseek() wrapper functions, where one would suffice; (all fseek()-alike
    calls could be redirected a to single wrapper, in which a 64-bit offset
    argument is passed).



---------------------------------------------------------------------
Ticket Status:

      Reporter: keith
         Owner: (None)
          Type: Feature Request
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: WSL
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Although 32-bit Windows has supported operations on files larger than 2GB,
since at least WinNT4 and Win98, (and possibly earlier), Microsoft did not
introduce the _fseeki64() and _ftelli64() APIs until MSVCR80.DLL, (and
subsequently retrofitted it to MSVCRT.DLL, from WinVista onwards); prior to
this, random access support in large files was provided through lower level
APIs such as _lseeki64(), or native Windows API functions.

As noted in this mailing list query, and this subsequent follow-up thread, it
is practicable to emulate the _fseeki64() and _ftelli64() APIs, such that they
become available on legacy versions of Windows, which pre-date the formal
introduction of these APIs by Microsoft; however, previous efforts to do so may
not have been entirely robust. Hopefully, the attached patch will do a better
job.



-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/38225
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38225



More information about the MinGW-Notify mailing list
Back to archive index