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

Function ttydisc_read

components/lwp/terminal/freebsd/tty_ttydisc.c:340–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340int 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 */
369rt_inline unsigned int ttydisc_findchar(const char *obstart, unsigned int oblen)

Callers 1

ttydev_readFunction · 0.85

Calls 7

ttydisc_read_canonicalFunction · 0.85
ttyinq_bytesleftFunction · 0.85
tty_hiwat_in_unblockFunction · 0.85

Tested by

no test coverage detected