From owner-freebsd-hackers Sat Dec 2 18:30:31 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id SAA08365 for hackers-outgoing; Sat, 2 Dec 1995 18:30:31 -0800 Received: from spooky.rwwa.com (rwwa.com [198.115.177.3]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id SAA08357 for ; Sat, 2 Dec 1995 18:30:24 -0800 Received: from localhost (localhost [127.0.0.1]) by spooky.rwwa.com (8.6.11/8.6.9) with SMTP id VAA11976 for ; Sat, 2 Dec 1995 21:36:33 -0500 Message-Id: <199512030236.VAA11976@spooky.rwwa.com> X-Authentication-Warning: spooky.rwwa.com: Host localhost didn't use HELO protocol X-Mailer: exmh version 1.5.3 12/28/94 To: freebsd-hackers@FreeBSD.ORG Subject: Proper way to determine non-blocking status... Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sat, 02 Dec 1995 21:36:30 -0500 From: Robert Withrow Sender: owner-hackers@FreeBSD.ORG Precedence: bulk Even though it seems like it is almost never done by existing driver code, would I be correct in assuming that the *right* way to determine if a device read is allowed to sleep or not is the following? int xxread(dev_t dev, struct uio *uio, int ioflag) { if (ioflag & IO_NDELAY) { /* Can't block here */ return EWOULDBLOCK; } else { /* Otherwise try again */ /* Can sleep here */ ... } } ----------------------------------------------------------------------------- Robert Withrow, Tel: +1 617 598 4480, Fax: +1 617 598 4430 Net: witr@rwwa.COM R.W. Withrow Associates, 319 Lynnway Suite 201, Lynn MA 01901 USA