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 * $Id: tty_pty.c,v 1.38 1996/02/29 00:18:11 hsu Exp $
35 */
36
37/*
38 * Pseudo-teletype Driver
39 * (Actually two drivers, requiring two entries in 'cdevsw')
40 */
41#include "pty.h" /* XXX */
42
--- 486 unchanged lines hidden (view full) ---
529 return (error);
530 /* check again for safety */
531 if ((tp->t_state & TS_ISOPEN) == 0) {
532 /* adjust as usual */
533 uio->uio_resid += cc;
534 return (EIO);
535 }
536 }
537 if (cc)
538 cc -= b_to_q((char *)cp, cc, &tp->t_canq);
539 }
540 /* adjust for data copied in but not written */
541 uio->uio_resid += cc;
542 (void) putc(0, &tp->t_canq);
543 ttwakeup(tp);
544 wakeup(TSA_PTS_READ(tp));
545 return (0);
546 }
--- 22 unchanged lines hidden (view full) ---
569 cc--;
570 }
571 cc = 0;
572 }
573 return (0);
574block:
575 /*
576 * Come here to wait for slave to open, for space
577 * in outq, or space in rawq.
578 */
579 if ((tp->t_state & TS_CONNECTED) == 0) {
580 /* adjust for data copied in but not written */
581 uio->uio_resid += cc;
582 return (EIO);
583 }
584 if (flag & IO_NDELAY) {
585 /* adjust for data copied in but not written */
--- 232 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
--- 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 * $Id: tty_pty.c,v 1.38 1996/02/29 00:18:11 hsu Exp $
35 */
36
37/*
38 * Pseudo-teletype Driver
39 * (Actually two drivers, requiring two entries in 'cdevsw')
40 */
41#include "pty.h" /* XXX */
42
--- 486 unchanged lines hidden (view full) ---
529 return (error);
530 /* check again for safety */
531 if ((tp->t_state & TS_ISOPEN) == 0) {
532 /* adjust as usual */
533 uio->uio_resid += cc;
534 return (EIO);
535 }
536 }
537 if (cc)
538 cc -= b_to_q((char *)cp, cc, &tp->t_canq);
539 }
540 /* adjust for data copied in but not written */
541 uio->uio_resid += cc;
542 (void) putc(0, &tp->t_canq);
543 ttwakeup(tp);
544 wakeup(TSA_PTS_READ(tp));
545 return (0);
546 }
--- 22 unchanged lines hidden (view full) ---
569 cc--;
570 }
571 cc = 0;
572 }
573 return (0);
574block:
575 /*
576 * Come here to wait for slave to open, for space
577 * in outq, or space in rawq.
578 */
579 if ((tp->t_state & TS_CONNECTED) == 0) {
580 /* adjust for data copied in but not written */
581 uio->uio_resid += cc;
582 return (EIO);
583 }
584 if (flag & IO_NDELAY) {
585 /* adjust for data copied in but not written */
--- 232 unchanged lines hidden ---