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

Function shmrealloc

freebsd/kern/sysv_shm.c:862–887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862static void
863shmrealloc(void)
864{
865 struct shmid_kernel *newsegs;
866 int i;
867
868 SYSVSHM_ASSERT_LOCKED();
869
870 if (shmalloced >= shminfo.shmmni)
871 return;
872
873 newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM,
874 M_WAITOK | M_ZERO);
875 for (i = 0; i < shmalloced; i++)
876 bcopy(&shmsegs[i], &newsegs[i], sizeof(newsegs[0]));
877 for (; i < shminfo.shmmni; i++) {
878 newsegs[i].u.shm_perm.mode = SHMSEG_FREE;
879 newsegs[i].u.shm_perm.seq = 0;
880#ifdef MAC
881 mac_sysvshm_init(&newsegs[i]);
882#endif
883 }
884 free(shmsegs, M_SHM);
885 shmsegs = newsegs;
886 shmalloced = shminfo.shmmni;
887}
888
889static struct syscall_helper_data shm_syscalls[] = {
890 SYSCALL_INIT_HELPER(shmat),

Callers 1

shmget_allocate_segmentFunction · 0.85

Calls 3

mallocFunction · 0.85
mac_sysvshm_initFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected