Deleted Added
full compact
pty.c (85844) pty.c (90831)
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

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
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

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
34 * $FreeBSD: head/sys/kern/tty_pty.c 85844 2001-11-01 20:56:57Z rwatson $
34 * $FreeBSD: head/sys/kern/tty_pty.c 90831 2002-02-18 06:07:11Z dillon $
35 */
36
37/*
38 * Pseudo-teletype Driver
39 * (Actually two drivers, requiring two entries in 'cdevsw')
40 */
41#include "opt_compat.h"
42#include <sys/param.h>

--- 456 unchanged lines hidden (view full) ---

499 ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)))
500 revents |= events & (POLLIN | POLLRDNORM);
501
502 if (events & (POLLOUT | POLLWRNORM))
503 if (tp->t_state & TS_ISOPEN &&
504 ((pti->pt_flags & PF_REMOTE) ?
505 (tp->t_canq.c_cc == 0) :
506 ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) ||
35 */
36
37/*
38 * Pseudo-teletype Driver
39 * (Actually two drivers, requiring two entries in 'cdevsw')
40 */
41#include "opt_compat.h"
42#include <sys/param.h>

--- 456 unchanged lines hidden (view full) ---

499 ((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl)))
500 revents |= events & (POLLIN | POLLRDNORM);
501
502 if (events & (POLLOUT | POLLWRNORM))
503 if (tp->t_state & TS_ISOPEN &&
504 ((pti->pt_flags & PF_REMOTE) ?
505 (tp->t_canq.c_cc == 0) :
506 ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG - 2) ||
507 (tp->t_canq.c_cc == 0 && (tp->t_iflag & ICANON)))))
507 (tp->t_canq.c_cc == 0 && (tp->t_lflag & ICANON)))))
508 revents |= events & (POLLOUT | POLLWRNORM);
509
510 if (events & POLLHUP)
511 if ((tp->t_state & TS_CARR_ON) == 0)
512 revents |= POLLHUP;
513
514 if (revents == 0) {
515 if (events & (POLLIN | POLLRDNORM))

--- 75 unchanged lines hidden (view full) ---

591 if ((tp->t_state & TS_ISOPEN) == 0) {
592 /* adjust for data copied in but not written */
593 uio->uio_resid += cc;
594 return (EIO);
595 }
596 }
597 while (cc > 0) {
598 if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 &&
508 revents |= events & (POLLOUT | POLLWRNORM);
509
510 if (events & POLLHUP)
511 if ((tp->t_state & TS_CARR_ON) == 0)
512 revents |= POLLHUP;
513
514 if (revents == 0) {
515 if (events & (POLLIN | POLLRDNORM))

--- 75 unchanged lines hidden (view full) ---

591 if ((tp->t_state & TS_ISOPEN) == 0) {
592 /* adjust for data copied in but not written */
593 uio->uio_resid += cc;
594 return (EIO);
595 }
596 }
597 while (cc > 0) {
598 if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 &&
599 (tp->t_canq.c_cc > 0 || !(tp->t_iflag&ICANON))) {
599 (tp->t_canq.c_cc > 0 || !(tp->t_lflag&ICANON))) {
600 wakeup(TSA_HUP_OR_INPUT(tp));
601 goto block;
602 }
603 (*linesw[tp->t_line].l_rint)(*cp++, tp);
604 cnt++;
605 cc--;
606 }
607 cc = 0;

--- 251 unchanged lines hidden ---
600 wakeup(TSA_HUP_OR_INPUT(tp));
601 goto block;
602 }
603 (*linesw[tp->t_line].l_rint)(*cp++, tp);
604 cnt++;
605 cc--;
606 }
607 cc = 0;

--- 251 unchanged lines hidden ---