Lines Matching refs:tp
75 static int kmoutput(struct tty *tp);
76 static void kmstart(struct tty *tp);
93 struct tty *tp;
101 tp = km_tty[unit];
103 tty_lock(tp);
105 tp->t_oproc = kmstart;
106 tp->t_param = NULL;
107 tp->t_dev = dev;
109 if (!(tp->t_state & TS_ISOPEN)) {
110 tp->t_iflag = TTYDEF_IFLAG;
111 tp->t_oflag = TTYDEF_OFLAG;
112 tp->t_cflag = (CREAD | CS8 | CLOCAL);
113 tp->t_lflag = TTYDEF_LFLAG;
114 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
115 termioschars(&tp->t_termios);
116 ttsetwater(tp);
117 } else if ((tp->t_state & TS_XCLUDE) && proc_suser(pp)) {
122 tp->t_state |= TS_CARR_ON; /* lie and say carrier exists and is on. */
124 ret = ((*linesw[tp->t_line].l_open) (dev, tp));
127 wp = &tp->t_winsize;
135 tty_unlock(tp); /* XXX race window */
143 tty_lock(tp);
155 tty_unlock(tp);
163 struct tty *tp = km_tty[minor(dev)];
165 tty_lock(tp);
166 ret = (*linesw[tp->t_line].l_close) (tp, flag);
167 ttyclose(tp);
168 tty_unlock(tp);
176 struct tty *tp = km_tty[minor(dev)];
178 tty_lock(tp);
179 ret = (*linesw[tp->t_line].l_read) (tp, uio, ioflag);
180 tty_unlock(tp);
188 struct tty *tp = km_tty[minor(dev)];
190 tty_lock(tp);
191 ret = (*linesw[tp->t_line].l_write) (tp, uio, ioflag);
192 tty_unlock(tp);
200 struct tty *tp = km_tty[minor(dev)];
203 tty_lock(tp);
208 *wp = tp->t_winsize;
246 error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag, p);
249 error = ttioctl_locked(tp, cmd, data, flag, p);
253 tty_unlock(tp);
264 * Locks: Assumes tp in the calling tty driver code is locked on
294 * Locks: Assumes tp is locked on entry, remains locked on exit
296 static void kmstart(struct tty *tp)
298 if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
300 if (tp->t_outq.c_cc == 0)
302 tp->t_state |= TS_BUSY;
303 kmoutput(tp);
307 (*linesw[tp->t_line].l_start) (tp);
321 struct tty *tp = (struct tty *) arg;
323 tty_lock(tp);
324 (void) kmoutput(tp);
325 tty_unlock(tp);
331 * Locks: Assumes tp is locked on entry, remains locked on exit
339 static int kmoutput(struct tty *tp)
348 while (tp->t_outq.c_cc > 0) {
349 cc = ndqb(&tp->t_outq, 0);
360 (void) q_to_b(&tp->t_outq, buf, cc);
365 kmputc(tp->t_dev, *cp & 0x7f);
372 if (tp->t_outq.c_cc > 0) {
373 timeout(kmtimeout, tp, hz);
375 tp->t_state &= ~TS_BUSY;
379 (*linesw[tp->t_line].l_start) (tp);
392 * Locks: Assumes that the tty_lock() is NOT held on the tp, so a
400 struct tty *tp = km_tty[0]; /* XXX */
402 tty_lock(tp);
403 (*linesw[tp->t_line].l_rint) (ch, tp);
404 tty_unlock(tp);