public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Questions on drivers returning POLLNVAL
@ 2003-10-28 10:18 Balbir Singh
  0 siblings, 0 replies; only message in thread
From: Balbir Singh @ 2003-10-28 10:18 UTC (permalink / raw)
  To: Linux Kernel List

Hello, All,

I seem to be problems with select() when I return POLLNVAL
from the poll() entry point of my driver.

For more context, I am attaching the following snippet of code
from fs/select.c (do_select). I am looking at 2.4.22

                        if (file) {
                                mask = DEFAULT_POLLMASK;
                                if (file->f_op && file->f_op->poll)
                                        mask = file->f_op->poll(file, wait);
                                fput(file);
                        }
                        if ((mask & POLLIN_SET) && ISSET(bit, 
__IN(fds,off))) {
                                SET(bit, __RES_IN(fds,off));
                                retval++;
                                wait = NULL;
                        }
                        if ((mask & POLLOUT_SET) && ISSET(bit, 
__OUT(fds,off)))
{
                                SET(bit, __RES_OUT(fds,off));
                                retval++;
                                wait = NULL;
                        }
                        if ((mask & POLLEX_SET) && ISSET(bit, 
__EX(fds,off))) {
                                SET(bit, __RES_EX(fds,off));
                                retval++;
                                wait = NULL;
                        }
                }
                wait = NULL;
                if (retval || !__timeout || signal_pending(current))
                        break;
                if(table.error) {
                        retval = table.error;
                        break;
                }
                __timeout = schedule_timeout(__timeout);


When I return POLLNVAL from my driver, the user set the select timeout set
to NULL, I get caught up in schedule_timeout.

when I pass NULL for timeout from userland, in the kernel, I
see __timeout  set to 2147483647. I have not investigated this yet.
Hence I fail the two checks for breaking out of the loop and
get stuck in schedule_timeout.

Am I expected to set POLLNVAL in table->error passed to the poll()
entry point explicitly?

Thanks,
Balbir


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-10-28 10:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-28 10:18 Questions on drivers returning POLLNVAL Balbir Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox