1*cda5da8dSAndroid Build Coastguard Worker #ifndef _SYS_SELECT_H 2*cda5da8dSAndroid Build Coastguard Worker #define _SYS_SELECT_H 3*cda5da8dSAndroid Build Coastguard Worker #ifdef __cplusplus 4*cda5da8dSAndroid Build Coastguard Worker extern "C" { 5*cda5da8dSAndroid Build Coastguard Worker #endif 6*cda5da8dSAndroid Build Coastguard Worker 7*cda5da8dSAndroid Build Coastguard Worker #include <features.h> 8*cda5da8dSAndroid Build Coastguard Worker 9*cda5da8dSAndroid Build Coastguard Worker #define __NEED_size_t 10*cda5da8dSAndroid Build Coastguard Worker #define __NEED_time_t 11*cda5da8dSAndroid Build Coastguard Worker #define __NEED_suseconds_t 12*cda5da8dSAndroid Build Coastguard Worker #define __NEED_struct_timeval 13*cda5da8dSAndroid Build Coastguard Worker #define __NEED_struct_timespec 14*cda5da8dSAndroid Build Coastguard Worker #define __NEED_sigset_t 15*cda5da8dSAndroid Build Coastguard Worker 16*cda5da8dSAndroid Build Coastguard Worker #include <bits/alltypes.h> 17*cda5da8dSAndroid Build Coastguard Worker 18*cda5da8dSAndroid Build Coastguard Worker #define FD_SETSIZE 1024 19*cda5da8dSAndroid Build Coastguard Worker 20*cda5da8dSAndroid Build Coastguard Worker typedef unsigned long fd_mask; 21*cda5da8dSAndroid Build Coastguard Worker 22*cda5da8dSAndroid Build Coastguard Worker typedef struct { 23*cda5da8dSAndroid Build Coastguard Worker unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)]; 24*cda5da8dSAndroid Build Coastguard Worker } fd_set; 25*cda5da8dSAndroid Build Coastguard Worker 26*cda5da8dSAndroid Build Coastguard Worker #define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0) 27*cda5da8dSAndroid Build Coastguard Worker #define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long))))) 28*cda5da8dSAndroid Build Coastguard Worker #define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long))))) 29*cda5da8dSAndroid Build Coastguard Worker #define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long))))) 30*cda5da8dSAndroid Build Coastguard Worker 31*cda5da8dSAndroid Build Coastguard Worker int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict); 32*cda5da8dSAndroid Build Coastguard Worker int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); 33*cda5da8dSAndroid Build Coastguard Worker 34*cda5da8dSAndroid Build Coastguard Worker #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 35*cda5da8dSAndroid Build Coastguard Worker #define NFDBITS (8*(int)sizeof(long)) 36*cda5da8dSAndroid Build Coastguard Worker #endif 37*cda5da8dSAndroid Build Coastguard Worker 38*cda5da8dSAndroid Build Coastguard Worker #if _REDIR_TIME64 39*cda5da8dSAndroid Build Coastguard Worker __REDIR(select, __select_time64); 40*cda5da8dSAndroid Build Coastguard Worker __REDIR(pselect, __pselect_time64); 41*cda5da8dSAndroid Build Coastguard Worker #endif 42*cda5da8dSAndroid Build Coastguard Worker 43*cda5da8dSAndroid Build Coastguard Worker #ifdef __cplusplus 44*cda5da8dSAndroid Build Coastguard Worker } 45*cda5da8dSAndroid Build Coastguard Worker #endif 46*cda5da8dSAndroid Build Coastguard Worker #endif 47