mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: linux-kernel@vger.kernel.org
Subject: RE: do_select() improvement ...
Date: Thu, 21 Jun 2001 14:23:52 -0700 (PDT)	[thread overview]
Message-ID: <XFMail.20010621142352.davidel@xmailserver.org> (raw)
In-Reply-To: <XFMail.20010621123002.davidel@xmailserver.org>

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]


On 21-Jun-2001 Davide Libenzi wrote:
>                         off = i / __NFDBITS;
> !                       if (!(i & (__NFDBITS - 1))) {
> !                               bits = BITS(fds, off);
> !                               if (!bits) {
> !                                       i += __NFDBITS;
> !                                       continue;
> !                               }


This is wrong.



>                         off = i / __NFDBITS;
> !                       if (!(i & (__NFDBITS - 1))) {
> !                               bits = BITS(fds, off);
> !                               if (!bits) {
> !                                       i += __NFDBITS - 1;
> !                                       continue;
> !                               }

This is right.





- Davide


[-- Attachment #2: select.c.diff --]
[-- Type: application/octet-stream, Size: 597 bytes --]

--- select.orig.c	Thu Jun 21 08:52:04 2001
+++ select.c	Thu Jun 21 12:09:25 2001
@@ -165,6 +165,7 @@
 	poll_table table, *wait;
 	int retval, i, off;
 	long __timeout = *timeout;
+	unsigned long bits;
 
  	read_lock(&current->files->file_lock);
 	retval = max_select_fd(n, fds);
@@ -187,7 +188,14 @@
 			struct file *file;
 
 			off = i / __NFDBITS;
-			if (!(bit & BITS(fds, off)))
+			if (!(i & (__NFDBITS - 1))) {
+				bits = BITS(fds, off);
+				if (!bits) {
+					i += __NFDBITS - 1;
+					continue;
+				}
+			}
+			if (!(bit & bits))
 				continue;
 			file = fget(i);
 			mask = POLLNVAL;

      reply	other threads:[~2001-06-21 21:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-21 19:30 Davide Libenzi
2001-06-21 21:23 ` Davide Libenzi [this message]

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=XFMail.20010621142352.davidel@xmailserver.org \
    --to=davidel@xmailserver.org \
    --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

all inboxes | Powered by JetHome®