home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / poll.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.6 KB  |  89 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_POLL_H
  11. #define _SYS_POLL_H
  12.  
  13. #ident    "@(#)/usr/include/sys/poll.h.sl 1.1 4.0 12/08/90 39641 AT&T-USL"
  14.  
  15. /*
  16.  * Structure of file descriptor/event pairs supplied in
  17.  * the poll arrays.
  18.  */
  19. struct pollfd {
  20.     int fd;                /* file desc to poll */
  21.     short events;            /* events of interest on fd */
  22.     short revents;            /* events that occurred on fd */
  23. };
  24.  
  25. /*
  26.  * Testable select events 
  27.  */
  28. #define POLLIN        0x0001        /* fd is readable */
  29. #define POLLPRI        0x0002        /* high priority info at fd */
  30. #define    POLLOUT        0x0004        /* fd is writeable (won't block) */
  31. #define POLLRDNORM    0x0040        /* normal data is readable */
  32. #define POLLWRNORM    POLLOUT
  33. #define POLLRDBAND    0x0080        /* out-of-band data is readable */
  34. #define POLLWRBAND    0x0100        /* out-of-band data is writeable */
  35.  
  36. #define POLLNORM    POLLRDNORM
  37.  
  38. /*
  39.  * Non-testable poll events (may not be specified in events field,
  40.  * but may be returned in revents field).
  41.  */
  42. #define POLLERR        0x0008        /* fd has error condition */
  43. #define POLLHUP        0x0010        /* fd has been hung up on */
  44. #define POLLNVAL    0x0020        /* invalid pollfd entry */
  45.  
  46. /*
  47.  * Poll list head structure.  A pointer to this is passed
  48.  * to pollwakeup() from the caller indicating the event has
  49.  * occurred.  NOTE: First two pointers correspond to first
  50.  * two elements in polldat structure.
  51.  */
  52. struct pollhead {
  53.     struct polldat    *ph_list;    /* list of pollers */
  54.     struct polldat    *ph_dummy;    /* dummy pointer */
  55.     short        ph_events;    /* events pending on list */
  56.     long        ph_filler[5];    /* reserved for future use */
  57. };
  58.  
  59. /*
  60.  * Data necessary to notify process sleeping in poll(2)
  61.  * when an event has occurred.
  62.  */
  63. struct polldat {
  64.     struct polldat *pd_next;    /* next in poll list */
  65.     struct polldat *pd_prev;    /* previous in poll list */
  66.     struct polldat *pd_chain;    /* other fds polled in same call */
  67.     short        pd_events;    /* events being polled */
  68.     struct pollhead *pd_headp;    /* backpointer to head of list */
  69.     void        (*pd_fn)();    /* function to call */
  70.     long        pd_arg;        /* argument to function */
  71. };
  72.  
  73. /*
  74.  * Routine called to notify a process of the occurrence
  75.  * of an event.
  76.  */
  77. extern void pollwakeup();
  78.  
  79. /*
  80.  * Internal routines.
  81.  */
  82. extern void polltime(), pollrun(), polladd(), polldel();
  83.  
  84. #if defined(__STDC__) && !defined(_KERNEL)
  85. int poll(struct pollfd *, unsigned long, int);
  86. #endif
  87.  
  88. #endif    /* _SYS_POLL_H */
  89.