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 --- 20 unchanged lines hidden (view full) --- 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 */ 35 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 125839 2004-02-15 00:43:22Z rwatson $"); |
38 39/* 40 * Pseudo-teletype Driver 41 * (Actually two drivers, requiring two entries in 'cdevsw') 42 */ 43#include "opt_compat.h" 44#include "opt_tty.h" 45#include <sys/param.h> --- 131 unchanged lines hidden (view full) --- 177 tp = dev->si_tty; 178 if ((tp->t_state & TS_ISOPEN) == 0) { 179 ttychars(tp); /* Set up default chars */ 180 tp->t_iflag = TTYDEF_IFLAG; 181 tp->t_oflag = TTYDEF_OFLAG; 182 tp->t_lflag = TTYDEF_LFLAG; 183 tp->t_cflag = TTYDEF_CFLAG; 184 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; |
185 } else if (tp->t_state & TS_XCLUDE && suser(td)) |
186 return (EBUSY); |
187 else if (pti->pt_prison != td->td_ucred->cr_prison) |
188 return (EBUSY); |
189 if (tp->t_oproc) /* Ctrlr still around. */ 190 (void)(*linesw[tp->t_line].l_modem)(tp, 1); 191 while ((tp->t_state & TS_CARR_ON) == 0) { 192 if (flag&FNONBLOCK) 193 break; 194 error = ttysleep(tp, TSA_CARR_ON(tp), TTIPRI | PCATCH, 195 "ptsopn", 0); 196 if (error) --- 672 unchanged lines hidden --- |