pty.c (111119) | pty.c (111741) |
---|---|
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 111119 2003-02-19 05:47:46Z imp $ | 34 * $FreeBSD: head/sys/kern/tty_pty.c 111741 2003-03-02 15:50:23Z des $ |
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> --- 377 unchanged lines hidden (view full) --- 420 if (tp->t_state&TS_ISOPEN) { 421 if (pti->pt_flags&PF_PKT && pti->pt_send) { 422 error = ureadc((int)pti->pt_send, uio); 423 if (error) 424 return (error); 425 if (pti->pt_send & TIOCPKT_IOCTL) { 426 cc = min(uio->uio_resid, 427 sizeof(tp->t_termios)); | 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> --- 377 unchanged lines hidden (view full) --- 420 if (tp->t_state&TS_ISOPEN) { 421 if (pti->pt_flags&PF_PKT && pti->pt_send) { 422 error = ureadc((int)pti->pt_send, uio); 423 if (error) 424 return (error); 425 if (pti->pt_send & TIOCPKT_IOCTL) { 426 cc = min(uio->uio_resid, 427 sizeof(tp->t_termios)); |
428 uiomove((caddr_t)&tp->t_termios, cc, 429 uio); | 428 uiomove(&tp->t_termios, cc, uio); |
430 } 431 pti->pt_send = 0; 432 return (0); 433 } 434 if (pti->pt_flags&PF_UCNTL && pti->pt_ucntl) { 435 error = ureadc((int)pti->pt_ucntl, uio); 436 if (error) 437 return (error); --- 118 unchanged lines hidden (view full) --- 556 if (tp->t_canq.c_cc) 557 goto block; 558 while ((uio->uio_resid > 0 || cc > 0) && 559 tp->t_canq.c_cc < TTYHOG - 1) { 560 if (cc == 0) { 561 cc = min(uio->uio_resid, BUFSIZ); 562 cc = min(cc, TTYHOG - 1 - tp->t_canq.c_cc); 563 cp = locbuf; | 429 } 430 pti->pt_send = 0; 431 return (0); 432 } 433 if (pti->pt_flags&PF_UCNTL && pti->pt_ucntl) { 434 error = ureadc((int)pti->pt_ucntl, uio); 435 if (error) 436 return (error); --- 118 unchanged lines hidden (view full) --- 555 if (tp->t_canq.c_cc) 556 goto block; 557 while ((uio->uio_resid > 0 || cc > 0) && 558 tp->t_canq.c_cc < TTYHOG - 1) { 559 if (cc == 0) { 560 cc = min(uio->uio_resid, BUFSIZ); 561 cc = min(cc, TTYHOG - 1 - tp->t_canq.c_cc); 562 cp = locbuf; |
564 error = uiomove((caddr_t)cp, cc, uio); | 563 error = uiomove(cp, cc, uio); |
565 if (error) 566 return (error); 567 /* check again for safety */ 568 if ((tp->t_state & TS_ISOPEN) == 0) { 569 /* adjust as usual */ 570 uio->uio_resid += cc; 571 return (EIO); 572 } --- 18 unchanged lines hidden (view full) --- 591 ttwakeup(tp); 592 wakeup(TSA_PTS_READ(tp)); 593 return (0); 594 } 595 while (uio->uio_resid > 0 || cc > 0) { 596 if (cc == 0) { 597 cc = min(uio->uio_resid, BUFSIZ); 598 cp = locbuf; | 564 if (error) 565 return (error); 566 /* check again for safety */ 567 if ((tp->t_state & TS_ISOPEN) == 0) { 568 /* adjust as usual */ 569 uio->uio_resid += cc; 570 return (EIO); 571 } --- 18 unchanged lines hidden (view full) --- 590 ttwakeup(tp); 591 wakeup(TSA_PTS_READ(tp)); 592 return (0); 593 } 594 while (uio->uio_resid > 0 || cc > 0) { 595 if (cc == 0) { 596 cc = min(uio->uio_resid, BUFSIZ); 597 cp = locbuf; |
599 error = uiomove((caddr_t)cp, cc, uio); | 598 error = uiomove(cp, cc, uio); |
600 if (error) 601 return (error); 602 /* check again for safety */ 603 if ((tp->t_state & TS_ISOPEN) == 0) { 604 /* adjust for data copied in but not written */ 605 uio->uio_resid += cc; 606 return (EIO); 607 } --- 266 unchanged lines hidden --- | 599 if (error) 600 return (error); 601 /* check again for safety */ 602 if ((tp->t_state & TS_ISOPEN) == 0) { 603 /* adjust for data copied in but not written */ 604 uio->uio_resid += cc; 605 return (EIO); 606 } --- 266 unchanged lines hidden --- |