[uClinux-dev] Two questions about drivers

Greg Ungerer gerg at snapgear.com
Thu Nov 29 00:00:14 EST 2001

Hi Joey,

JoeyShen wrote:
> I've already made my very simple device work. But there're still two problems puzzled me.
> One is that the "device_open( )" functions written in the device drivers have different parameters from the "open" system call. What is the magic between the registered driver functions and system calls?

Follow the flow of execution from the open system call 
entry point in ~/linux/fs/open.c, function is sys_open().

> The second is what will happen if I use interruptible_sleep_on( ) in my read function of the device driver and then I open the device with the parameter "O_NONBLOCK"(in the case of select( ) use). Will the device go to sleep?

Yes. It is up to the driver code to honor the O_NONBLOCK flag.
(And you don't need this flag to use select(). The idea is that
you select until you can read, and thus the read will not block
when you do call it).


Greg Ungerer  --  Chief Software Wizard        EMAIL:  gerg at snapgear.com
SnapGear                                       PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.snapgear.com
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/

More information about the uClinux-dev mailing list