summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common/select.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2007-11-22 16:09:55 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2007-11-22 16:09:55 +0000
commitf90eda6523848d835adbe7bef598a86a72b1b22a (patch)
treeed6b799ce413dbd67251144be47f7cfe8a5fb746 /libc/sysdeps/linux/common/select.c
parent0957a1a07cba013759ac2067979e6792f804af90 (diff)
downloaduClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.bz2
uClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.xz
Push back changes to add cancellation handling.
It still needs to reach an agreement on the final solution, anyway this code have been put int to be shared for the mips-sh4 merge Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/sysdeps/linux/common/select.c')
-rw-r--r--libc/sysdeps/linux/common/select.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c
index 9a50d198a..55f4c23fb 100644
--- a/libc/sysdeps/linux/common/select.c
+++ b/libc/sysdeps/linux/common/select.c
@@ -10,12 +10,36 @@
#include "syscalls.h"
#include <sys/select.h>
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep-cancel.h>
+#else
+#define SINGLE_THREAD_P 1
+#endif
+
+
libc_hidden_proto(select)
#ifdef __NR__newselect
# undef __NR_select
# define __NR_select __NR__newselect
#endif
-_syscall5(int, select, int, n, fd_set *, readfds, fd_set *, writefds,
- fd_set *, exceptfds, struct timeval *, timeout);
+
+#define __NR___syscall_select __NR_select
+static inline _syscall5(int, __syscall_select, int, n, fd_set *, readfds,
+ fd_set *, writefds, fd_set *, exceptfds, struct timeval *, timeout);
+
+int select(int n, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
+ struct timeval * timeout)
+{
+ if (SINGLE_THREAD_P)
+ return __syscall_select(n, readfds, writefds, exceptfds, timeout);
+
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ int result = __syscall_select(n, readfds, writefds, exceptfds, timeout);
+ LIBC_CANCEL_RESET (oldtype);
+ return result;
+#endif
+}
+
libc_hidden_def(select)