Usermode/libc - Look ma! setjmp
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / select.c
1 /*
2  * Acess2 C Library
3  * - By John Hodge (thePowersGang)
4  *
5  * select.c
6  */
7
8 //#include <sys/select.h>
9 #include <sys/types.h>
10
11 void FD_ZERO(fd_set *fdsetp)
12 {
13         int i = FD_SETSIZE/16;
14         while( i-- )
15                 fdsetp->flags[i]=0;
16 }
17
18 void FD_CLR(int fd, fd_set *fdsetp)
19 {
20         if(fd < 0 || fd > FD_SETSIZE)   return;
21         fdsetp->flags[fd/16] &= (fd_set_ent_t) ((~1 << (fd%16))) & 0xFFFF;
22 }
23
24 void FD_SET(int fd, fd_set *fdsetp)
25 {
26         if(fd < 0 || fd > FD_SETSIZE)   return;
27         fdsetp->flags[fd/16] |= (fd_set_ent_t) (1 << (fd%16));
28 }
29
30 int FD_ISSET(int fd, fd_set *fdsetp)
31 {
32         if(fd < 0 || fd > FD_SETSIZE)   return 0;
33         return !!( fdsetp->flags[fd/16] & (1<<(fd%16)) );
34 }
35

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