2011-02-12 05:22:29 +00:00
|
|
|
#ifndef _SYS_SELECT_H
|
|
|
|
#define _SYS_SELECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-09-08 21:14:52 +00:00
|
|
|
#include <features.h>
|
2012-09-07 02:44:55 +00:00
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
#define __NEED_size_t
|
|
|
|
#define __NEED_time_t
|
2011-04-13 17:16:49 +00:00
|
|
|
#define __NEED_suseconds_t
|
2011-02-12 05:22:29 +00:00
|
|
|
#define __NEED_struct_timeval
|
|
|
|
#define __NEED_struct_timespec
|
|
|
|
#define __NEED_sigset_t
|
|
|
|
|
|
|
|
#include <bits/alltypes.h>
|
|
|
|
|
|
|
|
#define FD_SETSIZE 1024
|
|
|
|
|
2011-04-14 20:23:31 +00:00
|
|
|
typedef unsigned long fd_mask;
|
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
|
|
|
|
} fd_set;
|
|
|
|
|
|
|
|
#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)
|
2011-08-27 23:42:13 +00:00
|
|
|
#define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
|
|
|
|
#define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
|
2011-09-24 02:24:33 +00:00
|
|
|
#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2012-09-07 02:44:55 +00:00
|
|
|
int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
|
|
|
|
int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
|
2011-02-12 05:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|