From f90eda6523848d835adbe7bef598a86a72b1b22a Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Thu, 22 Nov 2007 16:09:55 +0000 Subject: 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 --- libc/sysdeps/linux/common/ioctl.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'libc/sysdeps/linux/common/ioctl.c') 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 #include +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include +#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) -- cgit v1.2.3