home *** CD-ROM | disk | FTP | other *** search
- #ifndef __sys_select_h
- #define __sys_select_h
-
- /* Freenet programmers interface - sys/select.h - 23/5/95 */
-
- #include "Internet:sys.h.time"
-
- /*
- * Size of a file descriptor set (must be greater than the
- * maximum number of file descriptors available)
- */
- #define FD_SETSIZE 256
-
- /*
- * Macros for manipulating bitmasks
- */
- typedef long fd_mask;
- #define NFDBITS (sizeof(fd_mask) * 8)
- #define howmany(x, y) (((x)+((y)-1))/(y))
-
- /*
- * A file descriptor set
- */
- typedef struct fd_set {
- fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
- } fd_set;
-
- /*
- * Macros used by users to manipulate descriptor sets
- */
- #define FD_SET(n, p) \
- ((p)->fds_bits[(n)/NFDBITS] |= (1UL << (long)((n) % (long)NFDBITS)))
- #define FD_CLR(n, p) \
- ((p)->fds_bits[(n)/NFDBITS] &= ~(long)(1UL << ((n) % (long)NFDBITS)))
- #define FD_ISSET(n, p) \
- ((p)->fds_bits[(n)/NFDBITS] & (long)(1UL << ((n) % (long)NFDBITS)))
- #define FD_ZERO(p) (void)memset(p, 0, sizeof(*(p)))
-
- /*
- * The select() routine
- */
- extern int select(int /*nfds*/, fd_set */*readfds*/, fd_set */*writefds*/,
- fd_set */*exceptfds*/, struct timeval */*timeout*/);
-
- #endif
-