xref: /freebsd/include/signal.h (revision 5a1d1441)
159deaec5SRodney W. Grimes /*-
22321c474SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
32321c474SPedro F. Giffuni  *
459deaec5SRodney W. Grimes  * Copyright (c) 1991, 1993
559deaec5SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
659deaec5SRodney W. Grimes  *
759deaec5SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
859deaec5SRodney W. Grimes  * modification, are permitted provided that the following conditions
959deaec5SRodney W. Grimes  * are met:
1059deaec5SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
1159deaec5SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
1259deaec5SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
1359deaec5SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
1459deaec5SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
15f2556687SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
1659deaec5SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
1759deaec5SRodney W. Grimes  *    without specific prior written permission.
1859deaec5SRodney W. Grimes  *
1959deaec5SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2059deaec5SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2159deaec5SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2259deaec5SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2359deaec5SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2459deaec5SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2559deaec5SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2659deaec5SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2759deaec5SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2859deaec5SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2959deaec5SRodney W. Grimes  * SUCH DAMAGE.
3059deaec5SRodney W. Grimes  */
3159deaec5SRodney W. Grimes 
32943c1801SBruce Evans #ifndef _SIGNAL_H_
33943c1801SBruce Evans #define	_SIGNAL_H_
3459deaec5SRodney W. Grimes 
3559deaec5SRodney W. Grimes #include <sys/cdefs.h>
36abbd8902SMike Barcroft #include <sys/_types.h>
37c989e80eSDoug Rabson #include <sys/signal.h>
382dd7d056SKonstantin Belousov #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
3990edf67eSKonstantin Belousov #include <machine/ucontext.h>
4090edf67eSKonstantin Belousov #include <sys/_ucontext.h>
412dd7d056SKonstantin Belousov #endif
4259deaec5SRodney W. Grimes 
43649702c5SPedro F. Giffuni __NULLABILITY_PRAGMA_PUSH
44649702c5SPedro F. Giffuni 
45eb74223bSMike Barcroft #if __BSD_VISIBLE
46ed583c28SMike Barcroft /*
47ed583c28SMike Barcroft  * XXX should enlarge these, if only to give empty names instead of bounds
48ed583c28SMike Barcroft  * errors for large signal numbers.
49ed583c28SMike Barcroft  */
50f6ab8089SEd Schouten extern const char * const sys_signame[NSIG];
51f6ab8089SEd Schouten extern const char * const sys_siglist[NSIG];
52f6ab8089SEd Schouten extern const int sys_nsig;
5359deaec5SRodney W. Grimes #endif
5459deaec5SRodney W. Grimes 
553357acddSMike Barcroft #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
56eb74223bSMike Barcroft #ifndef _PID_T_DECLARED
57eb74223bSMike Barcroft typedef	__pid_t		pid_t;
58eb74223bSMike Barcroft #define	_PID_T_DECLARED
59eb74223bSMike Barcroft #endif
60eb74223bSMike Barcroft #endif
61eb74223bSMike Barcroft 
6248a3f7d9SDavid Schultz #if __POSIX_VISIBLE || __XSI_VISIBLE
6348a3f7d9SDavid Schultz struct pthread;		/* XXX */
6448a3f7d9SDavid Schultz typedef struct pthread *__pthread_t;
6548a3f7d9SDavid Schultz #if !defined(_PTHREAD_T_DECLARED) && __POSIX_VISIBLE >= 200809
6648a3f7d9SDavid Schultz typedef __pthread_t pthread_t;
6748a3f7d9SDavid Schultz #define	_PTHREAD_T_DECLARED
6848a3f7d9SDavid Schultz #endif
6948a3f7d9SDavid Schultz #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */
7048a3f7d9SDavid Schultz 
7159deaec5SRodney W. Grimes __BEGIN_DECLS
72bb28f3c2SWarner Losh int	raise(int);
73eb74223bSMike Barcroft 
743357acddSMike Barcroft #if __POSIX_VISIBLE || __XSI_VISIBLE
75abbd8902SMike Barcroft int	kill(__pid_t, int);
7648a3f7d9SDavid Schultz int	pthread_kill(__pthread_t, int);
77ba13377aSKonstantin Belousov int	pthread_sigmask(int, const __sigset_t * __restrict,
78ba13377aSKonstantin Belousov 	    __sigset_t * __restrict);
79e31d11c3SRobert Drehmel int	sigaction(int, const struct sigaction * __restrict,
80e31d11c3SRobert Drehmel 	    struct sigaction * __restrict);
81bb28f3c2SWarner Losh int	sigaddset(sigset_t *, int);
82bb28f3c2SWarner Losh int	sigdelset(sigset_t *, int);
83bb28f3c2SWarner Losh int	sigemptyset(sigset_t *);
84bb28f3c2SWarner Losh int	sigfillset(sigset_t *);
85bb28f3c2SWarner Losh int	sigismember(const sigset_t *, int);
86649702c5SPedro F. Giffuni int	sigpending(sigset_t * _Nonnull);
87e31d11c3SRobert Drehmel int	sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict);
88649702c5SPedro F. Giffuni int	sigsuspend(const sigset_t * _Nonnull);
89649702c5SPedro F. Giffuni int	sigwait(const sigset_t * _Nonnull __restrict,
90649702c5SPedro F. Giffuni 	    int * _Nonnull __restrict);
91eb74223bSMike Barcroft #endif
92aac4ad2cSPeter Dufault 
933357acddSMike Barcroft #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600
94d2c8dd81SDavid Xu int	sigqueue(__pid_t, int, const union sigval);
9505e72facSDavid Xu 
96ed583c28SMike Barcroft struct timespec;
97e31d11c3SRobert Drehmel int	sigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict,
98e31d11c3SRobert Drehmel 	    const struct timespec * __restrict);
99e31d11c3SRobert Drehmel int	sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict);
100917e476dSPeter Dufault #endif
101eb74223bSMike Barcroft 
1023357acddSMike Barcroft #if __XSI_VISIBLE
103abbd8902SMike Barcroft int	killpg(__pid_t, int);
104e31d11c3SRobert Drehmel int	sigaltstack(const stack_t * __restrict, stack_t * __restrict);
105536fb659SOlivier Houchard int	sighold(int);
106536fb659SOlivier Houchard int	sigignore(int);
107536fb659SOlivier Houchard int	sigpause(int);
108536fb659SOlivier Houchard int	sigrelse(int);
109649702c5SPedro F. Giffuni void	(* _Nullable sigset(int, void (* _Nullable)(int)))(int);
110536fb659SOlivier Houchard int	xsi_sigpause(int);
111eb74223bSMike Barcroft #endif
112eb74223bSMike Barcroft 
11348a3f7d9SDavid Schultz #if __XSI_VISIBLE >= 600
1143357acddSMike Barcroft int	siginterrupt(int, int);
1153357acddSMike Barcroft #endif
1163357acddSMike Barcroft 
117448f5f73SJilles Tjoelker #if __POSIX_VISIBLE >= 200809
1180977bd1eSEd Schouten void	psignal(int, const char *);
119a5e88ed7SDavid Schultz #endif
120a5e88ed7SDavid Schultz 
121eb74223bSMike Barcroft #if __BSD_VISIBLE
1227dc859a5SKyle Evans int	sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right);
123eb74223bSMike Barcroft int	sigblock(int);
1247dc859a5SKyle Evans int	sigisemptyset(const sigset_t *set);
1257dc859a5SKyle Evans int	sigorset(sigset_t *dest, const sigset_t *left, const sigset_t *right);
126bb28f3c2SWarner Losh int	sigreturn(const struct __ucontext *);
127bb28f3c2SWarner Losh int	sigsetmask(int);
128bb28f3c2SWarner Losh int	sigstack(const struct sigstack *, struct sigstack *);
129bb28f3c2SWarner Losh int	sigvec(int, struct sigvec *, struct sigvec *);
130eb74223bSMike Barcroft #endif
13159deaec5SRodney W. Grimes __END_DECLS
132649702c5SPedro F. Giffuni __NULLABILITY_PRAGMA_POP
13359deaec5SRodney W. Grimes 
134943c1801SBruce Evans #endif /* !_SIGNAL_H_ */
135