1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 16 unchanged lines hidden (view full) ---
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 154170 2006-01-10 09:19:10Z phk $");
34
35/*
36 * Pseudo-teletype Driver
37 * (Actually two drivers, requiring two entries in 'cdevsw')
38 */
39#include "opt_compat.h"
40#include "opt_tty.h"
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/lock.h>
44#include <sys/mutex.h>
45#include <sys/sx.h>
46#if defined(COMPAT_43TTY)
47#include <sys/ioctl_compat.h>
48#endif
49#include <sys/proc.h>
50#include <sys/tty.h>
51#include <sys/conf.h>
52#include <sys/fcntl.h>
53#include <sys/poll.h>
54#include <sys/kernel.h>
55#include <sys/uio.h>
56#include <sys/signalvar.h>
--- 489 unchanged lines hidden (view full) ---
546 /*
547 * The rest of the ioctls shouldn't be called until
548 * the slave is open.
549 */
550 if ((tp->t_state & TS_ISOPEN) == 0)
551 return (EAGAIN);
552
553 switch (cmd) {
554#ifdef COMPAT_43TTY
555 case TIOCSETP:
556 case TIOCSETN:
557#endif
558 case TIOCSETD:
559 case TIOCSETA:
560 case TIOCSETAW:
561 case TIOCSETAF:
562 /*
563 * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
564 * ttywflush(tp) will hang if there are characters in
565 * the outq.
--- 67 unchanged lines hidden (view full) ---
633 /*
634 * If external processing and packet mode send ioctl packet.
635 */
636 if ((tp->t_lflag&EXTPROC) && (pt->pt_flags & PF_PKT)) {
637 switch(cmd) {
638 case TIOCSETA:
639 case TIOCSETAW:
640 case TIOCSETAF:
641#ifdef COMPAT_43TTY
642 case TIOCSETP:
643 case TIOCSETN:
644 case TIOCSETC:
645 case TIOCSLTC:
646 case TIOCLBIS:
647 case TIOCLBIC:
648 case TIOCLSET:
649#endif
650 pt->pt_send |= TIOCPKT_IOCTL;
651 ptcwakeup(tp, FREAD);
652 break;
653 default:
654 break;
655 }
656 }
657 stop = (tp->t_iflag & IXON) && CCEQ(cc[VSTOP], CTRL('s'))
--- 63 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 16 unchanged lines hidden (view full) ---
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 154170 2006-01-10 09:19:10Z phk $");
34
35/*
36 * Pseudo-teletype Driver
37 * (Actually two drivers, requiring two entries in 'cdevsw')
38 */
39#include "opt_compat.h"
40#include "opt_tty.h"
41#include <sys/param.h>
42#include <sys/systm.h>
43#include <sys/lock.h>
44#include <sys/mutex.h>
45#include <sys/sx.h>
46#if defined(COMPAT_43TTY)
47#include <sys/ioctl_compat.h>
48#endif
49#include <sys/proc.h>
50#include <sys/tty.h>
51#include <sys/conf.h>
52#include <sys/fcntl.h>
53#include <sys/poll.h>
54#include <sys/kernel.h>
55#include <sys/uio.h>
56#include <sys/signalvar.h>
--- 489 unchanged lines hidden (view full) ---
546 /*
547 * The rest of the ioctls shouldn't be called until
548 * the slave is open.
549 */
550 if ((tp->t_state & TS_ISOPEN) == 0)
551 return (EAGAIN);
552
553 switch (cmd) {
554#ifdef COMPAT_43TTY
555 case TIOCSETP:
556 case TIOCSETN:
557#endif
558 case TIOCSETD:
559 case TIOCSETA:
560 case TIOCSETAW:
561 case TIOCSETAF:
562 /*
563 * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
564 * ttywflush(tp) will hang if there are characters in
565 * the outq.
--- 67 unchanged lines hidden (view full) ---
633 /*
634 * If external processing and packet mode send ioctl packet.
635 */
636 if ((tp->t_lflag&EXTPROC) && (pt->pt_flags & PF_PKT)) {
637 switch(cmd) {
638 case TIOCSETA:
639 case TIOCSETAW:
640 case TIOCSETAF:
641#ifdef COMPAT_43TTY
642 case TIOCSETP:
643 case TIOCSETN:
644 case TIOCSETC:
645 case TIOCSLTC:
646 case TIOCLBIS:
647 case TIOCLBIC:
648 case TIOCLSET:
649#endif
650 pt->pt_send |= TIOCPKT_IOCTL;
651 ptcwakeup(tp, FREAD);
652 break;
653 default:
654 break;
655 }
656 }
657 stop = (tp->t_iflag & IXON) && CCEQ(cc[VSTOP], CTRL('s'))
--- 63 unchanged lines hidden ---