Re: 64 bit I/O

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 01 Jun 2002 14:55:30 +0200

Guido Serassio wrote:

> Working on COSS, I have some doubt on 64 bit I/O C coding.
>
> - The first question is, there is a standard, or it's platform dependent ?

Platform dependent as far as I know.

The standard method is to have the platform support 64 bit size_t, off_t
etc. This is the default on 64 bit architectures, but many 32 bit
environments also supports it by platform dependent compiler switches.

Squid is taught about the platform switches needed on Linux to switch to
64 bit file I/O, enabled by the --enable-large-files option (HEAD).

> - On Solaris and Linux I have found aio_xxx64() family functions, but are
> there standard ? And how should they be used ?

These are not standard as far as I know, but I suppose the interface and
usage is identical to the standard functions except that 64 bit special
purpose types is used on all architectures..

Maybe SUSv3 has some provisions for a standard "64 bit file I/O on 32
bit platforms".. checking.. nope, not above telling that the main UNIX
vendors have selected LP64 as being the preferred architecture (long 64
bits, pointers 64 bits, int 32 bits).

Personally I prefer the global switch mentioned above to fully switch to
64 bit file I/O.

> - On MS VC there is the "%I64d" 64 bit printf() format, but I think that
> this is not standard, on Linux there is "%lld", but there is some standard
> for this ?

I haven't kept fully up to date with the C standard, but my
understanding is that "long long" has been included in the latest
standard (C99) with ll as it's format size specifier (%lld for "long
long int", %llu for "long long signed int" etc..). I don't have the C99
standard but the draft C99 rationale includes these as being added in
C99..

Regards
Henrik
Received on Sat Jun 01 2002 - 07:04:29 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:34 MST