about summary refs log tree commit diff
path: root/sysdeps/posix/sleep.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.com>2015-11-08 20:06:42 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-11-20 11:16:07 -0200
commit8c873bf0190740ac1102e13ff7aeb6c08048abfd (patch)
treea6dd51d1f25c3222a42dbab327be0d44d52888db /sysdeps/posix/sleep.c
parent31cf39421bae23ffc7b6c6a229e14f8faa41608f (diff)
downloadglibc-8c873bf0190740ac1102e13ff7aeb6c08048abfd.tar.gz
glibc-8c873bf0190740ac1102e13ff7aeb6c08048abfd.tar.xz
glibc-8c873bf0190740ac1102e13ff7aeb6c08048abfd.zip
Remove signal handling for nanosleep (bug 16364)
Linux 2.6.32 and forward do not show the issue regarding SysV SIGCHLD
vs. SIG_IGN for nanosleep which make it feasible to use it for sleep
implementation without requiring any hacking to handle the spurious
wake up.  The issue is likely being fixed before 2.6 and git
history [1] [2].

This patch simplifies the sleep code to call nanosleep directly by
using the posix default version.  It also removes the early cancellation
tests for zero argument, since nanosleep will handle cancellation
in this case.

[1] https://lkml.org/lkml/2004/11/25/5
[2] https://lkml.org/lkml/2003/11/8/50

Checked on x86_64, ppc64le, and aarch64.

	[BZ #16364]
	* sysdeps/unix/sysv/linux/sleep.c: Remove file
	* sysdeps/posix/sleep.c (__sleep): Simplify cancellation handling.
Diffstat (limited to 'sysdeps/posix/sleep.c')
-rw-r--r--sysdeps/posix/sleep.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/sysdeps/posix/sleep.c b/sysdeps/posix/sleep.c
index 75d9c18cd3..80beb2aee9 100644
--- a/sysdeps/posix/sleep.c
+++ b/sysdeps/posix/sleep.c
@@ -32,15 +32,6 @@
 unsigned int
 __sleep (unsigned int seconds)
 {
-  /* This is not necessary but some buggy programs depend on it.  */
-  if (__glibc_unlikely (seconds == 0))
-    {
-#ifdef CANCELLATION_P
-      CANCELLATION_P (THREAD_SELF);
-#endif
-      return 0;
-    }
-
   int save_errno = errno;
 
   const unsigned int max