summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common/ioctl.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/ioctl.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/ioctl.c')
-rw-r--r--libc/sysdeps/linux/common/ioctl.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c
index e8e3a1031..02393b98e 100644
--- a/libc/sysdeps/linux/common/ioctl.c
+++ b/libc/sysdeps/linux/common/ioctl.c
@@ -11,6 +11,12 @@
#include <stdarg.h>
#include <sys/ioctl.h>
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep-cancel.h>
+#else
+#define SINGLE_THREAD_P 1
+#endif
+
libc_hidden_proto(ioctl)
#define __NR___syscall_ioctl __NR_ioctl
@@ -19,13 +25,22 @@ _syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg
int ioctl(int fd, unsigned long int request, ...)
{
- void *arg;
- va_list list;
+ void *arg;
+ va_list list;
+
+ va_start(list, request);
+ arg = va_arg(list, void *);
+
+ va_end(list);
- va_start(list, request);
- arg = va_arg(list, void *);
+ if (SINGLE_THREAD_P)
+ return __syscall_ioctl(fd, request, arg);
- va_end(list);
- return __syscall_ioctl(fd, request, arg);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ int oldtype = LIBC_CANCEL_ASYNC ();
+ int result = __syscall_ioctl(fd, request, arg);
+ LIBC_CANCEL_RESET (oldtype);
+ return result;
+#endif
}
libc_hidden_def(ioctl)