home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards
- Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!merlin.dev.cdx.mot.com!lezz
- From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
- Subject: Re: A few UNIX questions
- Message-ID: <1992Aug28.232720.5343@merlin.dev.cdx.mot.com>
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: fenric.dev.cdx.mot.com
- Reply-To: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
- Organization: Motorola Codex, Canton, MA
- References: <32176@adm.brl.mil> <1992Aug26.081414.6932@sniap.mchp.sni.de> <1992Aug27.162220.16130@krfiny.uucp>
- Date: Fri, 28 Aug 1992 23:27:20 GMT
- Lines: 29
-
- In article <1992Aug27.162220.16130@krfiny.uucp>, jeffj@krfiny.uucp (J. Jonas) writes:
- |>>mike@BRL.MIL ( Mike Muuss) writes:
- |>>:
- |>>: From: Michael Panosh <mwp.michael@melpn1.prime.com> PrimeService, Australia
- |>>:
- |>>: > Can *anyone* tell me why the file size is a signed integer. Surely there
- |>>: > is no need for negative sized files!!
- |>>:
- |>>: Because lseek() needs to be able to return -1 on error, and not have it
- |>>: look like a valid file offset.
- |>
- |>>Umm, and a *signed* file size helps, does it?
- |>
- |>The external type used for file size (as used for system calls)
- |>and the internal one used in the on-disk inode don't have to be the same.
- |>
- |>I agree that the type used for the return value for lseek()
- |>needs to be signed so that errors can be returned
- |>(0 and >0 are valid values).
-
- But what happens if the file is more than 0x0FFF FFFF bytes long?
- Any unsigned 32-bit number larger than this cannot be represented
- as a signed 32-bit number - therefore in order to be able to show
- error conditions you either need to change the type returned by
- lseek to something like a 64-bit value, or have an extra parameter
- that says whether the offset is valid, or make sure that the
- offset can always be represented in an signed 32-bit number.
-
- Lezz
-