fseek() vs. fseeko()

Joel Sherrill joel.sherrill@oarcorp.com
Wed Jun 20 14:27:00 GMT 2012

On 06/19/2012 09:42 AM, Sebastian Huber wrote:
> On 06/19/2012 04:08 PM, Corinna Vinschen wrote:
>> Along these lines, fgetpos and fsetpos are a bit tricky since they
>> depend on the definition of fpos_t in include/stdio.h.  Right now,
>> only Cygwin defines fpos_t as 64 bit type in stdio.h, all other
>> targets define fpos_t as 32 bit and fpos64_t as 64 bit type to make
>> a clear distinction between the 32 bit and the 64 bit set of functions.
Speaking for myself, I would like the methods to default to all 64-bit
versions on RTEMS (when the CPU defaults to 64-bit).
> RTEMS has this in<machine/_types.h>:
FWIW I think that list to use 64-bit types should be longer.  We have
v850, lm32, and Microblaze I see are missing from 64-bit and I would
expect them to be on that list.

It might be better to switch to explicit selection like

if "CPUs we know we want 64 bit"
else "CPUs we know we want 32-bit"
else "Pick a way"

This would force a breakage when the person doing the port
didn't pick.
> #if defined(__arm__) || defined(__i386__) || defined(__m68k__) ||
> defined(__mips__) || defined(__PPC__) || defined(__sparc__)
> /* Use 64bit types */
> typedef __int64_t _off_t;
> #define __off_t_defined 1
> typedef __int64_t _fpos_t;
> #define __fpos_t_defined 1
> #else
> /* Use 32bit types */
> typedef __int32_t _off_t;
> #define __off_t_defined 1
> typedef __int32_t _fpos_t;
> #define __fpos_t_defined 1
> #endif
> Thus for some targets fpos_t is 64-bit.

Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985

More information about the Newlib mailing list