svn commit: branches/uClibc-nptl/libc/termios

sjhill at uclibc.org sjhill at uclibc.org
Wed Aug 23 03:25:39 UTC 2006


Author: sjhill
Date: 2006-08-22 20:25:38 -0700 (Tue, 22 Aug 2006)
New Revision: 15914

Log:
Changes needed for NPTL cancellation point.


Modified:
   branches/uClibc-nptl/libc/termios/Makefile.in
   branches/uClibc-nptl/libc/termios/tcdrain.c


Changeset:
Modified: branches/uClibc-nptl/libc/termios/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/termios/Makefile.in	2006-08-23 03:25:01 UTC (rev 15913)
+++ branches/uClibc-nptl/libc/termios/Makefile.in	2006-08-23 03:25:38 UTC (rev 15914)
@@ -1,6 +1,5 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000 by Lineo, inc.
 # Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
@@ -13,6 +12,8 @@
 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
 

Modified: branches/uClibc-nptl/libc/termios/tcdrain.c
===================================================================
--- branches/uClibc-nptl/libc/termios/tcdrain.c	2006-08-23 03:25:01 UTC (rev 15913)
+++ branches/uClibc-nptl/libc/termios/tcdrain.c	2006-08-23 03:25:38 UTC (rev 15914)
@@ -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 @@
 /* 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)




More information about the uClibc-cvs mailing list