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.57 1999/05/08 06:39:43 phk Exp $ |
35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42#include "opt_compat.h" --- 626 unchanged lines hidden (view full) --- 669 if ((tp->t_lflag & EXTPROC) && 670 (pti->pt_flags & PF_PKT)) { 671 pti->pt_send |= TIOCPKT_IOCTL; 672 ptcwakeup(tp, FREAD); 673 } 674 tp->t_lflag &= ~EXTPROC; 675 } 676 return(0); |
677 } else if (devsw(dev)->d_open == ptcopen) { |
678 switch (cmd) { 679 680 case TIOCGPGRP: 681 /* 682 * We avoid calling ttioctl on the controller since, 683 * in that case, tp must be the controlling terminal. 684 */ 685 *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0; --- 19 unchanged lines hidden (view full) --- 705 706 case TIOCREMOTE: 707 if (*(int *)data) 708 pti->pt_flags |= PF_REMOTE; 709 else 710 pti->pt_flags &= ~PF_REMOTE; 711 ttyflush(tp, FREAD|FWRITE); 712 return (0); |
713 } |
714 |
715 /* 716 * The rest of the ioctls shouldn't be called until 717 * the slave is open. (Should we return an error?) 718 */ 719 if ((tp->t_state & TS_ISOPEN) == 0) 720 return (0); 721 722 switch (cmd) { |
723#ifdef COMPAT_43 724 case TIOCSETP: 725 case TIOCSETN: 726#endif 727 case TIOCSETD: 728 case TIOCSETA: 729 case TIOCSETAW: 730 case TIOCSETAF: --- 7 unchanged lines hidden (view full) --- 738 if ((tp->t_lflag&NOFLSH) == 0) 739 ttyflush(tp, FREAD|FWRITE); 740 pgsignal(tp->t_pgrp, *(unsigned int *)data, 1); 741 if ((*(unsigned int *)data == SIGINFO) && 742 ((tp->t_lflag&NOKERNINFO) == 0)) 743 ttyinfo(tp); 744 return(0); 745 } |
746 } |
747 error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); 748 if (error == ENOIOCTL) 749 error = ttioctl(tp, cmd, data, flag); 750 if (error == ENOIOCTL) { 751 if (pti->pt_flags & PF_UCNTL && 752 (cmd & ~0xff) == UIOCCMD(0)) { 753 if (cmd & 0xff) { 754 pti->pt_ucntl = (u_char)cmd; --- 87 unchanged lines hidden --- |