1 /* Copyright (C) 1997-2023 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 __sigtimedwait64 (const sigset_t
*set
, siginfo_t
*info
,
23 const struct __timespec64
*timeout
)
25 #ifndef __NR_rt_sigtimedwait_time64
26 # define __NR_rt_sigtimedwait_time64 __NR_rt_sigtimedwait
30 #ifdef __ASSUME_TIME64_SYSCALLS
31 result
= SYSCALL_CANCEL (rt_sigtimedwait_time64
, set
, info
, timeout
,
34 bool need_time64
= timeout
!= NULL
&& !in_int32_t_range (timeout
->tv_sec
);
37 result
= SYSCALL_CANCEL (rt_sigtimedwait_time64
, set
, info
, timeout
,
39 if (result
== 0 || errno
!= ENOSYS
)
41 __set_errno (EOVERFLOW
);
46 struct timespec ts32
, *pts32
= NULL
;
49 ts32
= valid_timespec64_to_timespec (*timeout
);
52 result
= SYSCALL_CANCEL (rt_sigtimedwait
, set
, info
, pts32
,
57 /* The kernel generates a SI_TKILL code in si_code in case tkill is
58 used. tkill is transparently used in raise(). Since having
59 SI_TKILL as a code is useful in general we fold the results
61 if (result
!= -1 && info
!= NULL
&& info
->si_code
== SI_TKILL
)
62 info
->si_code
= SI_USER
;
67 libc_hidden_def (__sigtimedwait64
)
70 __sigtimedwait (const sigset_t
*set
, siginfo_t
*info
,
71 const struct timespec
*timeout
)
73 struct __timespec64 ts64
, *pts64
= NULL
;
76 ts64
= valid_timespec_to_timespec64 (*timeout
);
79 return __sigtimedwait64 (set
, info
, pts64
);
82 libc_hidden_def (__sigtimedwait
)
83 weak_alias (__sigtimedwait
, sigtimedwait
)