unix question: files per directory

Guy Harris guy at auspex.auspex.com
Thu Apr 13 04:24:31 AEST 1989


>Why was it decided that off_t should be signed?  Why should it not be
>unsigned long where unsigned longs are supported, or unsigned int where int
>is a 32 bit quantity?  It seems that signed long imposes an unnecessary
>2GB limit on file size.

And an unsigned long on a machine where that's 32 bits long imposes a
4GB limit on file size.  If 2GB is a limitation, I suspect 4GB will be
one shortly.... 

>And it doesn't make sense to have a negative offset into a file.  The
>only exception that comes to mind is that of returning an error code from
>a function like lseek(),

"lseek" also provides another exception.  Its second argument is an
"off_t", and since it can use that argument either as an absolute offset
in the file (i.e., relative to the beginning of the file) *or* as a
possibly-negative offset relative to the current position in the file or
to the end of the file, it has to be signed. 

Making "off_t" unsigned is a stopgap measure with its own problems.  If
(when) offsets > 2GB are needed, the fix will probably be to go to
64-bit offsets of some sort.



More information about the Comp.unix.wizards mailing list