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

Function ttydisc_read_raw_no_timer

freebsd/kern/tty_ttydisc.c:183–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183static int
184ttydisc_read_raw_no_timer(struct tty *tp, struct uio *uio, int ioflag)
185{
186 size_t vmin = tp->t_termios.c_cc[VMIN];
187 ssize_t oresid = uio->uio_resid;
188 int error;
189
190 MPASS(tp->t_termios.c_cc[VTIME] == 0);
191
192 /*
193 * This routine implements the easy cases of read()s while in
194 * non-canonical mode, namely case B and D, where we don't have
195 * any timers at all.
196 */
197
198 for (;;) {
199 error = tty_wait_background(tp, curthread, SIGTTIN);
200 if (error)
201 return (error);
202
203 error = ttyinq_read_uio(&tp->t_inq, tp, uio,
204 uio->uio_resid, 0);
205 if (error)
206 return (error);
207 if (uio->uio_resid == 0 || (oresid - uio->uio_resid) >= vmin)
208 return (0);
209
210 /* We have to wait for more. */
211 if (tp->t_flags & TF_ZOMBIE)
212 return (0);
213 else if (ioflag & IO_NDELAY)
214 return (EWOULDBLOCK);
215
216 error = tty_wait(tp, &tp->t_inwait);
217 if (error)
218 return (error);
219 }
220}
221
222static int
223ttydisc_read_raw_read_timer(struct tty *tp, struct uio *uio, int ioflag,

Callers 1

ttydisc_readFunction · 0.85

Calls 3

tty_wait_backgroundFunction · 0.85
ttyinq_read_uioFunction · 0.85
tty_waitFunction · 0.85

Tested by

no test coverage detected