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

Function ttydisc_rint

freebsd/kern/tty_ttydisc.c:854–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

852}
853
854int
855ttydisc_rint(struct tty *tp, char c, int flags)
856{
857 int signal, quote = 0;
858 char ob[3] = { 0xff, 0x00 };
859 size_t ol;
860
861 tty_assert_locked(tp);
862
863 atomic_add_long(&tty_nin, 1);
864
865 if (ttyhook_hashook(tp, rint))
866 return ttyhook_rint(tp, c, flags);
867
868 if (tp->t_flags & TF_BYPASS)
869 goto processed;
870
871 if (flags) {
872 if (flags & TRE_BREAK) {
873 if (CMP_FLAG(i, IGNBRK)) {
874 /* Ignore break characters. */
875 return (0);
876 } else if (CMP_FLAG(i, BRKINT)) {
877 /* Generate SIGINT on break. */
878 tty_flush(tp, FREAD|FWRITE);
879 tty_signal_pgrp(tp, SIGINT);
880 return (0);
881 } else {
882 /* Just print it. */
883 goto parmrk;
884 }
885 } else if (flags & TRE_FRAMING ||
886 (flags & TRE_PARITY && CMP_FLAG(i, INPCK))) {
887 if (CMP_FLAG(i, IGNPAR)) {
888 /* Ignore bad characters. */
889 return (0);
890 } else {
891 /* Just print it. */
892 goto parmrk;
893 }
894 }
895 }
896
897 /* Allow any character to perform a wakeup. */
898 if (CMP_FLAG(i, IXANY)) {
899 tp->t_flags &= ~TF_STOPPED;
900 tp->t_termios.c_lflag &= ~FLUSHO;
901 }
902
903 /* Remove the top bit. */
904 if (CMP_FLAG(i, ISTRIP))
905 c &= ~0x80;
906
907 /* Skip input processing when we want to print it literally. */
908 if (tp->t_flags & TF_LITERAL) {
909 tp->t_flags &= ~TF_LITERAL;
910 quote = 1;
911 goto processed;

Callers 4

ttydisc_rint_simpleFunction · 0.85
tty_generic_ioctlFunction · 0.85
terminal_input_charFunction · 0.85
terminal_input_rawFunction · 0.85

Calls 13

atomic_add_longFunction · 0.85
ttyhook_rintFunction · 0.85
tty_flushFunction · 0.85
tty_signal_pgrpFunction · 0.85
ttyoutq_write_nofragFunction · 0.85
ttydisc_echoFunction · 0.85
ttydisc_reprintFunction · 0.85
ttydisc_rubcharFunction · 0.85
ttydisc_rubwordFunction · 0.85
ttyinq_write_nofragFunction · 0.85
tty_hiwat_in_blockFunction · 0.85

Tested by

no test coverage detected