20 static int pollfds_num = 0;
21 static int pollfds_size = 0;
28 n =
poll(pollfds, pollfds_num, 0);
33 " poll returned %d, errno = %d\n", n,
errno);
42 for (i = 0; i < pollfds_num; i++) {
43 if (pollfds[i].revents != 0) {
47 irq_fd = irq_fd->
next;
54 if (pollfds_num == pollfds_size) {
55 if (size_tmpfds <= pollfds_size *
sizeof(pollfds[0])) {
57 return (pollfds_size + 1) *
sizeof(pollfds[0]);
60 if (pollfds !=
NULL) {
62 sizeof(pollfds[0]) * pollfds_size);
71 pollfds[pollfds_num] = ((
struct pollfd) { .fd =
fd,
80 struct irq_fd *active_fds,
struct irq_fd ***last_irq_ptr2)
86 while (*prev !=
NULL) {
87 if ((*
test)(*prev, arg)) {
89 if ((pollfds[i].
fd != -1) &&
90 (pollfds[i].
fd != (*prev)->fd)) {
92 "mismatch between active_fds and "
93 "pollfds, fd %d vs %d\n",
94 (*prev)->fd, pollfds[i].
fd);
104 memmove(&pollfds[i], &pollfds[i + 1],
105 (pollfds_num - i) *
sizeof(pollfds[0]));
106 if (*last_irq_ptr2 == &old_fd->
next)
107 *last_irq_ptr2 =
prev;
109 *prev = (*prev)->
next;
115 prev = &(*prev)->
next;
124 return pollfds[
i].
fd;