diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/termios/Makefile.in | 3 | ||||
-rw-r--r-- | libc/termios/tcdrain.c | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/libc/termios/Makefile.in b/libc/termios/Makefile.in index f35f78fa2..3e723ce04 100644 --- a/libc/termios/Makefile.in +++ b/libc/termios/Makefile.in @@ -1,6 +1,5 @@ # Makefile for uClibc # -# Copyright (C) 2000 by Lineo, inc. # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. @@ -13,6 +12,8 @@ TERMIOS_SRC := $(wildcard $(TERMIOS_DIR)/*.c) TERMIOS_OBJ := $(patsubst $(TERMIOS_DIR)/%.c,$(TERMIOS_OUT)/%.o,$(TERMIOS_SRC)) libc-y += $(TERMIOS_OBJ) +libc-a-y += $(TERMIOS_OBJ) +libc-so-y += $(TERMIOS_OBJ:.o=.os) objclean-y += termios_objclean diff --git a/libc/termios/tcdrain.c b/libc/termios/tcdrain.c index a13374cb5..e0f423138 100644 --- a/libc/termios/tcdrain.c +++ b/libc/termios/tcdrain.c @@ -19,6 +19,9 @@ #include <errno.h> #include <termios.h> #include <sys/ioctl.h> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include <sysdep-cancel.h> +#endif libc_hidden_proto(ioctl) @@ -26,6 +29,21 @@ extern __typeof(tcdrain) __libc_tcdrain; /* Wait for pending output to be written on FD. */ int __libc_tcdrain (int fd) { - return ioctl(fd, TCSBRK, 1); +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + if (SINGLE_THREAD_P) + /* With an argument of 1, TCSBRK for output to be drain. */ + return INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1); + + int oldtype = LIBC_CANCEL_ASYNC (); + + /* With an argument of 1, TCSBRK for output to be drain. */ + int result = INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1); + + LIBC_CANCEL_RESET (oldtype); + + return result; +#else + return ioctl(fd, TCSBRK, 1); +#endif } weak_alias(__libc_tcdrain,tcdrain) |