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!!) Message-ID: <19971120090611.FW37911@uriah.heep.sax.de> In-Reply-To: <Pine.BSF.3.96.971118192251.175A-100000@trojanhorse.ml.org>; from Jamil J. Weatherbee on Nov 18, 1997 19:28:41 -0800 References: <Pine.BSF.3.96.971118192251.175A-100000@trojanhorse.ml.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971120090611.FW37911>