| 109 | |
| 110 | |
| 111 | int 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 | |
| 141 | static inline void reset_script_reload_ctx(void) |
nothing calls this directly
no test coverage detected