home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / wizards / 3734 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.8 KB  |  43 lines

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