Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bloom-beacon!think!ames!hc!beta!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: System V manuals (was Re: What real non-UNIX 'C' compilers...) Message-ID: <6517@brl-smoke.ARPA> Date: Sun, 4-Oct-87 01:21:28 EDT Article-I.D.: brl-smok.6517 Posted: Sun Oct 4 01:21:28 1987 Date-Received: Wed, 7-Oct-87 04:16:51 EDT References: <855@sugar.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 51 In article <855@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes: >The UNIX System User's Manual. >ISBN 0-13-938242-9 025 I use that for convenience (1 volume instead of 3), but it's horribly organized compared with the real UNIX System V manuals. Prentice-Hall is also publishing what amounts to the generically useful part of the SVR3.0 documentation set in softcover, but there have been reports of typesetting botches that weren't in the SVR3.0 manuals. Since they seem to have the same contents, I wonder how that happened. >I don't believe you could implement "read" as a library routine and retain the >attribute of leaving the file descriptor at the point last read, unless you >were to "implement" it by making a direct call to the existing read routine. >Certainly buffering would be out. Well, of COURSE buffering is out, because that's not what read() a la POSIX/SVID is supposed to do! Here's mine: /* read -- system call emulation for 4.2BSD last edit: 16-Jun-1983 D A Gwyn The only reason for this layer is to support O_NDELAY mode. */ #include extern int errno; extern int _read(); /* actual system call */ int read( fildes, buf, nbyte ) int fildes; char *buf; int nbyte; { register int serrno = errno; /* save errno */ register int nread; if ( (nread = _read( fildes, buf, nbyte )) >= 0 || errno != EWOULDBLOCK ) return nread; /* O_NDELAY set and read would block: */ errno = serrno; /* restore errno */ return 0; }