Simplify Linux sig{timed}wait{info} implementations

System Internals / glibc - Adhemerval Zanella [linaro.org] - 6 November 2017 19:37 EST

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.

8b0e795aaa Simplify Linux sig{timed}wait{info} implementations
ChangeLog | 8 ++++
sysdeps/unix/sysv/linux/Versions | 1 +
sysdeps/unix/sysv/linux/sigtimedwait.c | 8 ----
sysdeps/unix/sysv/linux/sigwait.c | 81 ++++------------------------------
sysdeps/unix/sysv/linux/sigwaitinfo.c | 41 ++---------------
5 files changed, 21 insertions(+), 118 deletions(-)

Upstream: sourceware.org


  • Share