xref: /freebsd/contrib/ntp/include/ntp_select.h (revision 641a6cfb86023499caafe26a4d821a0b885cf00b)
1 /*
2  * Not all machines define FD_SET in sys/types.h
3  */
4 #ifndef _ntp_select_h
5 #define _ntp_select_h
6 
7 /* Was: (defined(RS6000)||defined(SYS_PTX))&&!defined(_BSD) */
8 /* Could say: !defined(FD_SET) && defined(HAVE_SYS_SELECT_H) */
9 #if defined(HAVE_SYS_SELECT_H) && !defined(_BSD)
10 #ifndef SYS_VXWORKS
11 #include <sys/select.h>
12 #else
13 #include <sockLib.h>
14 extern int  select P((int width, fd_set *pReadFds, fd_set *pWriteFds,
15             fd_set *pExceptFds, struct timeval *pTimeOut));
16 
17 #endif
18 #endif
19 
20 #if !defined(FD_SET) && !defined(SYS_WINNT)
21 #define NFDBITS         32
22 #define FD_SETSIZE      32
23 #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
24 #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
25 #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
26 #define FD_ZERO(p)      memset((char *)(p), 0, sizeof(*(p)))
27 #endif
28 
29 #if defined(VMS)
30 typedef struct {
31     unsigned int fds_bits[1];
32 } fd_set;
33 #endif
34 
35 #endif /* _ntp_select_h */
36