mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-04 19:00:09 +00:00
8b0e795aaa
This patch simplifies sig{timed}wait{info} by: - Assuming __NR_rt_sigtimedwait existence on all architectures due minimum kernel version requirement (it pre-dates Linux git inclusion for Linux 2.6.12). - Call __sigtimedwait on both sigwait and sigwaitinfo. - Now that sigwait is based on an internal sigtimedwait call and it is present of both libc.so and libpthread.so we need to add an external private definition of __sigtimedwait for libpthread.so call. Checked on x86_64-linux-gnu. * sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add __sigtimedwait. * sysdeps/unix/sysv/linux/sigtimedwait.c: Simplify includes and assume __NR_rt_sigtimedwait. * sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Call __sigtimedwait and add LIBC_CANCEL_HANDLED for cancellation marking. * sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Zack Weinberg <zackw@panix.com>
36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
/* Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <signal.h>
|
|
#include <sysdep-cancel.h>
|
|
|
|
int
|
|
__sigwait (const sigset_t *set, int *sig)
|
|
{
|
|
siginfo_t si;
|
|
if (__sigtimedwait (set, &si, 0) < 0)
|
|
return -1;
|
|
*sig = si.si_signo;
|
|
return 0;
|
|
}
|
|
libc_hidden_def (__sigwait)
|
|
weak_alias (__sigwait, sigwait)
|
|
strong_alias (__sigwait, __libc_sigwait)
|
|
|
|
/* __sigtimedwait handles cancellation. */
|
|
LIBC_CANCEL_HANDLED ();
|