MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ttsetcompat

Function ttsetcompat

freebsd/kern/tty_compat.c:99–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99static int
100ttsetcompat(struct tty *tp, u_long *com, caddr_t data, struct termios *term)
101{
102 switch (*com) {
103 case TIOCSETP:
104 case TIOCSETN: {
105 struct sgttyb *sg = (struct sgttyb *)data;
106 int speed;
107
108 if ((speed = sg->sg_ispeed) > MAX_SPEED || speed < 0)
109 return(EINVAL);
110 else if (speed != ttcompatspeedtab(tp->t_termios.c_ispeed,
111 compatspeeds))
112 term->c_ispeed = compatspcodes[speed];
113 else
114 term->c_ispeed = tp->t_termios.c_ispeed;
115 if ((speed = sg->sg_ospeed) > MAX_SPEED || speed < 0)
116 return(EINVAL);
117 else if (speed != ttcompatspeedtab(tp->t_termios.c_ospeed,
118 compatspeeds))
119 term->c_ospeed = compatspcodes[speed];
120 else
121 term->c_ospeed = tp->t_termios.c_ospeed;
122 term->c_cc[VERASE] = sg->sg_erase;
123 term->c_cc[VKILL] = sg->sg_kill;
124 tp->t_compatflags = (tp->t_compatflags&0xffff0000) |
125 (sg->sg_flags&0xffff);
126 ttcompatsetflags(tp, term);
127 *com = (*com == TIOCSETP) ? TIOCSETAF : TIOCSETA;
128 break;
129 }
130 case TIOCSETC: {
131 struct tchars *tc = (struct tchars *)data;
132 cc_t *cc;
133
134 cc = term->c_cc;
135 cc[VINTR] = tc->t_intrc;
136 cc[VQUIT] = tc->t_quitc;
137 cc[VSTART] = tc->t_startc;
138 cc[VSTOP] = tc->t_stopc;
139 cc[VEOF] = tc->t_eofc;
140 cc[VEOL] = tc->t_brkc;
141 if (tc->t_brkc == (char)_POSIX_VDISABLE)
142 cc[VEOL2] = _POSIX_VDISABLE;
143 *com = TIOCSETA;
144 break;
145 }
146 case TIOCSLTC: {
147 struct ltchars *ltc = (struct ltchars *)data;
148 cc_t *cc;
149
150 cc = term->c_cc;
151 cc[VSUSP] = ltc->t_suspc;
152 cc[VDSUSP] = ltc->t_dsuspc;
153 cc[VREPRINT] = ltc->t_rprntc;
154 cc[VDISCARD] = ltc->t_flushc;
155 cc[VWERASE] = ltc->t_werasc;
156 cc[VLNEXT] = ltc->t_lnextc;

Callers 1

tty_ioctl_compatFunction · 0.85

Calls 4

ttcompatspeedtabFunction · 0.85
ttcompatsetflagsFunction · 0.85
ttcompatgetflagsFunction · 0.85
ttcompatsetlflagsFunction · 0.85

Tested by

no test coverage detected