public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Balbir Singh <balbir_soni@yahoo.com>
To: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Questions on drivers returning POLLNVAL
Date: Tue, 28 Oct 2003 15:48:29 +0530	[thread overview]
Message-ID: <3F9E4275.9070201@yahoo.com> (raw)

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


                 reply	other threads:[~2003-10-28 10:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F9E4275.9070201@yahoo.com \
    --to=balbir_soni@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox