LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Question on select behaviour (https://www.linuxquestions.org/questions/programming-9/question-on-select-behaviour-478384/)

exman 08-29-2006 06:20 AM

Question on select behaviour
 
Hi,
I have some specific hardware here and the driver does not seem to support select calls on the filedescriptor as far as I can see (driver does not contain poll()).
Now if I try to use the descriptor in a select call, it returns without changing the fd_sets but also returns no error.
Is that how it is intended to behave?
Any advise would be appreciated.

exman

exman 08-30-2006 12:13 PM

Ok I found the answer myself.
http://lwn.net/images/pdf/LDD3/ch03.pdf page 10

Quote:

unsigned int (*poll) (struct file *, struct poll_table_struct *);
The poll method is the back end of three system calls: poll, epoll, and select, all of
which are used to query whether a read or write to one or more file descriptors
would block. The poll method should return a bit mask indicating whether non-
blocking reads or writes are possible, and, possibly, provide the kernel with
information that can be used to put the calling process to sleep until I/O
becomes possible. If a driver leaves its poll method NULL, the device is assumed to
be both readable and writable without blocking.
So it seems that the behaviour of select is correct.
exman


All times are GMT -5. The time now is 08:13 PM.