Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: brinkmann@nmsu.edu
To: axp-list@redhat.com
Cc: jb@galileo.apo.nmsu.edu
Subject: "Poll" system call broken?
Date: Mon, 3 Aug 1998 20:05:24 -0600 (MDT)	[thread overview]
Message-ID: <199808040205.UAA19423@galileo.apo.nmsu.edu> (raw)

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);
		}
	}
}


             reply	other threads:[~1998-08-04  2:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-04  2:05 brinkmann [this message]
1998-08-05  7:37 ` "Poll" system call broken? Kurt Garloff
1998-08-06 15:22 ` Erik Troan
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox