xref: /freebsd/contrib/ntp/include/ntp_select.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
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