| 382 | } |
| 383 | |
| 384 | static int |
| 385 | shm_read(struct file *fp, struct uio *uio, struct ucred *active_cred, |
| 386 | int flags, struct thread *td) |
| 387 | { |
| 388 | struct shmfd *shmfd; |
| 389 | void *rl_cookie; |
| 390 | int error; |
| 391 | |
| 392 | shmfd = fp->f_data; |
| 393 | #ifdef MAC |
| 394 | error = mac_posixshm_check_read(active_cred, fp->f_cred, shmfd); |
| 395 | if (error) |
| 396 | return (error); |
| 397 | #endif |
| 398 | foffset_lock_uio(fp, uio, flags); |
| 399 | rl_cookie = rangelock_rlock(&shmfd->shm_rl, uio->uio_offset, |
| 400 | uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); |
| 401 | error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); |
| 402 | rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); |
| 403 | foffset_unlock_uio(fp, uio, flags); |
| 404 | return (error); |
| 405 | } |
| 406 | |
| 407 | static int |
| 408 | shm_write(struct file *fp, struct uio *uio, struct ucred *active_cred, |
nothing calls this directly
no test coverage detected