1 /* Copyright (C) 2006-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <sys/select.h>
20 #include <sysdep-cancel.h>
21 #include <time64-support.h>
24 __pselect64 (int nfds
, fd_set
*readfds
, fd_set
*writefds
, fd_set
*exceptfds
,
25 const struct __timespec64
*timeout
, const sigset_t
*sigmask
)
27 /* The Linux kernel can in some situations update the timeout value.
28 We do not want that so use a local variable. */
29 struct __timespec64 tval
;
36 /* Note: the system call expects 7 values but on most architectures
37 we can only pass in 6 directly. If there is an architecture with
38 support for more parameters a new version of this file needs to
41 #ifndef __NR_pselect6_time64
42 # define __NR_pselect6_time64 __NR_pselect6
45 if (supports_time64 ())
47 /* NB: This is required by ARGIFY used in x32 internal_syscallN. */
48 __syscall_ulong_t data
[2] =
50 (uintptr_t) sigmask
, __NSIG_BYTES
52 r
= SYSCALL_CANCEL (pselect6_time64
, nfds
, readfds
, writefds
, exceptfds
,
54 if (r
== 0 || errno
!= ENOSYS
)
57 mark_time64_unsupported ();
60 #ifndef __ASSUME_TIME64_SYSCALLS
61 r
= __pselect32 (nfds
, readfds
, writefds
, exceptfds
, timeout
, sigmask
);
67 libc_hidden_def (__pselect64
)
70 __pselect (int nfds
, fd_set
*readfds
, fd_set
*writefds
, fd_set
*exceptfds
,
71 const struct timespec
*timeout
, const sigset_t
*sigmask
)
73 struct __timespec64 ts64
, *pts64
= NULL
;
76 ts64
= valid_timespec_to_timespec64 (*timeout
);
79 return __pselect64 (nfds
, readfds
, writefds
, exceptfds
, pts64
, sigmask
);
84 weak_alias (__pselect
, pselect
)