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

Function sys_shmget

freebsd/kern/sysv_shm.c:781–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779};
780#endif
781int
782sys_shmget(struct thread *td, struct shmget_args *uap)
783{
784 int segnum, mode;
785 int error;
786
787 if (shm_find_prison(td->td_ucred) == NULL)
788 return (ENOSYS);
789 mode = uap->shmflg & ACCESSPERMS;
790 SYSVSHM_LOCK();
791 if (uap->key == IPC_PRIVATE) {
792 error = shmget_allocate_segment(td, uap->key, uap->size, mode);
793 } else {
794 segnum = shm_find_segment_by_key(td->td_ucred->cr_prison,
795 uap->key);
796 if (segnum >= 0)
797 error = shmget_existing(td, uap->size, uap->shmflg,
798 mode, segnum);
799 else if ((uap->shmflg & IPC_CREAT) == 0)
800 error = ENOENT;
801 else
802 error = shmget_allocate_segment(td, uap->key,
803 uap->size, mode);
804 }
805 SYSVSHM_UNLOCK();
806 return (error);
807}
808
809#ifdef SYSVSHM
810void

Callers

nothing calls this directly

Calls 4

shm_find_prisonFunction · 0.85
shmget_allocate_segmentFunction · 0.85
shm_find_segment_by_keyFunction · 0.85
shmget_existingFunction · 0.85

Tested by

no test coverage detected