1 #include <sys/select.h>
7 #define IS32BIT(x) !((x)+0x80000000ULL>>32)
8 #define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))
10 int pselect(int n
, fd_set
*restrict rfds
, fd_set
*restrict wfds
, fd_set
*restrict efds
, const struct timespec
*restrict ts
, const sigset_t
*restrict mask
)
12 syscall_arg_t data
[2] = { (uintptr_t)mask
, _NSIG
/8 };
13 time_t s
= ts
? ts
->tv_sec
: 0;
14 long ns
= ts
? ts
->tv_nsec
: 0;
15 #ifdef SYS_pselect6_time64
17 if (SYS_pselect6
== SYS_pselect6_time64
|| !IS32BIT(s
))
18 r
= __syscall_cp(SYS_pselect6_time64
, n
, rfds
, wfds
, efds
,
19 ts
? ((long long[]){s
, ns
}) : 0, data
);
20 if (SYS_pselect6
== SYS_pselect6_time64
|| r
!=-ENOSYS
)
21 return __syscall_ret(r
);
24 return syscall_cp(SYS_pselect6
, n
, rfds
, wfds
, efds
,
25 ts
? ((long[]){s
, ns
}) : 0, data
);