Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | cleanups, add ^T prototype, CIGNORE instead of separate ioctls |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
201950c7612e978ff3fdcd4bc7afe517 |
User & Date: | marc 1989-10-26 21:14:28 |
Context
1989-10-27
| ||
07:06 | grant becomes gift check-in: 5bea89666f user: mckusick tags: trunk | |
1989-10-26
| ||
21:14 | cleanups, add ^T prototype, CIGNORE instead of separate ioctls check-in: 201950c761 user: marc tags: trunk | |
18:04 | explain breakpointsbetter check-in: fed2bad9e4 user: torek tags: trunk | |
Changes
Changes to sys/kern/tty.c.
1 2 3 4 5 | /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * | | < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * * @(#)tty.c 7.18 (Berkeley) 10/27/89 */ #include "param.h" #include "systm.h" #include "user.h" #include "ioctl.h" #define TTYDEFCHARS #include "tty.h" #undef TTYDEFCHARS #include "proc.h" #include "file.h" #include "conf.h" #include "dkstat.h" #include "uio.h" #include "kernel.h" #include "vnode.h" |
︙ | ︙ | |||
210 211 212 213 214 215 216 | */ /*ARGSUSED*/ ttioctl(tp, com, data, flag) register struct tty *tp; caddr_t data; { extern int nldisp; | < < > > | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | */ /*ARGSUSED*/ ttioctl(tp, com, data, flag) register struct tty *tp; caddr_t data; { extern int nldisp; int s, error; /* * If the ioctl involves modification, * hang if in the background. */ switch (com) { case TIOCSETD: case TIOCFLUSH: /*case TIOCSPGRP:*/ case TIOCSTI: case TIOCSWINSZ: case TIOCSETA: case TIOCSETAW: case TIOCSETAF: /**** these get removed **** case TIOCSETAS: case TIOCSETAWS: case TIOCSETAFS: /***************************/ while (u.u_procp->p_pgid != tp->t_pgid && tp == u.u_ttyp && u.u_procp->p_pgrp->pg_jobc && (u.u_procp->p_flag&SVFORK) == 0 && !(u.u_procp->p_sigignore & sigmask(SIGTTOU)) && !(u.u_procp->p_sigmask & sigmask(SIGTTOU))) { pgsignal(u.u_procp->p_pgrp, SIGTTOU); |
︙ | ︙ | |||
356 357 358 359 360 361 362 | case TIOCGETA: { struct termios *t = (struct termios *)data; bcopy(&tp->t_termios, t, sizeof(struct termios)); break; } | > > > > > > > | > > | > | | > > > | | > > > > | < | | < < < < | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | case TIOCGETA: { struct termios *t = (struct termios *)data; bcopy(&tp->t_termios, t, sizeof(struct termios)); break; } /*** THIS ALL GETS REMOVED ***/ case JUNK_TIOCSETAS: case JUNK_TIOCSETAWS: case JUNK_TIOCSETAFS: ((struct termios *)data)->c_cflag |= CIGNORE; switch(com) { case JUNK_TIOCSETAS: com = TIOCSETA; break; case JUNK_TIOCSETAWS: com = TIOCSETAW; break; case JUNK_TIOCSETAFS: com = TIOCSETAF; break; } /*******************************/ /*FALLTHROGH*/ case TIOCSETA: case TIOCSETAW: case TIOCSETAF: { register struct termios *t = (struct termios *)data; s = spltty(); if (com == TIOCSETAW || com == TIOCSETAF) { ttywait(tp); if (com == TIOCSETAF); ttyflush(tp, FREAD); } if (!(t->c_cflag&CIGNORE)) { /* * set device hardware */ if (tp->t_param && (error = (*tp->t_param)(tp, t))) { splx(s); return (error); } else { if (!(tp->t_state&TS_CARR_ON) && (tp->t_cflag&CLOCAL) && !(t->c_cflag&CLOCAL)) { tp->t_state &= ~TS_ISOPEN; tp->t_state |= TS_WOPEN; ttwakeup(tp); } tp->t_cflag = t->c_cflag; tp->t_ispeed = t->c_ispeed; tp->t_ospeed = t->c_ospeed; } ttsetwater(tp); } if (com != TIOCSETAF) { if ((t->c_lflag&ICANON) != (tp->t_lflag&ICANON)) if (t->c_lflag&ICANON) { tp->t_lflag |= PENDIN; ttwakeup(tp); } else { struct clist tq; |
︙ | ︙ | |||
428 429 430 431 432 433 434 | /* RETHINK - whether non-session leader * can allocate a new ctty for a session. */ if (u.u_ttyp || (tp->t_session && tp->t_session != p->p_session) || (!tp->t_session && !SESS_LEADER(p))) | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | /* RETHINK - whether non-session leader * can allocate a new ctty for a session. */ if (u.u_ttyp || (tp->t_session && tp->t_session != p->p_session) || (!tp->t_session && !SESS_LEADER(p))) return (EPERM); u.u_ttyp = tp; u.u_ttyd = tp->t_dev; if (tp->t_pgid == 0) tp->t_pgid = p->p_pgrp->pg_id; tp->t_session = p->p_session; break; } |
︙ | ︙ | |||
497 498 499 500 501 502 503 | case TIOCSETC: case TIOCSLTC: case TIOCGLTC: case TIOCLBIS: case TIOCLBIC: case TIOCLSET: case TIOCLGET: | | | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | case TIOCSETC: case TIOCSLTC: case TIOCGLTC: case TIOCLBIS: case TIOCLBIC: case TIOCLSET: case TIOCLGET: case OTIOCGETD: case OTIOCSETD: return(ttcompat(tp, com, data, flag)); #endif default: return (-1); } return (0); |
︙ | ︙ | |||
653 654 655 656 657 658 659 | nullmodem(tp, flag) register struct tty *tp; int flag; { if (flag) tp->t_state |= TS_CARR_ON; | | > > > | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | nullmodem(tp, flag) register struct tty *tp; int flag; { if (flag) tp->t_state |= TS_CARR_ON; else { tp->t_state &= ~TS_CARR_ON; if ((tp->t_lflag & NOHANG) == 0) gsignal(tp->t_pgid, SIGHUP); } return (flag); } /* * reinput pending characters after state switch * call at spltty(). */ |
︙ | ︙ | |||
765 766 767 768 769 770 771 | * case statement is labeled ``endcase'', so goto * it after a case match, or similar. */ /* * Control chars which aren't controlled * by ICANON, ISIG, or IXON. */ | | | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | * case statement is labeled ``endcase'', so goto * it after a case match, or similar. */ /* * Control chars which aren't controlled * by ICANON, ISIG, or IXON. */ if (lflag&IEXTEN) { if (CCEQ(cc[VLNEXT],c)) { if (lflag&ECHO) { if (lflag&ECHOE) ttyout("^\b", tp); else ttyecho(c, tp); } |
︙ | ︙ | |||
807 808 809 810 811 812 813 814 815 816 817 818 819 820 | } if (CCEQ(cc[VSUSP],c)) { if ((lflag&NOFLSH) == 0) ttyflush(tp, FREAD); ttyecho(c, tp); gsignal(tp->t_pgid, SIGTSTP); goto endcase; } } /* * Handle start/stop characters. */ if (iflag&IXON) { if (CCEQ(cc[VSTOP],c)) { | > > > > | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | } if (CCEQ(cc[VSUSP],c)) { if ((lflag&NOFLSH) == 0) ttyflush(tp, FREAD); ttyecho(c, tp); gsignal(tp->t_pgid, SIGTSTP); goto endcase; } if (CCEQ(cc[VINFO],c)) { ttyinfo(tp); goto endcase; } } /* * Handle start/stop characters. */ if (iflag&IXON) { if (CCEQ(cc[VSTOP],c)) { |
︙ | ︙ | |||
867 868 869 870 871 872 873 | /* * From here on down canonical mode character * processing takes place. */ /* * erase (^H / ^?) */ | | | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | /* * From here on down canonical mode character * processing takes place. */ /* * erase (^H / ^?) */ if (CCEQ(cc[VERASE], c)) { if (tp->t_rawq.c_cc) ttyrub(unputc(&tp->t_rawq), tp); goto endcase; } /* * kill (^U) */ |
︙ | ︙ | |||
1526 1527 1528 1529 1530 1531 1532 | } s = spltty(); savecol = tp->t_col; tp->t_state |= TS_CNTTB; tp->t_lflag |= FLUSHO; tp->t_col = tp->t_rocol; cp = tp->t_rawq.c_cf; | > | | 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | } s = spltty(); savecol = tp->t_col; tp->t_state |= TS_CNTTB; tp->t_lflag |= FLUSHO; tp->t_col = tp->t_rocol; cp = tp->t_rawq.c_cf; if (cp) c = *cp; /* XXX FIX NEXTC */ for (; cp; cp = nextc(&tp->t_rawq, cp, &c)) ttyecho(c, tp); tp->t_lflag &= ~FLUSHO; tp->t_state &= ~TS_CNTTB; splx(s); /* * savecol will now be length of the tab |
︙ | ︙ | |||
1685 1686 1687 1688 1689 1690 1691 | register int i; for (i = 0; table[i].sp_speed != -1; i++) if (table[i].sp_speed == speed) return(table[i].sp_code); return(-1); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 | register int i; for (i = 0; table[i].sp_speed != -1; i++) if (table[i].sp_speed == speed) return(table[i].sp_code); return(-1); } /* * (^T) * Report on state of foreground process group. */ ttyinfo(tp) struct tty *tp; { register struct proc *p; struct pgrp *pg = pgfind(tp->t_pgid); if (ttycheckoutq(tp,0) == 0) return; if (pg == NULL) ttyprintf(tp, "kernel: no foreground process group\n"); else if ((p = pg->pg_mem) == NULL) ttyprintf(tp, "kernel: empty process group: %d\n", tp->t_pgid); else { int i = 0; for (; p != NULL; p = p->p_pgrpnxt) { ttyprintf(tp, "kernel: pid: %d state: %x wchan: %x ticks: %d\n", p->p_pid, p->p_stat, p->p_wchan, p->p_cpticks); if (++i > 6) { ttyprintf(tp, "kernel: more...\n"); break; } } } } #define TOTTY 0x2 /* XXX should be in header */ /*VARARGS2*/ ttyprintf(tp, fmt, x1) register struct tty *tp; char *fmt; unsigned x1; { prf(fmt, &x1, TOTTY, tp); } |