1 /* Copyright (C) 2006-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
22 #include <sysdep-cancel.h>
25 __ppoll64 (struct pollfd
*fds
, nfds_t nfds
, const struct __timespec64
*timeout
,
26 const sigset_t
*sigmask
)
28 /* The Linux kernel can in some situations update the timeout value.
29 We do not want that so use a local variable. */
30 struct __timespec64 tval
;
37 #ifndef __NR_ppoll_time64
38 # define __NR_ppoll_time64 __NR_ppoll
41 #ifdef __ASSUME_TIME64_SYSCALLS
42 return SYSCALL_CANCEL (ppoll_time64
, fds
, nfds
, timeout
, sigmask
,
46 bool need_time64
= timeout
!= NULL
&& !in_int32_t_range (timeout
->tv_sec
);
49 ret
= SYSCALL_CANCEL (ppoll_time64
, fds
, nfds
, timeout
, sigmask
,
51 if (ret
== 0 || errno
!= ENOSYS
)
53 __set_errno (EOVERFLOW
);
59 ts32
= valid_timespec64_to_timespec (*timeout
);
61 return SYSCALL_CANCEL (ppoll
, fds
, nfds
, timeout
? &ts32
: NULL
, sigmask
,
67 libc_hidden_def (__ppoll64
)
70 ppoll (struct pollfd
*fds
, nfds_t nfds
, const struct timespec
*timeout
,
71 const sigset_t
*sigmask
)
73 struct __timespec64 ts64
;
75 ts64
= valid_timespec_to_timespec64 (*timeout
);
77 return __ppoll64 (fds
, nfds
, timeout
? &ts64
: NULL
, sigmask
);
80 libc_hidden_def (ppoll
)