| 181 | } |
| 182 | |
| 183 | static int |
| 184 | ttydisc_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 | |
| 222 | static int |
| 223 | ttydisc_read_raw_read_timer(struct tty *tp, struct uio *uio, int ioflag, |
no test coverage detected