| 989 | } |
| 990 | |
| 991 | int ttydisc_rint(struct lwp_tty *tp, char c, int flags) |
| 992 | { |
| 993 | int signal, quote = 0; |
| 994 | char ob[3] = {0xff, 0x00}; |
| 995 | size_t ol; |
| 996 | |
| 997 | tty_assert_locked(tp); |
| 998 | |
| 999 | rt_atomic_add(&tty_nin, 1); |
| 1000 | |
| 1001 | #ifdef USING_BSD_HOOK |
| 1002 | if (ttyhook_hashook(tp, rint)) |
| 1003 | return ttyhook_rint(tp, c, flags); |
| 1004 | #endif |
| 1005 | |
| 1006 | if (tp->t_flags & TF_BYPASS) |
| 1007 | goto processed; |
| 1008 | |
| 1009 | if (flags) |
| 1010 | { |
| 1011 | if (flags & TRE_BREAK) |
| 1012 | { |
| 1013 | if (CMP_FLAG(i, IGNBRK)) |
| 1014 | { |
| 1015 | /* Ignore break characters. */ |
| 1016 | return 0; |
| 1017 | } |
| 1018 | else if (CMP_FLAG(i, BRKINT)) |
| 1019 | { |
| 1020 | /* Generate SIGINT on break. */ |
| 1021 | tty_flush(tp, FREAD | FWRITE); |
| 1022 | lwp_tty_signal_pgrp(tp, SIGINT); |
| 1023 | return 0; |
| 1024 | } |
| 1025 | else |
| 1026 | { |
| 1027 | /* Just print it. */ |
| 1028 | goto parmrk; |
| 1029 | } |
| 1030 | } |
| 1031 | else if (flags & TRE_FRAMING || |
| 1032 | (flags & TRE_PARITY && CMP_FLAG(i, INPCK))) |
| 1033 | { |
| 1034 | if (CMP_FLAG(i, IGNPAR)) |
| 1035 | { |
| 1036 | /* Ignore bad characters. */ |
| 1037 | return 0; |
| 1038 | } |
| 1039 | else |
| 1040 | { |
| 1041 | /* Just print it. */ |
| 1042 | goto parmrk; |
| 1043 | } |
| 1044 | } |
| 1045 | } |
| 1046 | |
| 1047 | /* Allow any character to perform a wakeup. */ |
| 1048 | if (CMP_FLAG(i, IXANY)) |
no test coverage detected