| 318 | } |
| 319 | |
| 320 | int |
| 321 | kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset) |
| 322 | { |
| 323 | struct file *fp; |
| 324 | int error; |
| 325 | |
| 326 | error = fget_read(td, fd, &cap_pread_rights, &fp); |
| 327 | if (error) |
| 328 | return (error); |
| 329 | if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE)) |
| 330 | error = ESPIPE; |
| 331 | else if (offset < 0 && |
| 332 | (fp->f_vnode == NULL || fp->f_vnode->v_type != VCHR)) |
| 333 | error = EINVAL; |
| 334 | else |
| 335 | error = dofileread(td, fd, fp, auio, offset, FOF_OFFSET); |
| 336 | fdrop(fp, td); |
| 337 | return (error); |
| 338 | } |
| 339 | |
| 340 | /* |
| 341 | * Common code for readv and preadv that reads data in |
no test coverage detected