Date: Mon, 9 Oct 2000 14:20:18 -0700 (PDT) From: Westley Weimer <weimer@EECS.Berkeley.EDU> Subject: Linux device drivers: O_NONBLOCK in fops->open ... Message-ID: <Pine.SOL.4.10.10010091413080.3747-100000@york.CS.Berkeley.EDU> I have a question about O_NONBLOCK and the open() method that Rubini is a little fuzzy on. Here's a quote from page 110: As you may imagine from its name, O_NONBLOCK is meaningful also in the open method. This happens when the call can actually block for a long time; for example, when opening a FIFO that has no writers yet), or accessing a disk file with a pending lock. Usually, opening a device either succeeds or fails, without the need to wait for external events. Sometimes, however, opening the device requires a long initialization, and you may choose to check O_NONBLOCK, returning immediately with -EAGAIN (try it again) if the flag is set, after spawning device initialization. You might also decide to implement a blocking open ... Only the read, write and open file operations are affected by the nonblocking flag. 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? [ drivers/char/qpmouse.c in 2.2.15 is an example of a simple driver that does so. ] "You may choose" sounds quite weak. Does anyone have more information on this? - Wes
This archive was generated by hypermail 2b30 : 11/04/02 PST