Xref: utzoo comp.unix.wizards:15504 comp.unix.questions:12794 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: unix question: files per directory Summary: why is off_t signed? Keywords: how many can there be? Message-ID: <8420@xanth.cs.odu.edu> Date: 11 Apr 89 23:12:40 GMT References: <24110@beta.lanl.gov> Followup-To: comp.unix.wizards Distribution: na Organization: Old Dominion University, Norfolk, Va. Lines: 34 In article <24110@beta.lanl.gov> dxxb@beta.lanl.gov (David W. Barts) writes: >How many files can there be in a single UNIX directory In article <16839@mimsy.UUCP> chris@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 or . Just curious, Lloyd Kremer Brooks Financial Systems {uunet,sun,...}!xanth!brooks!lloyd