From owner-freebsd-hackers Tue Feb 13 01:33:40 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id BAA25512 for hackers-outgoing; Tue, 13 Feb 1996 01:33:40 -0800 (PST) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id BAA25502 for ; Tue, 13 Feb 1996 01:33:35 -0800 (PST) Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id UAA10882; Tue, 13 Feb 1996 20:04:55 +1030 From: Michael Smith Message-Id: <199602130934.UAA10882@genesis.atrad.adelaide.edu.au> Subject: Re: device driver ioctl for nonblocking IO? To: bde@zeta.org.au (Bruce Evans) Date: Tue, 13 Feb 1996 20:04:54 +1030 (CST) Cc: msmith@atrad.adelaide.edu.au, hackers@FreeBSD.org In-Reply-To: <199602130909.UAA19799@godzilla.zeta.org.au> from "Bruce Evans" at Feb 13, 96 08:09:43 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org Precedence: bulk Bruce Evans stands accused of saying: > >> If I open an fd on the device and fcntl(fd, F_SETFL, O_NONBLOCK), I get > >> a mystery ioctl sent to my device. > > >Argh. FIONBIO. Not enough coffee. Sorry. > > FIONBIO should be ignored unless you want to handle the races that can > result when a process changes the flag while another process is blocked > in an i/o. The O_NONBLOCK flag (aka the O_NDELAY flag) (aka the FNDELAY I'm only allowing one open (no more make any sense), so that's not a problem. > flag) is better aka the FNONBLOCK flag in the kernel. It is stored in > the file descriptor flags and passed to all read and write functions > after converting it to the IO_NDELAY. It is also passed to the open, > ioctl and close functions without conversion. That makes it much easier than keeping state in the unit structure; thanks. > Bruce -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "I seek PEZ!" - The Tick [[