| 1174 | } |
| 1175 | |
| 1176 | static int sockets_pool_init(void) |
| 1177 | { |
| 1178 | int len; |
| 1179 | |
| 1180 | sockets_info = pkg_malloc(sock_mgm_max_sockets * sizeof *sockets_info); |
| 1181 | if (!sockets_info) { |
| 1182 | LM_ERR("oom for sockets info\n"); |
| 1183 | return -1; |
| 1184 | } |
| 1185 | memset(sockets_info, 0, sock_mgm_max_sockets * sizeof *sockets_info); |
| 1186 | |
| 1187 | len = (sizeof *sockets_pool)+ |
| 1188 | (sock_mgm_max_sockets * sizeof *sockets_pool->used); |
| 1189 | sockets_pool = shm_malloc(len); |
| 1190 | if (!sockets_pool) { |
| 1191 | LM_ERR("oom for sockets pool\n"); |
| 1192 | return -1; |
| 1193 | } |
| 1194 | memset(sockets_pool, 0, len); |
| 1195 | INIT_LIST_HEAD(&sockets_pool->running); |
| 1196 | sockets_pool->last_index = sock_mgm_max_sockets; |
| 1197 | sockets_pool->used = (char *)(sockets_pool + 1); |
| 1198 | return 0; |
| 1199 | } |
| 1200 | |
| 1201 | static int sock_mgm_procs_func(modparam_t type, void *val) |
| 1202 | { |
no test coverage detected