• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SYS_SELECT_H
2 #define _SYS_SELECT_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #include <features.h>
8 
9 #define __NEED_size_t
10 #define __NEED_time_t
11 #define __NEED_suseconds_t
12 #define __NEED_struct_timeval
13 #define __NEED_struct_timespec
14 #define __NEED_sigset_t
15 
16 #include <bits/alltypes.h>
17 #include <signal.h>
18 #ifdef LOSCFG_FS_VFS
19 #include "vfs_config.h"
20 
21 /* FD_SETSIZE is defined in "vfs_config.h" */
22 #else
23 #define FD_SETSIZE 1024
24 #define FD_SET_TOTAL_SIZE FD_SETSIZE
25 #endif
26 
27 typedef unsigned long fd_mask;
28 
29 typedef struct {
30 	unsigned long fds_bits[FD_SET_TOTAL_SIZE / 8 / sizeof(long)];
31 } fd_set;
32 
33 #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)
34 #define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
35 #define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
36 #define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
37 
38 int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
39 int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
40 
41 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
42 #define NFDBITS (8*(int)sizeof(long))
43 #endif
44 
45 #if _REDIR_TIME64
46 __REDIR(select, __select_time64);
47 __REDIR(pselect, __pselect_time64);
48 #endif
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 #endif
54