home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / wizards / 3840 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.5 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!ira.uka.de!smurf.sub.org!news
  2. From: urlichs@smurf.sub.org (Matthias Urlichs)
  3. Newsgroups: comp.unix.wizards
  4. Subject: Re: A few UNIX questions
  5. Date: 8 Sep 1992 12:06:24 +0200
  6. Organization: University of Karlsruhe, FRG
  7. Lines: 32
  8. Message-ID: <18htv0INNj8u@smurf.smurf.sub.org>
  9. References: <32176@adm.brl.mil>
  10. NNTP-Posting-Host: 127.0.0.1
  11.  
  12. In comp.unix.wizards, article <32176@adm.brl.mil>,
  13.   mike@BRL.MIL ( Mike Muuss) writes:
  14. > From: Michael Panosh <mwp.michael@melpn1.prime.com> PrimeService, Australia
  15. > > Can *anyone* tell me why the file size is a signed integer.  Surely there
  16. > > is no need for negative sized files!!
  17. > Because lseek() needs to be able to return -1 on error, and not have it
  18. > look like a valid file offset.
  19.  
  20. Strictly speaking, that's an artifact of the way lseek() is implemented.
  21.  
  22. On many if not all  UNIXes, system calls are executed somewhat along these
  23. lines:
  24. - Get arguments from stack and put them into registers, if necessary
  25. - put the system call number in another register
  26. - _Trap
  27. - If a certain CPU condition code bit is [set/clear], then (Error)
  28.   - Move the return value (in a register) to errno
  29.   - set that register to -1
  30. - return
  31.  
  32. I don't really like that way of using system calls, but it's kind of too
  33. late to change it at this time.  :-/
  34.  
  35. -- 
  36. Wherever you go...There you are.
  37. - Buckaroo Banzai
  38. -- 
  39. Matthias Urlichs  --  urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de   /(o\
  40. Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- Germany  --  +49-721-9612521     \o)/
  41.