~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/poll.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LINUX_POLL_H
  2 #define _LINUX_POLL_H
  3 
  4 #include <asm/poll.h>
  5 
  6 #ifdef __KERNEL__
  7 
  8 #include <linux/wait.h>
  9 #include <linux/string.h>
 10 #include <linux/mm.h>
 11 #include <asm/uaccess.h>
 12 
 13 struct poll_table_page;
 14 
 15 typedef struct poll_table_struct {
 16         int error;
 17         struct poll_table_page * table;
 18 } poll_table;
 19 
 20 extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
 21 
 22 extern inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
 23 {
 24         if (p && wait_address)
 25                 __pollwait(filp, wait_address, p);
 26 }
 27 
 28 static inline void poll_initwait(poll_table* pt)
 29 {
 30         pt->error = 0;
 31         pt->table = NULL;
 32 }
 33 extern void poll_freewait(poll_table* pt);
 34 
 35 
 36 /*
 37  * Scaleable version of the fd_set.
 38  */
 39 
 40 typedef struct {
 41         unsigned long *in, *out, *ex;
 42         unsigned long *res_in, *res_out, *res_ex;
 43 } fd_set_bits;
 44 
 45 /*
 46  * How many longwords for "nr" bits?
 47  */
 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))
 51 
 52 /*
 53  * We do a VERIFY_WRITE here even though we are only reading this time:
 54  * we'll write to it eventually..
 55  *
 56  * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
 57  */
 58 static inline
 59 int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset)
 60 {
 61         nr = FDS_BYTES(nr);
 62         if (ufdset) {
 63                 int error;
 64                 error = verify_area(VERIFY_WRITE, ufdset, nr);
 65                 if (!error && __copy_from_user(fdset, ufdset, nr))
 66                         error = -EFAULT;
 67                 return error;
 68         }
 69         memset(fdset, 0, nr);
 70         return 0;
 71 }
 72 
 73 static inline
 74 void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset)
 75 {
 76         if (ufdset)
 77                 __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
 78 }
 79 
 80 static inline
 81 void zero_fd_set(unsigned long nr, unsigned long *fdset)
 82 {
 83         memset(fdset, 0, FDS_BYTES(nr));
 84 }
 85 
 86 extern int do_select(int n, fd_set_bits *fds, long *timeout);
 87 
 88 #endif /* KERNEL */
 89 
 90 #endif /* _LINUX_POLL_H */
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.