xref: /dragonfly/test/testcases/io/poll_1/poll_1.c (revision f2c43266)
1 /*
2  * poll_1.c
3  *
4  * This code used to panic the kernel because of a filter bug.
5  */
6 #include <fcntl.h>
7 #include <stdio.h>
8 #include <poll.h>
9 
10 int main()
11 {
12 	struct pollfd fds[1];
13 
14 	int p = open("/dev/tty", O_RDWR);
15 
16 	printf("tty: %d\n", p);
17 
18 	fds[0].fd = p;
19 	fds[0].events = POLLIN|POLLPRI;
20 	fds[0].revents = 0;
21 
22 	poll(fds, 1, -1);
23 
24 	printf("polled\n");
25 }
26