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

Function init_script_reload

cfg_reload.c:111–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110
111int init_script_reload(void)
112{
113 srr_ctx = (struct script_reload_ctx *)shm_malloc( sizeof(*srr_ctx) +
114 counted_max_processes*sizeof(enum proc_reload_status) );
115 if (srr_ctx==NULL) {
116 LM_ERR("failed to shm allocate the script reload context\n");
117 return -1;
118 }
119
120 memset( srr_ctx, 0, sizeof(*srr_ctx) +
121 counted_max_processes*sizeof(enum proc_reload_status));
122
123 srr_ctx->next_seq_no = 1;
124
125 lock_init( &srr_ctx->lock );
126
127 srr_ctx->rw_lock = lock_init_rw();
128 if (srr_ctx->rw_lock==NULL) {
129 LM_ERR("failed to create rw lock for script reload context\n");
130 shm_free(srr_ctx);
131 srr_ctx = NULL;
132 return -1;
133 }
134
135 srr_ctx->proc_status = (enum proc_reload_status*)(srr_ctx + 1);
136
137 return 0;
138}
139
140
141static inline void reset_script_reload_ctx(void)

Callers

nothing calls this directly

Calls 4

shm_mallocFunction · 0.85
lock_initFunction · 0.85
lock_init_rwFunction · 0.85
shm_freeFunction · 0.85

Tested by

no test coverage detected