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

Function shmunload

freebsd/kern/sysv_shm.c:1004–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002}
1003
1004static int
1005shmunload(void)
1006{
1007 int i;
1008
1009 if (shm_nused > 0)
1010 return (EBUSY);
1011
1012#ifdef COMPAT_FREEBSD32
1013 syscall32_helper_unregister(shm32_syscalls);
1014#endif
1015 syscall_helper_unregister(shm_syscalls);
1016 if (shm_prison_slot != 0)
1017 osd_jail_deregister(shm_prison_slot);
1018
1019 for (i = 0; i < shmalloced; i++) {
1020#ifdef MAC
1021 mac_sysvshm_destroy(&shmsegs[i]);
1022#endif
1023 /*
1024 * Objects might be still mapped into the processes
1025 * address spaces. Actual free would happen on the
1026 * last mapping destruction.
1027 */
1028 if (shmsegs[i].u.shm_perm.mode != SHMSEG_FREE)
1029 vm_object_deallocate(shmsegs[i].object);
1030 }
1031 free(shmsegs, M_SHM);
1032#ifndef SYSVSHM
1033 shmexit_hook = NULL;
1034 shmfork_hook = NULL;
1035#endif
1036 sx_destroy(&sysvshmsx);
1037 return (0);
1038}
1039
1040static int
1041sysctl_shmsegs(SYSCTL_HANDLER_ARGS)

Callers 1

sysvshm_modloadFunction · 0.85

Calls 5

mac_sysvshm_destroyFunction · 0.85
vm_object_deallocateFunction · 0.85
freeFunction · 0.70
sx_destroyFunction · 0.70

Tested by

no test coverage detected