2 * Acess2 Dynamic Linker
3 * - By John Hodge (thePowersGang)
6 * - fd_set structure used by select()
8 #ifndef _ACESS__FD_SET_H_
9 #define _ACESS__FD_SET_H_
11 #define FD_SETSIZE 128
13 typedef unsigned short fd_set_ent_t;
16 * \brief fd_set for select()
20 fd_set_ent_t flags[FD_SETSIZE/16];
24 static inline void FD_ZERO(fd_set *fdsetp)
26 int i = FD_SETSIZE/16;
30 static inline void FD_CLR(int fd, fd_set *fdsetp)
32 if(fd < 0 || fd > FD_SETSIZE) return;
33 fd_set_ent_t mask = 1 << (fd % 16);
34 fdsetp->flags[fd/16] &= ~mask;
36 static inline void FD_SET(int fd, fd_set *fdsetp)
38 if(fd < 0 || fd > FD_SETSIZE) return;
39 fd_set_ent_t mask = 1 << (fd % 16);
40 fdsetp->flags[fd/16] |= mask;
42 static inline int FD_ISSET(int fd, const fd_set *fdsetp)
44 if(fd < 0 || fd > FD_SETSIZE) return 0;
45 fd_set_ent_t mask = 1 << (fd % 16);
46 return !!( fdsetp->flags[fd/16] & mask );