Lines Matching +full:modem +full:- +full:init
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
130 if (tp->t_termios.c_cflag & CREAD)
131 bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX);
132 error = ttyinq_setsize(&tp->t_inq, tp, bs);
137 tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10;
140 bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX);
141 error = ttyoutq_setsize(&tp->t_outq, tp, bs);
146 tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10;
169 else if (tp->t_drainwait != 0)
170 timeout_at = getsbinuptime() + SBT_1S * tp->t_drainwait;
183 bytes = ttyoutq_bytesused(&tp->t_outq);
185 if (ttyoutq_bytesused(&tp->t_outq) == 0 && !ttydevsw_busy(tp))
190 error = tty_timedwait(tp, &tp->t_outwait, hz / 10);
195 else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) {
199 bytes = ttyoutq_bytesused(&tp->t_outq);
209 * and ttydev_close() to determine whether per-TTY data should be
234 if (tty_opened(tp) || tp->t_flags & TF_OPENCLOSE) {
240 tp->t_flags |= TF_OPENCLOSE;
252 ttyinq_free(&tp->t_inq);
253 tp->t_inlow = 0;
254 ttyoutq_free(&tp->t_outq);
255 tp->t_outlow = 0;
260 tp->t_flags &= ~TF_OPENCLOSE;
261 cv_broadcast(&tp->t_dcdwait);
275 tp = dev->si_drv1;
288 while (tp->t_flags & TF_OPENCLOSE) {
289 error = tty_wait(tp, &tp->t_dcdwait);
295 tp->t_flags |= TF_OPENCLOSE;
302 if (tp->t_flags & (TF_OPENED_CONS | TF_OPENED_IN)) {
307 if (tp->t_flags & TF_OPENED_OUT) {
313 if (tp->t_flags & TF_EXCLUDE && priv_check(td, PRIV_TTY_EXCLUSIVE)) {
321 tp->t_termios = tp->t_termios_init_out;
323 tp->t_termios = tp->t_termios_init_in;
324 ttydevsw_param(tp, &tp->t_termios);
325 /* Prevent modem control on callout devices and /dev/console. */
327 tp->t_termios.c_cflag |= CLOCAL;
329 if ((tp->t_termios.c_cflag & CNO_RTSDTR) == 0)
344 (tp->t_termios.c_cflag & CLOCAL) == 0) {
346 error = tty_wait(tp, &tp->t_dcdwait);
353 tp->t_flags |= TF_OPENED_CONS;
355 tp->t_flags |= TF_OPENED_OUT;
357 tp->t_flags |= TF_OPENED_IN;
358 MPASS((tp->t_flags & (TF_OPENED_CONS | TF_OPENED_IN)) == 0 ||
359 (tp->t_flags & TF_OPENED_OUT) == 0);
361 done: tp->t_flags &= ~TF_OPENCLOSE;
362 cv_broadcast(&tp->t_dcdwait);
372 struct tty *tp = dev->si_drv1;
380 MPASS((tp->t_flags & (TF_OPENED_CONS | TF_OPENED_IN)) == 0 ||
381 (tp->t_flags & TF_OPENED_OUT) == 0);
383 tp->t_flags &= ~TF_OPENED_CONS;
385 tp->t_flags &= ~(TF_OPENED_IN|TF_OPENED_OUT);
387 if (tp->t_flags & TF_OPENED) {
395 knlist_delete(&tp->t_inpoll.si_note, td, 1);
396 knlist_delete(&tp->t_outpoll.si_note, td, 1);
399 tp->t_flags &= ~TF_EXCLUDE;
401 /* Properly wake up threads that are stuck - revoke(). */
402 tp->t_revokecnt++;
404 cv_broadcast(&tp->t_bgwait);
405 cv_broadcast(&tp->t_dcdwait);
418 return (p->p_session == tp->t_session && p->p_flag & P_CONTROLT);
432 p = td->td_proc;
434 pg = p->p_pgrp;
440 * Re-check after locking.
442 if (p->p_pgrp != pg) {
450 * - This terminal is the controlling terminal
451 * - Its process group is not the foreground process
453 * - The parent process isn't waiting for the child to
455 * - the signal to send to the process isn't masked
457 if (!tty_is_ctty(tp, p) || p->p_pgrp == tp->t_pgrp) {
464 if (SIGISMEMBER(p->p_sigacts->ps_sigignore, sig) ||
465 SIGISMEMBER(td->td_sigmask, sig)) {
472 if ((p->p_flag & P_PPWAIT) != 0 ||
473 (pg->pg_flags & PGRP_ORPHANED) != 0) {
495 error = tty_wait(tp, &tp->t_bgwait);
504 struct tty *tp = dev->si_drv1;
525 struct tty *tp = dev->si_drv1;
532 if (tp->t_termios.c_lflag & TOSTOP) {
538 if (ioflag & IO_NDELAY && tp->t_flags & TF_BUSY_OUT) {
539 /* Allow non-blocking writes to bypass serialization. */
543 while (tp->t_flags & TF_BUSY_OUT) {
544 error = tty_wait(tp, &tp->t_outserwait);
549 tp->t_flags |= TF_BUSY_OUT;
553 tp->t_flags &= ~TF_BUSY_OUT;
554 cv_signal(&tp->t_outserwait);
565 struct tty *tp = dev->si_drv1;
614 struct termios *old = &tp->t_termios;
617 &tp->t_termios_lock_out : &tp->t_termios_lock_in;
624 new->c_iflag = (old->c_iflag & lock->c_iflag) |
625 (new->c_iflag & ~lock->c_iflag);
626 new->c_oflag = (old->c_oflag & lock->c_oflag) |
627 (new->c_oflag & ~lock->c_oflag);
628 new->c_cflag = (old->c_cflag & lock->c_cflag) |
629 (new->c_cflag & ~lock->c_cflag);
630 new->c_lflag = (old->c_lflag & lock->c_lflag) |
631 (new->c_lflag & ~lock->c_lflag);
633 if (lock->c_cc[cc])
634 new->c_cc[cc] = old->c_cc[cc];
635 if (lock->c_ispeed)
636 new->c_ispeed = old->c_ispeed;
637 if (lock->c_ospeed)
638 new->c_ospeed = old->c_ospeed;
650 struct tty *tp = dev->si_drv1;
663 if (tp->t_flags & TF_ZOMBIE) {
674 selrecord(td, &tp->t_inpoll);
676 selrecord(td, &tp->t_outpoll);
688 struct tty *tp = dev->si_drv1;
695 return (-1);
709 struct tty *tp = kn->kn_hook;
711 knlist_remove(&tp->t_inpoll.si_note, kn, 0);
717 struct tty *tp = kn->kn_hook;
721 if (tty_gone(tp) || tp->t_flags & TF_ZOMBIE) {
722 kn->kn_flags |= EV_EOF;
725 kn->kn_data = ttydisc_read_poll(tp);
726 return (kn->kn_data > 0);
733 struct tty *tp = kn->kn_hook;
735 knlist_remove(&tp->t_outpoll.si_note, kn, 0);
741 struct tty *tp = kn->kn_hook;
746 kn->kn_flags |= EV_EOF;
749 kn->kn_data = ttydisc_write_poll(tp);
750 return (kn->kn_data > 0);
769 struct tty *tp = dev->si_drv1;
776 switch (kn->kn_filter) {
778 kn->kn_hook = tp;
779 kn->kn_fop = &tty_kqops_read;
780 knlist_add(&tp->t_inpoll.si_note, kn, 1);
783 kn->kn_hook = tp;
784 kn->kn_fop = &tty_kqops_write;
785 knlist_add(&tp->t_outpoll.si_note, kn, 1);
811 * Init/lock-state devices
821 tp = dev->si_drv1;
851 struct tty *tp = dev->si_drv1;
868 *(struct termios*)data = *(struct termios*)dev->si_drv2;
875 *(struct termios*)dev->si_drv2 = *(struct termios*)data;
905 struct termios *t = &tp->t_termios_init_in;
907 t->c_cflag = TTYDEF_CFLAG;
908 t->c_iflag = TTYDEF_IFLAG;
909 t->c_lflag = TTYDEF_LFLAG;
910 t->c_oflag = TTYDEF_OFLAG;
911 t->c_ispeed = TTYDEF_SPEED;
912 t->c_ospeed = TTYDEF_SPEED;
913 memcpy(&t->c_cc, ttydefchars, sizeof ttydefchars);
915 tp->t_termios_init_out = *t;
921 struct termios *ti = &tp->t_termios_init_in;
922 struct termios *to = &tp->t_termios_init_out;
925 ti->c_ispeed = ti->c_ospeed = s;
926 to->c_ispeed = to->c_ospeed = s;
929 ti->c_cflag |= CLOCAL;
930 to->c_cflag |= CLOCAL;
935 * pseudo-terminal device drivers. When a driver creates a new terminal
986 * Allow the baud rate to be adjusted for pseudo-devices, but at
990 if (t->c_ispeed < B50)
991 t->c_ispeed = B50;
992 else if (t->c_ispeed > B115200)
993 t->c_ispeed = B115200;
994 if (t->c_ospeed < B50)
995 t->c_ospeed = B50;
996 else if (t->c_ospeed > B115200)
997 t->c_ospeed = B115200;
998 t->c_cflag |= CREAD;
1018 return (-1);
1031 panic("Terminal device freed without a free-handler");
1061 if (tsw->tsw_ ## x == NULL) \
1062 tsw->tsw_ ## x = ttydevsw_def ## x; \
1071 PATCH_FUNC(modem);
1080 tp->t_prbufsz = TTY_PRBUF_SIZE;
1081 tp->t_devsw = tsw;
1082 tp->t_devswsoftc = sc;
1083 tp->t_flags = tsw->tsw_flags;
1084 tp->t_drainwait = tty_drainwait;
1088 cv_init(&tp->t_inwait, "ttyin");
1089 cv_init(&tp->t_outwait, "ttyout");
1090 cv_init(&tp->t_outserwait, "ttyosr");
1091 cv_init(&tp->t_bgwait, "ttybg");
1092 cv_init(&tp->t_dcdwait, "ttydcd");
1096 tp->t_mtx = mutex;
1098 tp->t_mtx = &tp->t_mtxobj;
1099 mtx_init(&tp->t_mtxobj, "ttymtx", NULL, MTX_DEF);
1102 knlist_init_mtx(&tp->t_inpoll.si_note, tp->t_mtx);
1103 knlist_init_mtx(&tp->t_outpoll.si_note, tp->t_mtx);
1120 ttyinq_free(&tp->t_inq);
1121 ttyoutq_free(&tp->t_outq);
1122 seldrain(&tp->t_inpoll);
1123 seldrain(&tp->t_outpoll);
1124 knlist_clear(&tp->t_inpoll.si_note, 0);
1125 knlist_clear(&tp->t_outpoll.si_note, 0);
1126 knlist_destroy(&tp->t_inpoll.si_note);
1127 knlist_destroy(&tp->t_outpoll.si_note);
1129 cv_destroy(&tp->t_inwait);
1130 cv_destroy(&tp->t_outwait);
1131 cv_destroy(&tp->t_bgwait);
1132 cv_destroy(&tp->t_dcdwait);
1133 cv_destroy(&tp->t_outserwait);
1135 if (tp->t_mtx == &tp->t_mtxobj)
1136 mtx_destroy(&tp->t_mtxobj);
1149 if (tp->t_sessioncnt != 0 || (tp->t_flags & TF_ACTIVITY) != TF_GONE) {
1156 funsetown(&tp->t_sigio);
1159 dev = tp->t_dev;
1160 tp->t_dev = NULL;
1166 tty_list_count--;
1176 MPASS(tp->t_sessioncnt > 0);
1179 if (tp->t_pgrp == pg)
1180 tp->t_pgrp = NULL;
1189 MPASS(tp->t_sessioncnt > 0);
1192 if (tp->t_session == sess) {
1193 tp->t_session = NULL;
1194 MPASS(tp->t_pgrp == NULL);
1196 tp->t_sessioncnt--;
1212 cv_broadcast(&tp->t_bgwait);
1213 cv_broadcast(&tp->t_dcdwait);
1215 tp->t_flags |= TF_GONE;
1230 * for this particular operation to happen out-of-order in a
1231 * multithreaded scenario is likely a non-issue.
1246 session = p->p_session;
1247 if (session->s_ttyp == NULL || session->s_ttyp != tp) {
1259 vp = session->s_ttyvp;
1260 session->s_ttyp = NULL;
1261 session->s_ttyvp = NULL;
1262 session->s_ttydp = NULL;
1265 tp->t_sessioncnt--;
1266 p->p_flag &= ~P_CONTROLT;
1275 * to avoid a vnode leak -- in circumstances elsewhere where we'd hit a
1295 xt->xt_size = sizeof(struct xtty);
1296 xt->xt_insize = ttyinq_getsize(&tp->t_inq);
1297 xt->xt_incc = ttyinq_bytescanonicalized(&tp->t_inq);
1298 xt->xt_inlc = ttyinq_bytesline(&tp->t_inq);
1299 xt->xt_inlow = tp->t_inlow;
1300 xt->xt_outsize = ttyoutq_getsize(&tp->t_outq);
1301 xt->xt_outcc = ttyoutq_bytesused(&tp->t_outq);
1302 xt->xt_outlow = tp->t_outlow;
1303 xt->xt_column = tp->t_column;
1304 xt->xt_pgid = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
1305 xt->xt_sid = tp->t_session ? tp->t_session->s_sid : 0;
1306 xt->xt_flags = tp->t_flags;
1307 xt->xt_dev = tp->t_dev ? dev2udev(tp->t_dev) : (uint32_t)NODEV;
1332 if (tp->t_session != NULL &&
1333 (p = atomic_load_ptr(&tp->t_session->s_leader)) != NULL) {
1338 cansee = !jailed(td->td_ucred);
1348 lsize = (xt - xtlist) * sizeof(struct xtty);
1372 struct cdev *dev, *init, *lock, *cua, *cinit, *clock;
1374 char name[SPECNAMELEN - 3]; /* for "tty" and "cua". */
1381 if (tp->t_flags & TF_NOPREFIX)
1395 uid = cred->cr_ruid;
1403 /* Master call-in device. */
1415 tp->t_dev = dev;
1417 init = lock = cua = cinit = clock = NULL;
1419 /* Slave call-in devices. */
1420 if (tp->t_flags & TF_INITLOCK) {
1424 args.mda_si_drv2 = &tp->t_termios_init_in;
1425 error = make_dev_s(&args, &init, "%s%s.init", prefix, name);
1428 dev_depends(dev, init);
1431 args.mda_si_drv2 = &tp->t_termios_lock_in;
1438 /* Call-out devices. */
1439 if (tp->t_flags & TF_CALLOUT) {
1454 /* Slave call-out devices. */
1455 if (tp->t_flags & TF_INITLOCK) {
1458 args.mda_si_drv2 = &tp->t_termios_init_out;
1459 error = make_dev_s(&args, &cinit, "cua%s.init", name);
1465 args.mda_si_drv2 = &tp->t_termios_lock_out;
1482 if (init)
1483 destroy_dev(init);
1508 tp->t_flags &= ~TF_STOPPED;
1509 tp->t_termios.c_lflag &= ~FLUSHO;
1517 if ((s = tp->t_session) != NULL &&
1518 (p = atomic_load_ptr(&s->s_leader)) != NULL) {
1534 tp->t_flags &= ~TF_STOPPED;
1535 tp->t_termios.c_lflag &= ~FLUSHO;
1537 if (sig == SIGINFO && !(tp->t_termios.c_lflag & NOKERNINFO))
1539 if (tp->t_pgrp != NULL) {
1543 PGRP_LOCK(tp->t_pgrp);
1544 pgsignal(tp->t_pgrp, sig, 1, &ksi);
1545 PGRP_UNLOCK(tp->t_pgrp);
1553 if (tp->t_flags & TF_ASYNC && tp->t_sigio != NULL)
1554 pgsigio(&tp->t_sigio, SIGIO, (tp->t_session != NULL));
1557 cv_broadcast(&tp->t_outwait);
1558 selwakeup(&tp->t_outpoll);
1559 KNOTE_LOCKED(&tp->t_outpoll.si_note, 0);
1562 cv_broadcast(&tp->t_inwait);
1563 selwakeup(&tp->t_inpoll);
1564 KNOTE_LOCKED(&tp->t_inpoll.si_note, 0);
1572 int revokecnt = tp->t_revokecnt;
1577 error = cv_wait_sig(cv, tp->t_mtx);
1584 if (tp->t_revokecnt != revokecnt)
1594 int revokecnt = tp->t_revokecnt;
1599 error = cv_timedwait_sig(cv, tp->t_mtx, hz);
1606 if (tp->t_revokecnt != revokecnt)
1617 tp->t_flags &= ~TF_HIWAT_OUT;
1618 ttyoutq_flush(&tp->t_outq);
1627 ttyinq_flush(&tp->t_inq);
1640 if (memcmp(&tp->t_winsize, wsz, sizeof(*wsz)) == 0)
1642 tp->t_winsize = *wsz;
1654 * Modem commands.
1687 tp->t_flags |= TF_ASYNC;
1689 tp->t_flags &= ~TF_ASYNC;
1692 /* This device supports non-blocking operation. */
1699 *(int *)data = ttyoutq_bytesused(&tp->t_outq);
1702 if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc))
1708 error = fsetown(*(int *)data, &tp->t_sigio);
1712 if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc))
1717 *(int *)data = fgetown(&tp->t_sigio);
1721 *(struct termios*)data = tp->t_termios;
1734 if (t->c_ispeed == 0)
1735 t->c_ispeed = t->c_ospeed;
1738 t->c_iflag &= TTYSUP_IFLAG;
1739 t->c_oflag &= TTYSUP_OFLAG;
1740 t->c_lflag &= TTYSUP_LFLAG;
1741 t->c_cflag &= TTYSUP_CFLAG;
1755 if ((t->c_cflag & CIGNORE) == 0 &&
1756 (tp->t_termios.c_cflag != t->c_cflag ||
1757 ((tp->t_termios.c_iflag ^ t->c_iflag) &
1759 tp->t_termios.c_ispeed != t->c_ispeed ||
1760 tp->t_termios.c_ospeed != t->c_ospeed)) {
1767 tp->t_termios.c_cflag = t->c_cflag & ~CIGNORE;
1768 tp->t_termios.c_ispeed = t->c_ispeed;
1769 tp->t_termios.c_ospeed = t->c_ospeed;
1771 /* Baud rate has changed - update watermarks. */
1779 * ICANON one way or the other. If we're going from -ICANON ->
1784 if ((t->c_lflag & ICANON) != (tp->t_termios.c_lflag & ICANON))
1786 else if (tp->t_termios.c_cc[VEOF] != t->c_cc[VEOF] ||
1787 tp->t_termios.c_cc[VEOL] != t->c_cc[VEOL])
1790 /* Copy new non-device driver parameters. */
1791 tp->t_termios.c_iflag = t->c_iflag;
1792 tp->t_termios.c_oflag = t->c_oflag;
1793 tp->t_termios.c_lflag = t->c_lflag;
1794 memcpy(&tp->t_termios.c_cc, t->c_cc, sizeof t->c_cc);
1800 if ((t->c_lflag & ICANON) == 0) {
1802 * When in non-canonical mode, wake up all
1814 if (tp->t_termios.c_iflag & IXON &&
1815 tp->t_termios.c_cc[VSTOP] == CTRL('S') &&
1816 tp->t_termios.c_cc[VSTART] == CTRL('Q'))
1823 /* For compatibility - we only support TTYDISC. */
1827 if (!tty_is_ctty(tp, td->td_proc))
1830 if (tp->t_pgrp != NULL)
1831 *(int *)data = tp->t_pgrp->pg_id;
1836 if (!tty_is_ctty(tp, td->td_proc))
1839 MPASS(tp->t_session);
1840 *(int *)data = tp->t_session->s_sid;
1843 return (tty_drop_ctty(tp, td->td_proc));
1845 struct proc *p = td->td_proc;
1858 if (tp->t_session != NULL && tp->t_session == p->p_session) {
1864 if (p->p_session->s_ttyp != NULL ||
1865 (tp->t_session != NULL && tp->t_session->s_ttyvp != NULL &&
1866 tp->t_session->s_ttyvp->v_type != VBAD)) {
1883 tp->t_session = p->p_session;
1884 tp->t_session->s_ttyp = tp;
1885 tp->t_sessioncnt++;
1888 tp->t_pgrp = p->p_pgrp;
1890 p->p_flag |= P_CONTROLT;
1909 if (pg == NULL || pg->pg_session != td->td_proc->p_session) {
1920 if (!tty_is_ctty(tp, td->td_proc)) {
1924 tp->t_pgrp = pg;
1928 cv_broadcast(&tp->t_bgwait);
1945 *(int *)data = tp->t_drainwait;
1950 tp->t_drainwait = *(int *)data;
1965 *(struct winsize*)data = tp->t_winsize;
1972 tp->t_flags |= TF_EXCLUDE;
1975 tp->t_flags &= ~TF_EXCLUDE;
1978 tp->t_flags |= TF_STOPPED;
1982 tp->t_flags &= ~TF_STOPPED;
1983 tp->t_termios.c_lflag &= ~FLUSHO;
1993 if (!tty_is_ctty(tp, td->td_proc) &&
2029 if (tp->t_dev)
2030 return (dev2udev(tp->t_dev));
2040 return (ttyoutq_bytesleft(&tp->t_outq) >= 256);
2047 if ((tp->t_flags & TF_HIWAT_IN) == 0 &&
2048 tp->t_termios.c_iflag & IXOFF &&
2049 tp->t_termios.c_cc[VSTOP] != _POSIX_VDISABLE) {
2054 if (ttyoutq_write_nofrag(&tp->t_outq,
2055 &tp->t_termios.c_cc[VSTOP], 1) == 0)
2056 tp->t_flags |= TF_HIWAT_IN;
2059 tp->t_flags |= TF_HIWAT_IN;
2067 if (tp->t_flags & TF_HIWAT_IN &&
2068 tp->t_termios.c_iflag & IXOFF &&
2069 tp->t_termios.c_cc[VSTART] != _POSIX_VDISABLE) {
2074 if (ttyoutq_write_nofrag(&tp->t_outq,
2075 &tp->t_termios.c_cc[VSTART], 1) == 0)
2076 tp->t_flags &= ~TF_HIWAT_IN;
2079 tp->t_flags &= ~TF_HIWAT_IN;
2095 return (-1);
2118 fdp = p->p_fd;
2127 if (fp->f_ops == &badfileops) {
2138 if (fp->f_type != DTYPE_VNODE || fp->f_vnode->v_type != VCHR) {
2144 cdp = devvn_refthread(fp->f_vnode, &dev, &ref);
2149 if (dev != fp->f_data) {
2157 tp = dev->si_drv1;
2162 MPASS((tp->t_hook == NULL) == ((tp->t_flags & TF_HOOK) == 0));
2163 if (tp->t_flags & TF_HOOK)
2166 tp->t_flags |= TF_HOOK;
2167 tp->t_hook = th;
2168 tp->t_hooksoftc = softc;
2177 th->th_rint = ttyhook_defrint;
2190 MPASS(tp->t_flags & TF_HOOK);
2193 tp->t_flags &= ~TF_HOOK;
2194 tp->t_hook = NULL;
2220 dev_console->si_drv1 = tp;
2227 if (dev_console->si_drv1 == NULL)
2297 /* Keep these together -> 'Oi' and 'Oo'. */
2308 /* Keep these together -> 'Hi' and 'Ho'. */
2319 /* Keep these together -> 'bi' and 'bo'. */
2346 DB_PRINTSYM(open, tsw->tsw_open);
2347 DB_PRINTSYM(close, tsw->tsw_close);
2348 DB_PRINTSYM(outwakeup, tsw->tsw_outwakeup);
2349 DB_PRINTSYM(inwakeup, tsw->tsw_inwakeup);
2350 DB_PRINTSYM(ioctl, tsw->tsw_ioctl);
2351 DB_PRINTSYM(param, tsw->tsw_param);
2352 DB_PRINTSYM(modem, tsw->tsw_modem);
2353 DB_PRINTSYM(mmap, tsw->tsw_mmap);
2354 DB_PRINTSYM(pktnotify, tsw->tsw_pktnotify);
2355 DB_PRINTSYM(free, tsw->tsw_free);
2367 DB_PRINTSYM(rint, th->th_rint);
2368 DB_PRINTSYM(rint_bypass, th->th_rint_bypass);
2369 DB_PRINTSYM(rint_done, th->th_rint_done);
2370 DB_PRINTSYM(rint_poll, th->th_rint_poll);
2371 DB_PRINTSYM(getc_inject, th->th_getc_inject);
2372 DB_PRINTSYM(getc_capture, th->th_getc_capture);
2373 DB_PRINTSYM(getc_poll, th->th_getc_poll);
2374 DB_PRINTSYM(close, th->th_close);
2383 t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag,
2384 t->c_ispeed, t->c_ospeed);
2399 db_printf("\tmtx: %p\n", tp->t_mtx);
2400 db_printf("\tflags: 0x%b\n", tp->t_flags, TTY_FLAG_BITS);
2401 db_printf("\trevokecnt: %u\n", tp->t_revokecnt);
2405 "nblocks %u quota %u\n", &tp->t_inq, tp->t_inq.ti_begin,
2406 tp->t_inq.ti_linestart, tp->t_inq.ti_reprint, tp->t_inq.ti_end,
2407 tp->t_inq.ti_nblocks, tp->t_inq.ti_quota);
2409 &tp->t_outq, tp->t_outq.to_begin, tp->t_outq.to_end,
2410 tp->t_outq.to_nblocks, tp->t_outq.to_quota);
2411 db_printf("\tinlow: %zu\n", tp->t_inlow);
2412 db_printf("\toutlow: %zu\n", tp->t_outlow);
2413 _db_show_termios("\ttermios", &tp->t_termios);
2415 tp->t_winsize.ws_row, tp->t_winsize.ws_col,
2416 tp->t_winsize.ws_xpixel, tp->t_winsize.ws_ypixel);
2417 db_printf("\tcolumn: %u\n", tp->t_column);
2418 db_printf("\twritepos: %u\n", tp->t_writepos);
2419 db_printf("\tcompatflags: 0x%x\n", tp->t_compatflags);
2421 /* Init/lock-state devices. */
2422 _db_show_termios("\ttermios_init_in", &tp->t_termios_init_in);
2423 _db_show_termios("\ttermios_init_out", &tp->t_termios_init_out);
2424 _db_show_termios("\ttermios_lock_in", &tp->t_termios_lock_in);
2425 _db_show_termios("\ttermios_lock_out", &tp->t_termios_lock_out);
2428 _db_show_devsw("\t", tp->t_devsw);
2429 _db_show_hooks("\t", tp->t_hook);
2432 db_printf("\tpgrp: %p gid %d\n", tp->t_pgrp,
2433 tp->t_pgrp ? tp->t_pgrp->pg_id : 0);
2434 db_printf("\tsession: %p", tp->t_session);
2435 if (tp->t_session != NULL)
2437 tp->t_session->s_count, tp->t_session->s_leader,
2438 tp->t_session->s_ttyp, tp->t_session->s_sid,
2439 tp->t_session->s_login);
2441 db_printf("\tsessioncnt: %u\n", tp->t_sessioncnt);
2442 db_printf("\tdevswsoftc: %p\n", tp->t_devswsoftc);
2443 db_printf("\thooksoftc: %p\n", tp->t_hooksoftc);
2444 db_printf("\tdev: %p\n", tp->t_dev);
2454 /* Make the output look like `pstat -t'. */
2463 isiz = tp->t_inq.ti_nblocks * TTYINQ_DATASIZE;
2464 osiz = tp->t_outq.to_nblocks * TTYOUTQ_DATASIZE;
2468 tp->t_inq.ti_linestart - tp->t_inq.ti_begin,
2469 tp->t_inq.ti_end - tp->t_inq.ti_linestart,
2470 isiz - tp->t_inlow, osiz,
2471 tp->t_outq.to_end - tp->t_outq.to_begin,
2472 osiz - tp->t_outlow, MIN(tp->t_column, 99999),
2473 tp->t_session ? tp->t_session->s_sid : 0,
2474 tp->t_pgrp ? tp->t_pgrp->pg_id : 0);
2478 if (tp->t_flags & ttystates[i].flag) {
2483 db_printf("-");