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

Function tty_ioctl_compat

freebsd/kern/tty_compat.c:182–273  ·  view source on GitHub ↗

ARGSUSED*/

Source from the content-addressed store, hash-verified

180
181/*ARGSUSED*/
182int
183tty_ioctl_compat(struct tty *tp, u_long com, caddr_t data, int fflag,
184 struct thread *td)
185{
186 switch (com) {
187 case TIOCSETP:
188 case TIOCSETN:
189 case TIOCSETC:
190 case TIOCSLTC:
191 case TIOCLBIS:
192 case TIOCLBIC:
193 case TIOCLSET: {
194 struct termios term;
195 int error;
196
197 term = tp->t_termios;
198 if ((error = ttsetcompat(tp, &com, data, &term)) != 0)
199 return error;
200 return tty_ioctl(tp, com, &term, fflag, td);
201 }
202 case TIOCGETP: {
203 struct sgttyb *sg = (struct sgttyb *)data;
204 cc_t *cc = tp->t_termios.c_cc;
205
206 sg->sg_ospeed = ttcompatspeedtab(tp->t_termios.c_ospeed,
207 compatspeeds);
208 if (tp->t_termios.c_ispeed == 0)
209 sg->sg_ispeed = sg->sg_ospeed;
210 else
211 sg->sg_ispeed = ttcompatspeedtab(tp->t_termios.c_ispeed,
212 compatspeeds);
213 sg->sg_erase = cc[VERASE];
214 sg->sg_kill = cc[VKILL];
215 sg->sg_flags = tp->t_compatflags = ttcompatgetflags(tp);
216 break;
217 }
218 case TIOCGETC: {
219 struct tchars *tc = (struct tchars *)data;
220 cc_t *cc = tp->t_termios.c_cc;
221
222 tc->t_intrc = cc[VINTR];
223 tc->t_quitc = cc[VQUIT];
224 tc->t_startc = cc[VSTART];
225 tc->t_stopc = cc[VSTOP];
226 tc->t_eofc = cc[VEOF];
227 tc->t_brkc = cc[VEOL];
228 break;
229 }
230 case TIOCGLTC: {
231 struct ltchars *ltc = (struct ltchars *)data;
232 cc_t *cc = tp->t_termios.c_cc;
233
234 ltc->t_suspc = cc[VSUSP];
235 ltc->t_dsuspc = cc[VDSUSP];
236 ltc->t_rprntc = cc[VREPRINT];
237 ltc->t_flushc = cc[VDISCARD];
238 ltc->t_werasc = cc[VWERASE];
239 ltc->t_lnextc = cc[VLNEXT];

Callers 1

tty_generic_ioctlFunction · 0.85

Calls 5

ttsetcompatFunction · 0.85
tty_ioctlFunction · 0.85
ttcompatspeedtabFunction · 0.85
ttcompatgetflagsFunction · 0.85
printfFunction · 0.70

Tested by

no test coverage detected