Date: Mon, 9 Oct 2000 17:49:06 -0700 (PDT) From: Westley Weimer <weimer@EECS.Berkeley.EDU> Subject: Re: Linux device drivers: O_NONBLOCK in fops->open ... Message-ID: <Pine.SOL.4.10.10010091746150.6653-100000@york.CS.Berkeley.EDU> On Mon, 9 Oct 2000, Scott McPeak wrote: > > Here's the question: Is the driver writer allowed to put a process > > to sleep (= block) in the open method if the O_NONBLOCK flag is > > set? > I don't see why not, regardless of the flag's setting. You can put > the process to sleep whenever you want to, other caveats > notwithstanding (e.g. see below). The only issue is whether the > client software can deal with it, but since it presumably knows what > device it's talking to etc. it just has to understand that driver's > behavior. And lacking such understanding, blocking is safer than > returning -EAGAIN and hoping the client happens to check. This would make sense, except that the client code had to go *way out of its way* to get non-blocking behavior. It had to explicitly fcntl(...) the file descriptor that it got by opening the device. If the client does that, is it not the client's responsibility to check? > But one caveat on blocking write() -- there's a semaphore "down" just > before fops->write gets called, and a corresponding "up" on return Good to know, thanks! - Wes
This archive was generated by hypermail 2b30 : 11/04/02 PST