From owner-freebsd-hackers Fri Nov 15 09:21:21 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA00941 for hackers-outgoing; Fri, 15 Nov 1996 09:21:21 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id JAA00935 for ; Fri, 15 Nov 1996 09:21:13 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id KAA26239; Fri, 15 Nov 1996 10:06:55 -0700 From: Terry Lambert Message-Id: <199611151706.KAA26239@phaeton.artisoft.com> Subject: Re: Sockets question... To: jdp@polstra.com (John Polstra) Date: Fri, 15 Nov 1996 10:06:54 -0700 (MST) Cc: terry@lambert.org, scrappy@ki.net, jgreco@brasil.moneng.mei.com, hackers@FreeBSD.ORG In-Reply-To: <199611150127.RAA11283@austin.polstra.com> from "John Polstra" at Nov 14, 96 05:27:43 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > If you don't use non-blocking I/O, the read will block until the > > buffer is full. Use blocking I/O, and you won't have the problem > > with the reader returning before it should (or shouldn't). > > This is most certainly not guaranteed by the documentation. From > read(2): > > The system guarantees to read the number of bytes requested > if the descriptor references a normal file that has that many > bytes left before the end-of-file, but in no other case. Then what use is the thing? How do I read into a structure on a machine that demands aligned data access? Specifically, if it's allowed to read 3 bytes of an integer value, and you are suppossed to reissue a read for the third byte (this I find hard to believe!), how do you access this data area atomically? No, I understand that the implementation *allows* this type of behavior for non-blocking I/O, and device I/O on non-blocking devices (like the bit-set mouse device), and for tty devices where the read count exceeds the vmin for more than vtime, but nothing would work at all if you couldn't issue a read for n bytes that didn't complete until you *got* n bytes. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.