| 1027 | #endif |
| 1028 | |
| 1029 | static int |
| 1030 | ksem_module_init(void) |
| 1031 | { |
| 1032 | int error; |
| 1033 | |
| 1034 | mtx_init(&sem_lock, "sem", NULL, MTX_DEF); |
| 1035 | mtx_init(&ksem_count_lock, "ksem count", NULL, MTX_DEF); |
| 1036 | sx_init(&ksem_dict_lock, "ksem dictionary"); |
| 1037 | ksem_dictionary = hashinit(1024, M_KSEM, &ksem_hash); |
| 1038 | p31b_setcfg(CTL_P1003_1B_SEMAPHORES, 200112L); |
| 1039 | p31b_setcfg(CTL_P1003_1B_SEM_NSEMS_MAX, SEM_MAX); |
| 1040 | p31b_setcfg(CTL_P1003_1B_SEM_VALUE_MAX, SEM_VALUE_MAX); |
| 1041 | |
| 1042 | error = syscall_helper_register(ksem_syscalls, SY_THR_STATIC_KLD); |
| 1043 | if (error) |
| 1044 | return (error); |
| 1045 | #ifdef COMPAT_FREEBSD32 |
| 1046 | error = syscall32_helper_register(ksem32_syscalls, SY_THR_STATIC_KLD); |
| 1047 | if (error) |
| 1048 | return (error); |
| 1049 | #endif |
| 1050 | return (0); |
| 1051 | } |
| 1052 | |
| 1053 | static void |
| 1054 | ksem_module_destroy(void) |
no test coverage detected