Lines Matching refs:sig

114 static void __cdecl evsig_handler(int sig);
124 evsig_base_n_signals_added = base->sig.ev_n_signals_added; in evsig_set_base_()
125 evsig_base_fd = base->sig.ev_signal_pair[1]; in evsig_set_base_()
159 ev_uint8_t sig = signals[i]; in evsig_cb() local
160 if (sig < NSIG) in evsig_cb()
161 ncaught[sig]++; in evsig_cb()
181 if (evutil_make_internal_pipe_(base->sig.ev_signal_pair) == -1) { in evsig_init_()
192 if (base->sig.sh_old) { in evsig_init_()
193 mm_free(base->sig.sh_old); in evsig_init_()
195 base->sig.sh_old = NULL; in evsig_init_()
196 base->sig.sh_old_max = 0; in evsig_init_()
198 event_assign(&base->sig.ev_signal, base, base->sig.ev_signal_pair[0], in evsig_init_()
201 base->sig.ev_signal.ev_flags |= EVLIST_INTERNAL; in evsig_init_()
202 event_priority_set(&base->sig.ev_signal, 0); in evsig_init_()
220 struct evsig_info *sig = &base->sig; in evsig_set_handler_() local
227 if (evsignal >= sig->sh_old_max) { in evsig_set_handler_()
230 __func__, evsignal, sig->sh_old_max)); in evsig_set_handler_()
231 p = mm_realloc(sig->sh_old, new_max * sizeof(*sig->sh_old)); in evsig_set_handler_()
237 memset((char *)p + sig->sh_old_max * sizeof(*sig->sh_old), in evsig_set_handler_()
238 0, (new_max - sig->sh_old_max) * sizeof(*sig->sh_old)); in evsig_set_handler_()
240 sig->sh_old_max = new_max; in evsig_set_handler_()
241 sig->sh_old = p; in evsig_set_handler_()
245 sig->sh_old[evsignal] = mm_malloc(sizeof *sig->sh_old[evsignal]); in evsig_set_handler_()
246 if (sig->sh_old[evsignal] == NULL) { in evsig_set_handler_()
258 if (sigaction(evsignal, &sa, sig->sh_old[evsignal]) == -1) { in evsig_set_handler_()
260 mm_free(sig->sh_old[evsignal]); in evsig_set_handler_()
261 sig->sh_old[evsignal] = NULL; in evsig_set_handler_()
267 mm_free(sig->sh_old[evsignal]); in evsig_set_handler_()
268 sig->sh_old[evsignal] = NULL; in evsig_set_handler_()
271 *sig->sh_old[evsignal] = sh; in evsig_set_handler_()
280 struct evsig_info *sig = &base->sig; in evsig_add() local
297 evsig_base_n_signals_added = ++sig->ev_n_signals_added; in evsig_add()
298 evsig_base_fd = base->sig.ev_signal_pair[1]; in evsig_add()
307 if (!sig->ev_signal_added) { in evsig_add()
308 if (event_add_nolock_(&sig->ev_signal, NULL, 0)) in evsig_add()
310 sig->ev_signal_added = 1; in evsig_add()
318 --sig->ev_n_signals_added; in evsig_add()
327 struct evsig_info *sig = &base->sig; in evsig_restore_handler_() local
334 if (evsignal >= sig->sh_old_max) { in evsig_restore_handler_()
341 sh = sig->sh_old[evsignal]; in evsig_restore_handler_()
342 sig->sh_old[evsignal] = NULL; in evsig_restore_handler_()
370 --base->sig.ev_n_signals_added; in evsig_del()
377 evsig_handler(int sig) in evsig_handler() argument
388 __func__, sig); in evsig_handler()
393 signal(sig, evsig_handler); in evsig_handler()
397 msg = sig; in evsig_handler()
416 if (base->sig.ev_signal_added) { in evsig_dealloc_()
417 event_del(&base->sig.ev_signal); in evsig_dealloc_()
418 base->sig.ev_signal_added = 0; in evsig_dealloc_()
422 event_debug_unassign(&base->sig.ev_signal); in evsig_dealloc_()
425 if (i < base->sig.sh_old_max && base->sig.sh_old[i] != NULL) in evsig_dealloc_()
436 if (base->sig.ev_signal_pair[0] != -1) { in evsig_dealloc_()
437 evutil_closesocket(base->sig.ev_signal_pair[0]); in evsig_dealloc_()
438 base->sig.ev_signal_pair[0] = -1; in evsig_dealloc_()
440 if (base->sig.ev_signal_pair[1] != -1) { in evsig_dealloc_()
441 evutil_closesocket(base->sig.ev_signal_pair[1]); in evsig_dealloc_()
442 base->sig.ev_signal_pair[1] = -1; in evsig_dealloc_()
444 base->sig.sh_old_max = 0; in evsig_dealloc_()
447 if (base->sig.sh_old) { in evsig_dealloc_()
448 mm_free(base->sig.sh_old); in evsig_dealloc_()
449 base->sig.sh_old = NULL; in evsig_dealloc_()