| 323 | } |
| 324 | |
| 325 | int |
| 326 | ttydisc_read(struct tty *tp, struct uio *uio, int ioflag) |
| 327 | { |
| 328 | int error; |
| 329 | |
| 330 | tty_assert_locked(tp); |
| 331 | |
| 332 | if (uio->uio_resid == 0) |
| 333 | return (0); |
| 334 | |
| 335 | if (CMP_FLAG(l, ICANON)) |
| 336 | error = ttydisc_read_canonical(tp, uio, ioflag); |
| 337 | else if (tp->t_termios.c_cc[VTIME] == 0) |
| 338 | error = ttydisc_read_raw_no_timer(tp, uio, ioflag); |
| 339 | else if (tp->t_termios.c_cc[VMIN] == 0) |
| 340 | error = ttydisc_read_raw_read_timer(tp, uio, ioflag, |
| 341 | uio->uio_resid); |
| 342 | else |
| 343 | error = ttydisc_read_raw_interbyte_timer(tp, uio, ioflag); |
| 344 | |
| 345 | if (ttyinq_bytesleft(&tp->t_inq) >= tp->t_inlow || |
| 346 | ttyinq_bytescanonicalized(&tp->t_inq) == 0) { |
| 347 | /* Unset the input watermark when we've got enough space. */ |
| 348 | tty_hiwat_in_unblock(tp); |
| 349 | } |
| 350 | |
| 351 | return (error); |
| 352 | } |
| 353 | |
| 354 | static __inline unsigned int |
| 355 | ttydisc_findchar(const char *obstart, unsigned int oblen) |
no test coverage detected