1 #ifndef _POLL_H 2 #define _POLL_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include <features.h> 9 10 #include <bits/poll.h> 11 12 #define POLLIN 0x001 13 #define POLLPRI 0x002 14 #define POLLOUT 0x004 15 #define POLLERR 0x008 16 #define POLLHUP 0x010 17 #define POLLNVAL 0x020 18 #define POLLRDNORM 0x040 19 #define POLLRDBAND 0x080 20 #ifndef POLLWRNORM 21 #define POLLWRNORM 0x100 22 #define POLLWRBAND 0x200 23 #endif 24 #ifndef POLLMSG 25 #define POLLMSG 0x400 26 #define POLLRDHUP 0x2000 27 #endif 28 29 #define MAX_POLL_NFDS 0x1000 30 31 typedef unsigned int pollevent_t; 32 33 typedef unsigned long nfds_t; 34 35 struct pollfd { 36 int fd; 37 short events; 38 short revents; 39 }; 40 41 int poll (struct pollfd *, nfds_t, int); 42 43 #ifdef _GNU_SOURCE 44 #define __NEED_time_t 45 #define __NEED_struct_timespec 46 #define __NEED_sigset_t 47 #include <bits/alltypes.h> 48 int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *); 49 #endif 50 51 #include "semaphore.h" 52 #include "linux/wait.h" 53 54 struct tag_poll_wait_entry; 55 56 typedef struct tag_poll_wait_entry* poll_wait_head; 57 58 typedef struct tag_poll_table { 59 poll_wait_head wait; 60 pollevent_t key; 61 } poll_table; 62 63 extern void notify_poll(wait_queue_head_t* wait_address); 64 extern void notify_poll_with_key(wait_queue_head_t* wait_address, pollevent_t key); 65 66 #if _REDIR_TIME64 67 #ifdef _GNU_SOURCE 68 __REDIR(ppoll, __ppoll_time64); 69 #endif 70 #endif 71 72 #ifdef __cplusplus 73 } 74 #endif 75 76 #endif 77