RTEMS Targets Issue #2 - ftello()/fseeko()

Yaakov Selkowitz yselkowitz@cygwin.com
Sun Mar 20 23:19:00 GMT 2016


On 2016-03-20 16:14, Corinna Vinschen wrote:
> On Mar 20 14:18, Yaakov Selkowitz wrote:
>> On 2016-03-20 07:35, Corinna Vinschen wrote:
>>> Note especially the _FILE_OFFSET_BITS == 64.  So fseeko/ftello are
>>> always defined on systems with sizeof(off_t) == 8.
>>
>> This is the exception to the "-D_FILE_OFFSET_BITS=64 as no affect on 64-bit
>> systems" rule; try compiling with -ansi and you should see they are not.
>> Note that _POSIX_C_SOURCE=200809L is on by default, so maybe that's what
>> you're seeing?
>
> I'm not sure I understand.  I only referred to the man page, I didn't
> test this.  Can you expand on this a bit?

_FILE_OFFSET_BITS is just another feature test macro, which means that 
off_t should be 64-bit, and standard functions which use off_t should be 
redirected to the 64-bit variants.  It is not defined automatically on 
64-bit platforms (even where off_t is *naturally* 64-bit).

I still have to implement this and the _LARGEFILE64_SOURCE (which 
exposes off64_t and the open64 family of functions) feature test macros. 
  This is a bit tricky because Cygwin is different from other platforms 
in this regard.  For now, adding my pending patch for POSIX.1-2001 
enablement should suffice.

-- 
Yaakov



More information about the Newlib mailing list