8 #include <linux/wait.h>
9 #include <linux/string.h>
11 #include <asm/uaccess.h>
13 struct poll_table_page;
15 typedef struct poll_table_struct {
17 struct poll_table_page * table;
20 extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
22 static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
24 if (p && wait_address)
25 __pollwait(filp, wait_address, p);
28 static inline void poll_initwait(poll_table* pt)
33 extern void poll_freewait(poll_table* pt);
37 * Scaleable version of the fd_set.
41 unsigned long *in, *out, *ex;
42 unsigned long *res_in, *res_out, *res_ex;
46 * How many longwords for "nr" bits?
48 #define FDS_BITPERLONG (8*sizeof(long))
49 #define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
50 #define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
53 * We do a VERIFY_WRITE here even though we are only reading this time:
54 * we'll write to it eventually..
56 * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
59 int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset)
64 error = verify_area(VERIFY_WRITE, ufdset, nr);
65 if (!error && __copy_from_user(fdset, ufdset, nr))
74 void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset)
77 __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
81 void zero_fd_set(unsigned long nr, unsigned long *fdset)
83 memset(fdset, 0, FDS_BYTES(nr));
86 extern int do_select(int n, fd_set_bits *fds, long *timeout);
90 #endif /* _LINUX_POLL_H */