| 338 | } |
| 339 | |
| 340 | int ttydisc_read(struct lwp_tty *tp, struct uio *uio, int ioflag) |
| 341 | { |
| 342 | int error; |
| 343 | |
| 344 | tty_assert_locked(tp); |
| 345 | |
| 346 | if (uio->uio_resid == 0) |
| 347 | return 0; |
| 348 | |
| 349 | if (CMP_FLAG(l, ICANON)) |
| 350 | error = ttydisc_read_canonical(tp, uio, ioflag); |
| 351 | else if (tp->t_termios.c_cc[VTIME] == 0) |
| 352 | error = ttydisc_read_raw_no_timer(tp, uio, ioflag); |
| 353 | else if (tp->t_termios.c_cc[VMIN] == 0) |
| 354 | error = ttydisc_read_raw_read_timer(tp, uio, ioflag, uio->uio_resid); |
| 355 | else |
| 356 | error = ttydisc_read_raw_interbyte_timer(tp, uio, ioflag); |
| 357 | |
| 358 | if (ttyinq_bytesleft(&tp->t_inq) >= tp->t_inlow || |
| 359 | ttyinq_bytescanonicalized(&tp->t_inq) == 0) |
| 360 | { |
| 361 | /* Unset the input watermark when we've got enough space. */ |
| 362 | tty_hiwat_in_unblock(tp); |
| 363 | } |
| 364 | |
| 365 | return error; |
| 366 | } |
| 367 | |
| 368 | /* return the offset to special character from string start */ |
| 369 | rt_inline unsigned int ttydisc_findchar(const char *obstart, unsigned int oblen) |
no test coverage detected