1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_SIGNAL_TYPES_H
3 #define _LINUX_SIGNAL_TYPES_H
4 
5 /*
6  * Basic signal handling related data type definitions:
7  */
8 
9 #include <linux/list.h>
10 #include <uapi/linux/signal.h>
11 
12 typedef struct kernel_siginfo {
13 	__SIGINFO;
14 } kernel_siginfo_t;
15 
16 struct ucounts;
17 
18 /*
19  * Real Time signals may be queued.
20  */
21 
22 struct sigqueue {
23 	struct list_head list;
24 	int flags;
25 	kernel_siginfo_t info;
26 	struct ucounts *ucounts;
27 };
28 
29 /* flags values. */
30 #define SIGQUEUE_PREALLOC	1
31 
32 struct sigpending {
33 	struct list_head list;
34 	sigset_t signal;
35 };
36 
37 struct sigaction {
38 #ifndef __ARCH_HAS_IRIX_SIGACTION
39 	__sighandler_t	sa_handler;
40 	unsigned long	sa_flags;
41 #else
42 	unsigned int	sa_flags;
43 	__sighandler_t	sa_handler;
44 #endif
45 #ifdef __ARCH_HAS_SA_RESTORER
46 	__sigrestore_t sa_restorer;
47 #endif
48 	sigset_t	sa_mask;	/* mask last for extensibility */
49 };
50 
51 struct k_sigaction {
52 	struct sigaction sa;
53 #ifdef __ARCH_HAS_KA_RESTORER
54 	__sigrestore_t ka_restorer;
55 #endif
56 };
57 
58 #ifdef CONFIG_OLD_SIGACTION
59 struct old_sigaction {
60 	__sighandler_t sa_handler;
61 	old_sigset_t sa_mask;
62 	unsigned long sa_flags;
63 	__sigrestore_t sa_restorer;
64 };
65 #endif
66 
67 struct ksignal {
68 	struct k_sigaction ka;
69 	kernel_siginfo_t info;
70 	int sig;
71 };
72 
73 /* Used to kill the race between sigaction and forced signals */
74 #define SA_IMMUTABLE		0x00800000
75 
76 #ifndef __ARCH_UAPI_SA_FLAGS
77 #ifdef SA_RESTORER
78 #define __ARCH_UAPI_SA_FLAGS	SA_RESTORER
79 #else
80 #define __ARCH_UAPI_SA_FLAGS	0
81 #endif
82 #endif
83 
84 #define UAPI_SA_FLAGS                                                          \
85 	(SA_NOCLDSTOP | SA_NOCLDWAIT | SA_SIGINFO | SA_ONSTACK | SA_RESTART |  \
86 	 SA_NODEFER | SA_RESETHAND | SA_EXPOSE_TAGBITS | __ARCH_UAPI_SA_FLAGS)
87 
88 #endif /* _LINUX_SIGNAL_TYPES_H */
89