unix question: files per directory

Lloyd Kremer kremer at cs.odu.edu
Wed Apr 12 09:12:40 AEST 1989



In article <24110 at beta.lanl.gov> dxxb at beta.lanl.gov (David W. Barts) writes:
>How many files can there be in a single UNIX directory

In article <16839 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>The maximum size is the same as for files, namely 2^31 - 1 (2147483647)
>bytes.  (This is due to the use of a signed 32 bit integer for off_t.


Point of curiosity:

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.

There are many devices having a capacity greater than 4 or 5 GB.  It seems
reasonable that one might want a file greater than 2GB on such a device,
such as the product of something akin to 'tar -cf' of a whole filesystem.

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(), and this special case could be macro'd like

	#define SEEK_ERR ((off_t)(-1))

in <sys/types.h> or <sys/stat.h>.

					Just curious,

					Lloyd Kremer
					Brooks Financial Systems
					{uunet,sun,...}!xanth!brooks!lloyd



More information about the Comp.unix.questions mailing list