Kernel - Commenting changes only
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / include_exp / acess / fd_set.h
1 /*
2  * Acess2 Dynamic Linker
3  * - By John Hodge (thePowersGang)
4  *
5  * acess/fd_set.h
6  * - fd_set structure used by select()
7  */
8 #ifndef _ACESS__FD_SET_H_
9 #define _ACESS__FD_SET_H_
10
11 #define FD_SETSIZE      128
12
13 typedef unsigned short  fd_set_ent_t;
14
15 /**
16  * \brief fd_set for select()
17  */
18 typedef struct
19 {
20         fd_set_ent_t    flags[FD_SETSIZE/16];
21 }       fd_set;
22
23
24 static inline void      FD_ZERO(fd_set *fdsetp)
25 {
26         int i = FD_SETSIZE/16;
27         while( i-- )
28                 fdsetp->flags[i] = 0;
29 }
30 static inline  void     FD_CLR(int fd, fd_set *fdsetp)
31 {
32         if(fd < 0 || fd > FD_SETSIZE)   return;
33         fdsetp->flags[fd/16] &= (fd_set_ent_t) ((~1 << (fd%16))) & 0xFFFF;
34 }
35 static inline  void     FD_SET(int fd, fd_set *fdsetp)
36 {
37         if(fd < 0 || fd > FD_SETSIZE)   return;
38         fdsetp->flags[fd/16] |= (fd_set_ent_t) (1 << (fd%16));
39 }
40 static inline  int      FD_ISSET(int fd, fd_set *fdsetp)
41 {
42         if(fd < 0 || fd > FD_SETSIZE)   return 0;
43         return !!( fdsetp->flags[fd/16] & (1<<(fd%16)) );
44 }
45
46 #endif

UCC git Repository :: git.ucc.asn.au