home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / linux / 22681 < prev    next >
Encoding:
Text File  |  1993-01-04  |  1.6 KB  |  33 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!unislc!erc
  3. From: erc@unislc.uucp (Ed Carp)
  4. Subject: Re: non-blocking read(): return vaules?
  5. X-Newsreader: TIN [version 1.1 PL6]
  6. References: <1993Jan4.103822.13815@klaava.Helsinki.FI>
  7. Message-ID: <1993Jan4.202558.16223@unislc.uucp>
  8. Organization: Unisys Corporation SLC
  9. Date: Mon, 4 Jan 1993 20:25:58 GMT
  10. Lines: 21
  11.  
  12. Linus Torvalds (torvalds@klaava.Helsinki.FI) wrote:
  13.  
  14. : As per posix, linux returns -1 and sets errno to be EAGAIN.  Originally,
  15. : linux had separate EAGAIN and EWOULDBLOCK, but to simplify porting of
  16. : bsd software (especially networking code), EWOULDBLOCK is now defined to
  17. : be the same as EAGAIN, so if you recompile any bsd sources with the new
  18. : header files, the posix behaviour actually looks like BSD ("new header
  19. : files" means that you have to have a new version of linux (0.99+) and
  20. : have the headers correctly symlinked)
  21.  
  22. The problem with this is, if you have SVR3 code lying around (which is the majority of my source code), you have to check the return value from the read AND
  23. errno.  If errno == EAGAIN, retry the read (possibly sleeping or doing a
  24. select() so you don't lock the processor into a hard loop).
  25.  
  26. What is the most efficient way of doing this?  I've been bitten by this one
  27. several times.  cu also had this bug until I worked up a patch for it, too.
  28. -- 
  29. Ed Carp            erc@apple.com, erc@saturn.upl.com    801/538-0177
  30. 1935 will go down in history.  For the first time, a civilized nation has
  31. full gun registration.  Our streets will be safer, our police more efficient,
  32. and the world will follow our lead into the future.  --Adolf Hitler
  33.