summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/ppoll.c
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/sysdeps/linux/common/ppoll.c
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/sysdeps/linux/common/ppoll.c')
-rw-r--r--libc/sysdeps/linux/common/ppoll.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c
index 02c8013a5..09b2b1539 100644
--- a/libc/sysdeps/linux/common/ppoll.c
+++ b/libc/sysdeps/linux/common/ppoll.c
@@ -24,6 +24,12 @@
#include <stddef.h>
#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
+# include <sysdep-cancel.h>
+# else
+# define SINGLE_THREAD_P 1
+# endif
+
int
ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
const sigset_t *sigmask)
@@ -35,8 +41,15 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
tval = *timeout;
timeout = &tval;
}
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
- return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ int result = INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
+ LIBC_CANCEL_RESET (oldtype);
+ return result;
+# endif
}
libc_hidden_def(ppoll)
#endif