| 1002 | } |
| 1003 | |
| 1004 | static int |
| 1005 | shmunload(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 | |
| 1040 | static int |
| 1041 | sysctl_shmsegs(SYSCTL_HANDLER_ARGS) |
no test coverage detected