* "Poll" system call broken?
@ 1998-08-04 2:05 brinkmann
1998-08-05 7:37 ` Kurt Garloff
1998-08-06 15:22 ` Erik Troan
0 siblings, 2 replies; 3+ messages in thread
From: brinkmann @ 1998-08-04 2:05 UTC (permalink / raw)
To: axp-list; +Cc: jb
I've been experimenting with the "poll" system call using the appended
test program. It works well on our Solaris machines, but fails with an
"Operation not permitted" error on my Alpha running RH Linux 5.0, both
using stdin and file pointers. The RH errata makes no mention of any
problems. Can anyone be of assistance?
Jon
---
Dr. Jon Brinkmann Apache Point Observatory
Instrument Scientist 2001 Apache Point Road
Internet: brinkmann@nmsu.edu P.O. Box 59
URL: http://www.apo.nmsu.edu/brinkmann/ Sunspot, NM 88349-0059
-------------------8<--------------CUT HERE----------------8<-------------------
#include <stdio.h>
#include <poll.h>
main()
{
struct pollfd fds[1];
int n;
char buffer[BUFSIZ];
/*
FILE *fp;
if (NULL == (fp = fopen ("poll_test.tmp", "rw"))) {
perror ("fopen");
}
fds[0].fd = fileno (fp);
*/
fds[0].fd = fileno (stdin);
fds[0].events = POLLIN;
while (1) {
sleep (1);
n = poll (fds, (unsigned long int) 1, 2000);
if (-1 == n) perror ("poll");
printf ("%d events = %X\trevents = %X\n",
n, fds[0].events, fds[0].revents);
if (POLLIN == fds[0].revents) {
printf ("Found input event\n");
fgets (buffer, BUFSIZ, stdin);
}
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "Poll" system call broken?
1998-08-04 2:05 "Poll" system call broken? brinkmann
@ 1998-08-05 7:37 ` Kurt Garloff
1998-08-06 15:22 ` Erik Troan
1 sibling, 0 replies; 3+ messages in thread
From: Kurt Garloff @ 1998-08-05 7:37 UTC (permalink / raw)
To: axp-list; +Cc: jb
On Mon, Aug 03, 1998 at 08:05:24PM -0600, brinkmann@nmsu.edu wrote:
> I've been experimenting with the "poll" system call using the appended
> test program. It works well on our Solaris machines, but fails with an
> "Operation not permitted" error on my Alpha running RH Linux 5.0, both
> using stdin and file pointers. The RH errata makes no mention of any
> problems. Can anyone be of assistance?
Well, I don't know anything about poll().
I remember though there being a discussion about select() and poll() system
calls in the kernel list. From what I remember, poll() is emulated by
select() in 2.0.xx kernels, which cannot be done properly. In 2.1.x this
changed: select() now is emulated by poll() which can be done properly.
So, IIRC, switching to 2.1.x kernels could help you. Better check the
linux-kernel archives yourself ...
Hope, I could give you a little assistance.
--
Kurt Garloff, Dortmund
<K.Garloff@ping.de>
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "Poll" system call broken?
1998-08-04 2:05 "Poll" system call broken? brinkmann
1998-08-05 7:37 ` Kurt Garloff
@ 1998-08-06 15:22 ` Erik Troan
1 sibling, 0 replies; 3+ messages in thread
From: Erik Troan @ 1998-08-06 15:22 UTC (permalink / raw)
To: axp-list
On Mon, 3 Aug 1998 20:05:24 brinkmann@nmsu.edu <brinkmann@nmsu.edu> wrote:
>I've been experimenting with the "poll" system call using the appended
>test program. It works well on our Solaris machines, but fails with an
>"Operation not permitted" error on my Alpha running RH Linux 5.0, both
>using stdin and file pointers. The RH errata makes no mention of any
>problems. Can anyone be of assistance?
You need the latest glibc package from the 5.1 errata, and get the
kernel-source package from the 5.1 errata as well. Rebuild your kernel,
reboot, and you should be fine.
You need a new kernel because all 2.0.x kernels on the alpha return the
wrong error code for an unimplemented system call. glibc needs to see
ENOSYS to do proper emulation, so the kernel must be fixed. You may not
actually need the new glibc for poll() to work, but hey, why not?
These fixes let poll() work fine for xntpd, fwiw.
Erik
-------------------------------------------------------------------------------
| "For the next two hours, VH1 will be filled with foul-mouthed, |
| crossdressing Australians. Viewer discretion is advised." |
| |
| Linux Application Development -- http://www.redhat.com/~johnsonm/lad |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-08-06 15:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-08-04 2:05 "Poll" system call broken? brinkmann
1998-08-05 7:37 ` Kurt Garloff
1998-08-06 15:22 ` Erik Troan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox