From owner-freebsd-hackers Thu Nov 20 00:21:31 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id AAA20282 for hackers-outgoing; Thu, 20 Nov 1997 00:21:31 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id AAA20269 for ; Thu, 20 Nov 1997 00:21:26 -0800 (PST) (envelope-from j@uriah.heep.sax.de) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id JAA06210 for hackers@freebsd.org; Thu, 20 Nov 1997 09:21:19 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.8.8/8.8.5) id JAA01342; Thu, 20 Nov 1997 09:06:11 +0100 (MET) Message-ID: <19971120090611.FW37911@uriah.heep.sax.de> Date: Thu, 20 Nov 1997 09:06:11 +0100 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@freebsd.org Subject: Re: vnode.h and IO_NDELAY (help!!) References: X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: ; from Jamil J. Weatherbee on Nov 18, 1997 19:28:41 -0800 Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk As Jamil J. Weatherbee wrote: > I can't find a single code fragment in any device driver that checks > ioflags in the read routine to see if IO_NDELAY is set. That's work-in-progress, but i know the non-delay stuff does what it's supposed to do: static int rtcread(dev_t dev, struct uio *uio, int flag) { int rv = 0; size_t amnt; if (flag & IO_NDELAY) { /* O_NONBLOCK requests to pull previous data if available */ if ((rtc_softc.sc_flags & RTC_UPDATED) == 0) rv = EWOULDBLOCK; } else { rv = tsleep((caddr_t)&rtc_softc, RTCPRI | PCATCH, "rtc", 0); if (rv == ERESTART) rv = EINTR; } if (rv == 0) { amnt = MIN(uio->uio_resid, RTC_DATALEN); rv = uiomove((caddr_t)&rtc_softc.sc_data, amnt, uio); } return rv; } Also, don't forget that you need to allow the FIONBIO ioctl command. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)