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