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

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds
  3. From: torvalds@klaava.Helsinki.FI (Linus Torvalds)
  4. Subject: Re: non-blocking read(): return vaules?
  5. Message-ID: <1993Jan4.103822.13815@klaava.Helsinki.FI>
  6. Organization: University of Helsinki
  7. References: <9301032305.aa08055@Bonnie.ics.uci.edu>
  8. Date: Mon, 4 Jan 1993 10:38:22 GMT
  9. Lines: 24
  10.  
  11. In article <9301032305.aa08055@Bonnie.ics.uci.edu> mlo@Bonnie.ICS.UCI.EDU (--) writes:
  12. >
  13. >Here's (roughly) something I read in "Advanced C Programming for
  14. >Displays" by Marc J. Rochkind:
  15. >
  16. >On System V, a non-blocking "read()", when no data is ready, returns
  17. >zero.  On BSD4 systems, "read()" returns -1 and sets errno to
  18. >EWOULDBLOCK.
  19. >
  20. >On Linux (System V, right?), it seems to be returning -1 (like BSD),
  21. >but without setting the errno as BSD does.
  22.  
  23. Linux is neither sysv nor bsd, but POSIX with some extensions from both
  24. worlds. 
  25.  
  26. As per posix, linux returns -1 and sets errno to be EAGAIN.  Originally,
  27. linux had separate EAGAIN and EWOULDBLOCK, but to simplify porting of
  28. bsd software (especially networking code), EWOULDBLOCK is now defined to
  29. be the same as EAGAIN, so if you recompile any bsd sources with the new
  30. header files, the posix behaviour actually looks like BSD ("new header
  31. files" means that you have to have a new version of linux (0.99+) and
  32. have the headers correctly symlinked)
  33.  
  34.         Linus
  35.