summaryrefslogtreecommitdiff
path: root/libc/unistd
diff options
context:
space:
mode:
authorSalvatore Cro <salvatore.cro@st.com>2010-09-09 16:01:04 +0200
committerCarmelo Amoroso <carmelo.amoroso@st.com>2010-09-15 12:38:42 +0200
commit4b88e6e858b55def2ef0392278ddf81835f2ac45 (patch)
treee97e06b8eb18ef18f86e598ccec879405bdcee53 /libc/unistd
parent37eb913ed8c4798b736e678f4dbd9f4a91a68f74 (diff)
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 <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/unistd')
-rw-r--r--libc/unistd/sleep.c7
1 files changed, 6 insertions, 1 deletions
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