Loading...
gen/FreeBSD/termios.c.patch /dev/null Libc-498
--- /dev/null
+++ Libc/Libc-498/gen/FreeBSD/termios.c.patch
@@ -0,0 +1,90 @@
+--- termios.c.orig	2007-03-16 00:36:09.000000000 -0700
++++ termios.c	2007-03-16 00:45:15.000000000 -0700
+@@ -37,6 +37,14 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.13 2002/05/28 16:59:39 alfred Exp $");
+ 
++#if __DARWIN_UNIX03
++#ifdef VARIANT_CANCELABLE
++#include <pthread.h>
++
++extern void _pthread_testcancel(pthread_t thread, int isconforming);
++#endif /* VARIANT_CANCELABLE */
++#endif /* __DARWIN_UNIX03 */
++
+ #include "namespace.h"
+ #include <sys/types.h>
+ #include <sys/fcntl.h>
+@@ -48,6 +56,7 @@
+ #include <unistd.h>
+ #include "un-namespace.h"
+ 
++#ifndef BUILDING_VARIANT
+ int
+ tcgetattr(fd, t)
+ 	int fd;
+@@ -87,6 +96,9 @@
+ {
+ 	int s;
+ 
++	if (isatty(fd) == 0)
++		return (-1);
++
+ 	s = pgrp;
+ 	return (_ioctl(fd, TIOCSPGRP, &s));
+ }
+@@ -97,6 +109,9 @@
+ {
+ 	int s;
+ 
++	if (isatty(fd) == 0)
++		return ((pid_t)-1);
++
+ 	if (_ioctl(fd, TIOCGPGRP, &s) < 0)
+ 		return ((pid_t)-1);
+ 
+@@ -183,17 +198,24 @@
+ 		return (-1);
+ 	return (0);
+ }
++#endif /* BUILDING_VARIANT */
+ 
+ int
+ __tcdrain(fd)
+ 	int fd;
+ {
++#if __DARWIN_UNIX03
++#ifdef VARIANT_CANCELABLE
++	_pthread_testcancel(pthread_self(), 1);
++#endif /* VARIANT_CANCELABLE */
++#endif /* __DARWIN_UNIX03 */
+ 	return (_ioctl(fd, TIOCDRAIN, 0));
+ }
+ 
+ __weak_reference(__tcdrain, tcdrain);
+ __weak_reference(__tcdrain, _tcdrain);
+ 
++#ifndef BUILDING_VARIANT
+ int
+ tcflush(fd, which)
+ 	int fd, which;
+@@ -230,16 +252,13 @@
+ 	case TCOON:
+ 		return (_ioctl(fd, TIOCSTART, 0));
+ 	case TCION:
++		return (_ioctl(fd, TIOCIXON, 0));
+ 	case TCIOFF:
+-		if (tcgetattr(fd, &term) == -1)
+-			return (-1);
+-		c = term.c_cc[action == TCIOFF ? VSTOP : VSTART];
+-		if (c != _POSIX_VDISABLE && _write(fd, &c, sizeof(c)) == -1)
+-			return (-1);
+-		return (0);
++		return (_ioctl(fd, TIOCIXOFF, 0));
+ 	default:
+ 		errno = EINVAL;
+ 		return (-1);
+ 	}
+ 	/* NOTREACHED */
+ }
++#endif /* BUILDING_VARIANT */