xref: /freebsd/include/ssp/signal.h (revision d8b51259caee09a4080e524ac254e1f5aecc46cc)
1b0334450SRicardo Branco /*-
2b0334450SRicardo Branco  * SPDX-License-Identifier: BSD-2-Clause
3b0334450SRicardo Branco  *
4b0334450SRicardo Branco  * Copyright (c) 2025, Ricardo Branco <rbranco@suse.de>
5b0334450SRicardo Branco  *
6b0334450SRicardo Branco  * Redistribution and use in source and binary forms, with or without
7b0334450SRicardo Branco  * modification, are permitted provided that the following conditions
8b0334450SRicardo Branco  * are met:
9b0334450SRicardo Branco  * 1. Redistributions of source code must retain the above copyright
10b0334450SRicardo Branco  *    notice, this list of conditions and the following disclaimer.
11b0334450SRicardo Branco  * 2. Redistributions in binary form must reproduce the above copyright
12b0334450SRicardo Branco  *    notice, this list of conditions and the following disclaimer in the
13b0334450SRicardo Branco  *    documentation and/or other materials provided with the distribution.
14b0334450SRicardo Branco  *
15b0334450SRicardo Branco  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16b0334450SRicardo Branco  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17b0334450SRicardo Branco  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18b0334450SRicardo Branco  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19b0334450SRicardo Branco  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20b0334450SRicardo Branco  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21b0334450SRicardo Branco  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22b0334450SRicardo Branco  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23b0334450SRicardo Branco  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24b0334450SRicardo Branco  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25b0334450SRicardo Branco  * POSSIBILITY OF SUCH DAMAGE.
26b0334450SRicardo Branco  */
27b0334450SRicardo Branco #ifndef _SSP_SIGNAL_H_
28b0334450SRicardo Branco #define _SSP_SIGNAL_H_
29b0334450SRicardo Branco 
30b0334450SRicardo Branco #include <ssp/ssp.h>
31b0334450SRicardo Branco 
32b0334450SRicardo Branco #if __SSP_FORTIFY_LEVEL > 0
33b0334450SRicardo Branco 
34b0334450SRicardo Branco #include <signal.h>
35b0334450SRicardo Branco 
36b0334450SRicardo Branco __BEGIN_DECLS
37b0334450SRicardo Branco 
38*d8b51259SWarner Losh #if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE
39b0334450SRicardo Branco __ssp_redirect_raw_impl(int, sig2str, sig2str,
40b0334450SRicardo Branco     (int signum, char *__restrict str))
41b0334450SRicardo Branco {
42b0334450SRicardo Branco 	if (__ssp_bos(str) < SIG2STR_MAX)
43b0334450SRicardo Branco 		__chk_fail();
44b0334450SRicardo Branco 
45b0334450SRicardo Branco 	return (__ssp_real(sig2str)(signum, str));
46b0334450SRicardo Branco }
47*d8b51259SWarner Losh #endif
48b0334450SRicardo Branco 
49b0334450SRicardo Branco __END_DECLS
50b0334450SRicardo Branco 
51b0334450SRicardo Branco #endif /* __SSP_FORTIFY_LEVEL > 0 */
52b0334450SRicardo Branco #endif /* _SSP_SIGNAL_H_ */
53