Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/uipc_shm.c
Show First 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | |||||
shm_read(struct file *fp, struct uio *uio, struct ucred *active_cred, | shm_read(struct file *fp, struct uio *uio, struct ucred *active_cred, | ||||
int flags, struct thread *td) | int flags, struct thread *td) | ||||
{ | { | ||||
struct shmfd *shmfd; | struct shmfd *shmfd; | ||||
void *rl_cookie; | void *rl_cookie; | ||||
int error; | int error; | ||||
shmfd = fp->f_data; | shmfd = fp->f_data; | ||||
foffset_lock_uio(fp, uio, flags); | |||||
rl_cookie = rangelock_rlock(&shmfd->shm_rl, uio->uio_offset, | |||||
uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); | |||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_posixshm_check_read(active_cred, fp->f_cred, shmfd); | error = mac_posixshm_check_read(active_cred, fp->f_cred, shmfd); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
#endif | #endif | ||||
foffset_lock_uio(fp, uio, flags); | |||||
rl_cookie = rangelock_rlock(&shmfd->shm_rl, uio->uio_offset, | |||||
uio->uio_offset + uio->uio_resid, &shmfd->shm_mtx); | |||||
error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); | error = uiomove_object(shmfd->shm_object, shmfd->shm_size, uio); | ||||
rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); | rangelock_unlock(&shmfd->shm_rl, rl_cookie, &shmfd->shm_mtx); | ||||
foffset_unlock_uio(fp, uio, flags); | foffset_unlock_uio(fp, uio, flags); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
shm_write(struct file *fp, struct uio *uio, struct ucred *active_cred, | shm_write(struct file *fp, struct uio *uio, struct ucred *active_cred, | ||||
▲ Show 20 Lines • Show All 793 Lines • Show Last 20 Lines |