1 /* $NetBSD: signal.h,v 1.2 2025/01/26 16:25:42 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 #pragma once 17 18 #include <stdlib.h> 19 20 #include <isc/lang.h> 21 #include <isc/loop.h> 22 23 typedef void (*isc_signal_cb)(void *, int); 24 25 ISC_LANG_BEGINDECLS 26 27 isc_signal_t * 28 isc_signal_new(isc_loopmgr_t *loopmgr, isc_signal_cb cb, void *cbarg, 29 int signum); 30 /*%< 31 * Create a new signal handler for loop manager 'loopmgr', handling 32 * the signal value 'signum'. 33 * 34 * After isc_signal_start() is called on the returned signal handler, 35 * and until isc_signal_stop() is called, if the running process receives 36 * signal 'signum', 'cb' will be run with argument 'cbarg'. 37 */ 38 39 void 40 isc_signal_destroy(isc_signal_t **signalp); 41 /*%< 42 * Free the memory allocated by isc_signal_new(). 43 */ 44 45 void 46 isc_signal_start(isc_signal_t *signal); 47 /*%< 48 * Start using the signal handler 'signal'. 49 */ 50 51 void 52 isc_signal_stop(isc_signal_t *signal); 53 /*%< 54 * Stop using the signal handler 'signal'. (It can be restarted with 55 * isc_signal_start().) 56 */ 57 ISC_LANG_ENDDECLS 58