using select() on /proc filesystem entries

Alex White awhite at
Thu Nov 22 07:24:33 UTC 2007


(I hope this is a reasonable place to ask this question. I was going to  
post to lkml, but it didn't seem quite appropriate)

I've written a kernel module that provides some custom I/O between an  
external peripheral and a linux userspace application.

I've used the /proc interface to allow the application in userspace to  
talk to the kernel module.

In the process of improving the efficiency of the user application, I've  
found that using select() on the /proc filesystem entry always indicates  
that there is data available, yet calling read() returns nothing  
(nonblocking), in the case when there is no data available.

Has anyone come across this before?

I've implemented the /proc interface on the module side using the  
following calls:


proc_entry = create_proc_entry(...)

proc_entry->read_proc = my_proc_read;
proc_entry->write_proc = my_proc_write;
proc_entry->owner = THIS_MODULE;


It works fine for reading and writing, but I'm trying to avoid using  
polling in the interface between the kernel module and the userspace  

I'm using the debian sarge 2.4 kernel.

Any tips would be greatly appreciated!


More information about the devel mailing list