From 4b88e6e858b55def2ef0392278ddf81835f2ac45 Mon Sep 17 00:00:00 2001 From: Salvatore Cro Date: Thu, 9 Sep 2010 16:01:04 +0200 Subject: libc: Fix cancellation handling in some C functions According to POSIX.1-2008 standard, the following syscalls shall be cancellation points : waitid, sleep, fdatasync, ppoll. Further, if generic syscall is not available and stubs are configured, provide the stub implementation for function. Signed-off-by: Salvatore Cro Signed-off-by: Carmelo Amoroso --- libc/unistd/sleep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libc/unistd') diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c index 0c0416e6d..b0031f022 100644 --- a/libc/unistd/sleep.c +++ b/libc/unistd/sleep.c @@ -54,7 +54,12 @@ unsigned int sleep (unsigned int seconds) /* This is not necessary but some buggy programs depend on this. */ if (seconds == 0) - return 0; + { +# ifdef CANCELLATION_P + CANCELLATION_P (THREAD_SELF); +# endif + return 0; + } /* Linux will wake up the system call, nanosleep, when SIGCHLD arrives even if SIGCHLD is ignored. We have to deal with it -- cgit v1.2.3