1 --- termios.c.orig 2009-11-08 16:27:01.000000000 -0800
2 +++ termios.c 2009-11-08 16:28:15.000000000 -0800
3 @@ -33,6 +33,14 @@ static char sccsid[] = "@(#)termios.c 8.
5 __FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.16 2009/05/07 13:49:48 ed Exp $");
8 +#ifdef VARIANT_CANCELABLE
11 +extern void _pthread_testcancel(pthread_t thread, int isconforming);
12 +#endif /* VARIANT_CANCELABLE */
13 +#endif /* __DARWIN_UNIX03 */
15 #include "namespace.h"
16 #include <sys/types.h>
17 #include <sys/fcntl.h>
18 @@ -44,6 +52,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/ter
20 #include "un-namespace.h"
22 +#ifndef BUILDING_VARIANT
26 @@ -83,6 +92,9 @@ tcsetpgrp(int fd, pid_t pgrp)
30 + if (isatty(fd) == 0)
34 return (_ioctl(fd, TIOCSPGRP, &s));
36 @@ -93,12 +105,16 @@ tcgetpgrp(fd)
40 + if (isatty(fd) == 0)
43 if (_ioctl(fd, TIOCGPGRP, &s) < 0)
49 +#if 0 // Needs API review first
53 @@ -121,6 +137,7 @@ tcsetsid(int fd, pid_t pid)
55 return (_ioctl(fd, TIOCSCTTY, NULL));
61 @@ -202,17 +219,24 @@ tcsendbreak(fd, len)
65 +#endif /* BUILDING_VARIANT */
72 +#ifdef VARIANT_CANCELABLE
73 + _pthread_testcancel(pthread_self(), 1);
74 +#endif /* VARIANT_CANCELABLE */
75 +#endif /* __DARWIN_UNIX03 */
76 return (_ioctl(fd, TIOCDRAIN, 0));
79 __weak_reference(__tcdrain, tcdrain);
80 __weak_reference(__tcdrain, _tcdrain);
82 +#ifndef BUILDING_VARIANT
86 @@ -249,16 +273,13 @@ tcflow(fd, action)
88 return (_ioctl(fd, TIOCSTART, 0));
90 + return (_ioctl(fd, TIOCIXON, 0));
92 - if (tcgetattr(fd, &term) == -1)
94 - c = term.c_cc[action == TCIOFF ? VSTOP : VSTART];
95 - if (c != _POSIX_VDISABLE && _write(fd, &c, sizeof(c)) == -1)
98 + return (_ioctl(fd, TIOCIXOFF, 0));
105 +#endif /* BUILDING_VARIANT */