1
0

select.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __SELECT_H
  10. #define __SELECT_H
  11. #ifndef _BSD_EXTENSION
  12. This header file is an extension to ANSI/POSIX
  13. #endif
  14. #pragma lib "/$M/lib/ape/libap.a"
  15. #ifndef _FD_SET_T
  16. #define _FD_SET_T
  17. /* BSD select, and adjunct types and macros */
  18. /* assume 96 fds is sufficient for fdset size */
  19. typedef struct fd_set {
  20. int32_t fds_bits[3];
  21. } fd_set;
  22. #define FD_SET(n,p) ((p)->fds_bits[(n)>>5] |= (1 << ((n) &0x1f)))
  23. #define FD_CLR(n,p) ((p)->fds_bits[(n)>>5] &= ~(1 << ((n) &0x1f)))
  24. #define FD_ISSET(n,p) ((p)->fds_bits[(n)>>5] & (1 << ((n) &0x1f)))
  25. #define FD_ZERO(p) ((p)->fds_bits[0] =0, (p)->fds_bits[1] =0, (p)->fds_bits[2] =0)
  26. #endif
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. extern int select(int, fd_set*, fd_set*, fd_set*, struct timeval *);
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif