lkml.org 
[lkml]   [2003]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQuestions on drivers returning POLLNVAL
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.039 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site