home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixlib_1 / !UnixLib37_netlib_clib_sys_h_select < prev    next >
Encoding:
Text File  |  1996-07-28  |  1.1 KB  |  49 lines

  1. #ifndef __sys_select_h
  2. #define __sys_select_h
  3.  
  4. /* Freenet programmers interface - sys/select.h - 23/5/95 */
  5.  
  6. #include <sys/time.h>
  7.  
  8. /*
  9.  * Size of a file descriptor set (must be greater than the
  10.  * maximum number of file descriptors available)
  11.  */
  12. #define FD_SETSIZE 256
  13.  
  14. /*
  15.  * Macros for manipulating bitmasks
  16.  */
  17. typedef long          fd_mask;
  18. #define NFDBITS       (sizeof(fd_mask) * 8)
  19. #define howmany(x, y) (((x)+((y)-1))/(y))
  20.  
  21. /*
  22.  * A file descriptor set
  23.  */
  24. /*
  25. typedef struct fd_set {
  26.   fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  27. } fd_set;
  28. */
  29.  
  30. /*
  31.  * Macros used by users to manipulate descriptor sets
  32.  */
  33. /*
  34.  define FD_SET(n, p)   \
  35.   ((p)->fds_bits[(n)/NFDBITS] |= (1UL << (long)((n) % (long)NFDBITS)))
  36.  define FD_CLR(n, p)   \
  37.   ((p)->fds_bits[(n)/NFDBITS] &= ~(long)(1UL << ((n) % (long)NFDBITS)))
  38.  define FD_ISSET(n, p) \
  39.   ((p)->fds_bits[(n)/NFDBITS] & (long)(1UL << ((n) % (long)NFDBITS)))
  40.  define FD_ZERO(p)     (void)memset(p, 0, sizeof(*(p)))
  41. */
  42. /*
  43.  * The select() routine
  44.  */
  45. extern int select(int /*nfds*/, fd_set */*readfds*/, fd_set */*writefds*/,
  46.                   fd_set */*exceptfds*/, struct timeval */*timeout*/);
  47.  
  48. #endif
  49.