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

Function shm_read

freebsd/kern/uipc_shm.c:384–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384static int
385shm_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
407static int
408shm_write(struct file *fp, struct uio *uio, struct ucred *active_cred,

Callers

nothing calls this directly

Calls 6

mac_posixshm_check_readFunction · 0.85
foffset_lock_uioFunction · 0.85
rangelock_rlockFunction · 0.85
uiomove_objectFunction · 0.85
rangelock_unlockFunction · 0.85
foffset_unlock_uioFunction · 0.85

Tested by

no test coverage detected