This source file includes following definitions.
- fd_CLR
- fd_ISSET
- fd_SET
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef SYSSELECT_H
20 #define SYSSELECT_H 1
21
22 #ifndef DOS_NT
23 #include <sys/select.h>
24 #endif
25
26 #include "lisp.h"
27
28
29
30
31 #ifndef WINDOWSNT
32 #ifdef FD_SET
33 #ifndef FD_SETSIZE
34 #define FD_SETSIZE 64
35 #endif
36 #else
37 #define FD_SETSIZE 32
38 typedef int fd_set;
39
40
41 #define FD_SET(n, p) (*(p) |= (1 << (n)))
42 #define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
43 #define FD_ISSET(n, p) (*(p) & (1 << (n)))
44 #define FD_ZERO(p) (*(p) = 0)
45 #endif
46 #endif
47
48 #if !defined (HAVE_SELECT)
49 #define select sys_select
50 #endif
51
52 #ifdef MSDOS
53
54
55
56
57 #undef select
58 #define pselect sys_select
59 #endif
60
61 #ifndef WINDOWSNT
62 INLINE_HEADER_BEGIN
63
64
65
66 INLINE void
67 fd_CLR (int fd, fd_set *set)
68 {
69 eassume (0 <= fd && fd < FD_SETSIZE);
70 FD_CLR (fd, set);
71 }
72
73 INLINE bool
74 fd_ISSET (int fd, fd_set *set)
75 {
76 eassume (0 <= fd && fd < FD_SETSIZE);
77 return FD_ISSET (fd, set) != 0;
78 }
79
80 INLINE void
81 fd_SET (int fd, fd_set *set)
82 {
83 eassume (0 <= fd && fd < FD_SETSIZE);
84 FD_SET (fd, set);
85 }
86
87 #undef FD_CLR
88 #undef FD_ISSET
89 #undef FD_SET
90 #define FD_CLR(fd, set) fd_CLR (fd, set)
91 #define FD_ISSET(fd, set) fd_ISSET (fd, set)
92 #define FD_SET(fd, set) fd_SET (fd, set)
93
94 INLINE_HEADER_END
95
96 #endif
97
98 #endif