From: malware@t-online.de (Michael Mueller)
To: linux-kernel@vger.kernel.org, glibc-sc@gnu.org
Subject: [2.4] Inconsistency in poll(2)
Date: Wed, 16 Jul 2003 12:35:55 +0200 [thread overview]
Message-ID: <200307161032.MAA09922@fire.malware.de> (raw)
Hi readers of linux-kernel and glibc maintainers,
while hacking on a network application I found following oddity:
poll(pds,nfds,timeout) called with one of the file descriptors listed in
pds being invalid always does return nfds.
Output of appended sample code:
poll returned 2
revent[0]: 0
revent[1]: 32
According to IEEE Std 1003.1, 2003 Edition, the return value should have
been 1 in the above sample.
The kernel is 2.4.20 (debian 2.4.20-3-686). After a short look at the
code for sys_poll I am certain the problem is originated within the
kernel.
Any suggestions which actions to take?
Michael
Simple sample code demonstrating the problem:
#include <stdio.h>
#include <sys/poll.h>
struct pollfd fds[] = {
{ 0, POLLIN, 0 },
{ 110, POLLIN, 0}
};
int main(void)
{
int r = poll(fds, sizeof fds / sizeof fds[0], -1);
if ( r < 0 )
perror("poll");
else
printf("poll returned %d\n");
for ( r=0; r < sizeof fds / sizeof fds[0]; r++ )
printf("revent[%d]: %hd\n", r, fds[r].revents);
return 0;
}
--
Linux@TekXpress
http://www-users.rwth-aachen.de/Michael.Mueller4/tekxp/tekxp.html
next reply other threads:[~2003-07-16 10:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-16 10:35 Michael Mueller [this message]
2003-07-16 12:07 ` [2.4] Inconsistency in poll(2) Michael Mueller
2003-07-18 17:13 ` James Antill
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=200307161032.MAA09922@fire.malware.de \
--to=malware@t-online.de \
--cc=glibc-sc@gnu.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