MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / ttydev_ioctl

Function ttydev_ioctl

components/lwp/terminal/freebsd/tty.c:568–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566}
567
568static int ttydev_ioctl(struct lwp_tty *tp, rt_ubase_t cmd, rt_caddr_t data, int fflag,
569 struct rt_thread *td)
570{
571 int error;
572
573 error = ttydev_enter(tp);
574 if (error)
575 return (error);
576
577 switch (cmd)
578 {
579 case TIOCCBRK:
580 case TIOCCONS:
581 case TIOCDRAIN:
582 case TIOCEXCL:
583 case TIOCFLUSH:
584 case TIOCNXCL:
585 case TIOCSBRK:
586 case TIOCSCTTY:
587 case TIOCSETA:
588 case TIOCSETAF:
589 case TIOCSETAW:
590 case TIOCSPGRP:
591 case TIOCSTART:
592 case TIOCSTAT:
593 case TIOCSTI:
594 case TIOCSTOP:
595 case TIOCSWINSZ:
596#if USING_BSD_TIOCSDRAINWAIT
597 case TIOCSDRAINWAIT:
598 case TIOCSETD:
599#endif /* USING_BSD_TIOCSDRAINWAIT */
600#ifdef COMPAT_43TTY
601 case TIOCLBIC:
602 case TIOCLBIS:
603 case TIOCLSET:
604 case TIOCSETC:
605 case OTIOCSETD:
606 case TIOCSETN:
607 case TIOCSETP:
608 case TIOCSLTC:
609#endif /* COMPAT_43TTY */
610 /*
611 * If the ioctl() causes the TTY to be modified, let it
612 * wait in the background.
613 */
614 error = tty_wait_background(tp, curthread, SIGTTOU);
615 if (error)
616 goto done;
617 }
618
619#ifdef USING_BSD_INIT_LOCK_DEVICE
620 if (cmd == TIOCSETA || cmd == TIOCSETAW || cmd == TIOCSETAF)
621 {
622 struct termios *old = &tp->t_termios;
623 struct termios *new = (struct termios *)data;
624 struct termios *lock = TTY_CALLOUT(tp, dev) ? &tp->t_termios_lock_out
625 : &tp->t_termios_lock_in;

Callers

nothing calls this directly

Calls 3

ttydev_enterFunction · 0.85
tty_wait_backgroundFunction · 0.85
tty_ioctlFunction · 0.85

Tested by

no test coverage detected