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 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)); |
428 uiomove(&tp->t_termios, cc, uio); |
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; |
563 error = uiomove(cp, cc, uio); |
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; |
598 error = uiomove(cp, cc, uio); |
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 --- |