Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / include / ntp_select.h
blob7d86b5db6628b174ac1180ba8210093e2fafd76f
1 /* $NetBSD$ */
3 /*
4 * Not all machines define FD_SET in sys/types.h
5 */
6 #ifndef NTP_SELECT_H
7 #define NTP_SELECT_H
9 /* Was: (defined(RS6000)||defined(SYS_PTX))&&!defined(_BSD) */
10 /* Could say: !defined(FD_SET) && defined(HAVE_SYS_SELECT_H) */
11 #if defined(HAVE_SYS_SELECT_H) && !defined(_BSD)
12 #ifndef SYS_VXWORKS
13 #include <sys/select.h>
14 #else
15 #include <sockLib.h>
16 extern int select (int width, fd_set *pReadFds, fd_set *pWriteFds,
17 fd_set *pExceptFds, struct timeval *pTimeOut);
19 #endif
20 #endif
22 #if !defined(FD_SET)
23 #define NFDBITS 32
24 #define FD_SETSIZE 32
25 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
26 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
27 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
28 #define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
29 #endif
31 #if defined(VMS)
32 typedef struct {
33 unsigned int fds_bits[1];
34 } fd_set;
35 #endif
37 #ifdef SYS_WINNT
38 /* ports/winnt/libntp/setpriority.c */
39 extern void InitSockets(void);
40 #endif
42 #endif /* NTP_SELECT_H */