Lines Matching refs:sig
113 static void __cdecl evsig_handler(int sig);
123 evsig_base_n_signals_added = base->sig.ev_n_signals_added; in evsig_set_base()
124 evsig_base_fd = base->sig.ev_signal_pair[0]; in evsig_set_base()
154 ev_uint8_t sig = signals[i]; in evsig_cb() local
155 if (sig < NSIG) in evsig_cb()
156 ncaught[sig]++; in evsig_cb()
177 AF_UNIX, SOCK_STREAM, 0, base->sig.ev_signal_pair) == -1) { in evsig_init()
188 evutil_make_socket_closeonexec(base->sig.ev_signal_pair[0]); in evsig_init()
189 evutil_make_socket_closeonexec(base->sig.ev_signal_pair[1]); in evsig_init()
190 base->sig.sh_old = NULL; in evsig_init()
191 base->sig.sh_old_max = 0; in evsig_init()
193 evutil_make_socket_nonblocking(base->sig.ev_signal_pair[0]); in evsig_init()
194 evutil_make_socket_nonblocking(base->sig.ev_signal_pair[1]); in evsig_init()
196 event_assign(&base->sig.ev_signal, base, base->sig.ev_signal_pair[1], in evsig_init()
199 base->sig.ev_signal.ev_flags |= EVLIST_INTERNAL; in evsig_init()
200 event_priority_set(&base->sig.ev_signal, 0); in evsig_init()
218 struct evsig_info *sig = &base->sig; in _evsig_set_handler() local
225 if (evsignal >= sig->sh_old_max) { in _evsig_set_handler()
228 __func__, evsignal, sig->sh_old_max)); in _evsig_set_handler()
229 p = mm_realloc(sig->sh_old, new_max * sizeof(*sig->sh_old)); in _evsig_set_handler()
235 memset((char *)p + sig->sh_old_max * sizeof(*sig->sh_old), in _evsig_set_handler()
236 0, (new_max - sig->sh_old_max) * sizeof(*sig->sh_old)); in _evsig_set_handler()
238 sig->sh_old_max = new_max; in _evsig_set_handler()
239 sig->sh_old = p; in _evsig_set_handler()
243 sig->sh_old[evsignal] = mm_malloc(sizeof *sig->sh_old[evsignal]); in _evsig_set_handler()
244 if (sig->sh_old[evsignal] == NULL) { in _evsig_set_handler()
256 if (sigaction(evsignal, &sa, sig->sh_old[evsignal]) == -1) { in _evsig_set_handler()
258 mm_free(sig->sh_old[evsignal]); in _evsig_set_handler()
259 sig->sh_old[evsignal] = NULL; in _evsig_set_handler()
265 mm_free(sig->sh_old[evsignal]); in _evsig_set_handler()
266 sig->sh_old[evsignal] = NULL; in _evsig_set_handler()
269 *sig->sh_old[evsignal] = sh; in _evsig_set_handler()
278 struct evsig_info *sig = &base->sig; in evsig_add() local
295 evsig_base_n_signals_added = ++sig->ev_n_signals_added; in evsig_add()
296 evsig_base_fd = base->sig.ev_signal_pair[0]; in evsig_add()
305 if (!sig->ev_signal_added) { in evsig_add()
306 if (event_add(&sig->ev_signal, NULL)) in evsig_add()
308 sig->ev_signal_added = 1; in evsig_add()
316 --sig->ev_n_signals_added; in evsig_add()
325 struct evsig_info *sig = &base->sig; in _evsig_restore_handler() local
333 sh = sig->sh_old[evsignal]; in _evsig_restore_handler()
334 sig->sh_old[evsignal] = NULL; in _evsig_restore_handler()
362 --base->sig.ev_n_signals_added; in evsig_del()
369 evsig_handler(int sig) in evsig_handler() argument
380 __func__, sig); in evsig_handler()
385 signal(sig, evsig_handler); in evsig_handler()
389 msg = sig; in evsig_handler()
401 if (base->sig.ev_signal_added) { in evsig_dealloc()
402 event_del(&base->sig.ev_signal); in evsig_dealloc()
403 base->sig.ev_signal_added = 0; in evsig_dealloc()
407 event_debug_unassign(&base->sig.ev_signal); in evsig_dealloc()
410 if (i < base->sig.sh_old_max && base->sig.sh_old[i] != NULL) in evsig_dealloc()
421 if (base->sig.ev_signal_pair[0] != -1) { in evsig_dealloc()
422 evutil_closesocket(base->sig.ev_signal_pair[0]); in evsig_dealloc()
423 base->sig.ev_signal_pair[0] = -1; in evsig_dealloc()
425 if (base->sig.ev_signal_pair[1] != -1) { in evsig_dealloc()
426 evutil_closesocket(base->sig.ev_signal_pair[1]); in evsig_dealloc()
427 base->sig.ev_signal_pair[1] = -1; in evsig_dealloc()
429 base->sig.sh_old_max = 0; in evsig_dealloc()
432 if (base->sig.sh_old) { in evsig_dealloc()
433 mm_free(base->sig.sh_old); in evsig_dealloc()
434 base->sig.sh_old = NULL; in evsig_dealloc()