file size parsed/passed incorrectly/incompletely in
cli_qpathinfo*()
Henrik Nordstrom
hno at squid-cache.org
Wed Mar 16 13:07:26 GMT 2005
On Tue, 15 Mar 2005 Derrell.Lipman at UnwiredUniverse.com wrote:
> P1. size_t is used for storing file sizes internally. Unfortunately, it does
> not seem that size_t changes to 64 bits (on Linux) when LARGEFILE64_SOURCE
> is defined and _FILE_OFFSET_BITS=64 is specified. Although size_t was
> traditionally used as the type of a variable which holds a file size, the
> proper type these days (at least on Linux; unverified elsewhere) is off_t
> which does change to 64 bits with the above definitions. "struct stat"
> uses off_t for storing file sizes.
Not even sure size_t ever was the traditional. For as long as I can see in
the history of UNIX off_t as been "the" type for file sizes and positions,
and size_t the size of I/O buffers etc. Before that long resp int appears
to have been used for the purpose.
But it is true that very many developers uses size_t for file size, myself
included up until not long ago. The names of these two types is very
confusing. Have recently audited the Squid sources for this specific issue
and there were large scale misuse of both types, both using size_t for
file sizes and off_t for plain integer offsets where int is more
appropriate.
It may be worth noting that standard C uses fpos_t to solve this equation,
with long as a legacy interface..
Regards
Henrik
More information about the samba-technical
mailing list