MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / reset_process_slot

Function reset_process_slot

pt.c:217–252  ·  view source on GitHub ↗

Resets all the values in the process table for a given id (a slot) so that * it can be reused later * WARNING: this should be called only by main process and when it is 100% * that the process mapped on this slot is not running anymore */

Source from the content-addressed store, hash-verified

215 * WARNING: this should be called only by main process and when it is 100%
216 * that the process mapped on this slot is not running anymore */
217void reset_process_slot( int p_id )
218{
219 if (is_main==0) {
220 LM_BUG("buggy call from non-main process!!!");
221 return;
222 }
223
224 /* we cannot simply do a memset here, as we need to preserve the holders
225 * with the inter-process communication fds */
226 pt[p_id].pid = -1;
227 pt[p_id].type = TYPE_NONE;
228 pt[p_id].pg_filter = NULL;
229 pt[p_id].desc[0] = 0;
230 pt[p_id].flags = 0;
231
232 pt[p_id].ipc_pipe[0] = pt[p_id].ipc_pipe[1] = -1;
233 pt[p_id].ipc_sync_pipe[0] = pt[p_id].ipc_sync_pipe[1] = -1;
234
235 pt[p_id].log_level = pt[p_id].default_log_level = 0; /*not really needed*/
236 pt[p_id].profiling_proc_level = LEVEL_OFF;
237
238 /* purge all load-related data */
239 memset( &pt[p_id].load, 0, sizeof(struct proc_load_info));
240 /* hide the load stats */
241 pt[p_id].load_rt->flags |= STAT_HIDDEN;
242 pt[p_id].load_1m->flags |= STAT_HIDDEN;
243 pt[p_id].load_10m->flags |= STAT_HIDDEN;
244 #ifdef PKG_MALLOC
245 pt[p_id].pkg_total->flags |= STAT_HIDDEN;
246 pt[p_id].pkg_used->flags |= STAT_HIDDEN;
247 pt[p_id].pkg_rused->flags |= STAT_HIDDEN;
248 pt[p_id].pkg_mused->flags |= STAT_HIDDEN;
249 pt[p_id].pkg_free->flags |= STAT_HIDDEN;
250 pt[p_id].pkg_frags->flags |= STAT_HIDDEN;
251 #endif
252}
253
254
255enum {CHLD_STARTING, CHLD_OK, CHLD_FAILED};

Callers 2

handle_sigsFunction · 0.85
internal_forkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected