Line data Source code
1 0 : /*
2 : * Copyright (c) 2018 Intel Corporation
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 : #ifndef ZEPHYR_INCLUDE_POSIX_SIGNAL_H_
7 : #define ZEPHYR_INCLUDE_POSIX_SIGNAL_H_
8 :
9 : /* include posix_types.h before posix_features.h (here) to avoid build errors against newlib */
10 : #include <zephyr/posix/posix_types.h>
11 : #include "posix_features.h"
12 :
13 : #ifdef __cplusplus
14 : extern "C" {
15 : #endif
16 :
17 1 : #define SIGHUP 1 /**< Hangup */
18 1 : #define SIGINT 2 /**< Interrupt */
19 1 : #define SIGQUIT 3 /**< Quit */
20 1 : #define SIGILL 4 /**< Illegal instruction */
21 1 : #define SIGTRAP 5 /**< Trace/breakpoint trap */
22 1 : #define SIGABRT 6 /**< Aborted */
23 1 : #define SIGBUS 7 /**< Bus error */
24 1 : #define SIGFPE 8 /**< Arithmetic exception */
25 1 : #define SIGKILL 9 /**< Killed */
26 1 : #define SIGUSR1 10 /**< User-defined signal 1 */
27 1 : #define SIGSEGV 11 /**< Invalid memory reference */
28 1 : #define SIGUSR2 12 /**< User-defined signal 2 */
29 1 : #define SIGPIPE 13 /**< Broken pipe */
30 1 : #define SIGALRM 14 /**< Alarm clock */
31 1 : #define SIGTERM 15 /**< Terminated */
32 : /* 16 not used */
33 1 : #define SIGCHLD 17 /**< Child status changed */
34 1 : #define SIGCONT 18 /**< Continued */
35 1 : #define SIGSTOP 19 /**< Stop executing */
36 1 : #define SIGTSTP 20 /**< Stopped */
37 1 : #define SIGTTIN 21 /**< Stopped (read) */
38 1 : #define SIGTTOU 22 /**< Stopped (write) */
39 1 : #define SIGURG 23 /**< Urgent I/O condition */
40 1 : #define SIGXCPU 24 /**< CPU time limit exceeded */
41 1 : #define SIGXFSZ 25 /**< File size limit exceeded */
42 1 : #define SIGVTALRM 26 /**< Virtual timer expired */
43 1 : #define SIGPROF 27 /**< Profiling timer expired */
44 : /* 28 not used */
45 1 : #define SIGPOLL 29 /**< Pollable event occurred */
46 : /* 30 not used */
47 1 : #define SIGSYS 31 /**< Bad system call */
48 :
49 0 : #define SIGRTMIN 32
50 : #if defined(CONFIG_POSIX_REALTIME_SIGNALS) || defined(__DOXYGEN__)
51 : BUILD_ASSERT(CONFIG_POSIX_RTSIG_MAX >= 0);
52 0 : #define SIGRTMAX (SIGRTMIN + CONFIG_POSIX_RTSIG_MAX)
53 : #else
54 : #define SIGRTMAX SIGRTMIN
55 : #endif
56 :
57 0 : typedef struct {
58 0 : unsigned long sig[DIV_ROUND_UP(SIGRTMAX + 1, BITS_PER_LONG)];
59 : } sigset_t;
60 :
61 : #ifndef SIGEV_NONE
62 0 : #define SIGEV_NONE 1
63 : #endif
64 :
65 : #ifndef SIGEV_SIGNAL
66 0 : #define SIGEV_SIGNAL 2
67 : #endif
68 :
69 : #ifndef SIGEV_THREAD
70 0 : #define SIGEV_THREAD 3
71 : #endif
72 :
73 : #ifndef SIG_BLOCK
74 0 : #define SIG_BLOCK 0
75 : #endif
76 : #ifndef SIG_SETMASK
77 0 : #define SIG_SETMASK 1
78 : #endif
79 : #ifndef SIG_UNBLOCK
80 0 : #define SIG_UNBLOCK 2
81 : #endif
82 :
83 0 : #define SIG_DFL ((void *)0)
84 0 : #define SIG_IGN ((void *)1)
85 0 : #define SIG_ERR ((void *)-1)
86 :
87 0 : #define SI_USER 1
88 0 : #define SI_QUEUE 2
89 0 : #define SI_TIMER 3
90 0 : #define SI_ASYNCIO 4
91 0 : #define SI_MESGQ 5
92 :
93 0 : typedef int sig_atomic_t; /* Atomic entity type (ANSI) */
94 :
95 0 : union sigval {
96 0 : void *sival_ptr;
97 0 : int sival_int;
98 : };
99 :
100 0 : struct sigevent {
101 0 : void (*sigev_notify_function)(union sigval val);
102 0 : pthread_attr_t *sigev_notify_attributes;
103 0 : union sigval sigev_value;
104 0 : int sigev_notify;
105 0 : int sigev_signo;
106 : };
107 :
108 0 : typedef struct {
109 0 : int si_signo;
110 0 : int si_code;
111 0 : union sigval si_value;
112 : } siginfo_t;
113 :
114 0 : struct sigaction {
115 0 : void (*sa_handler)(int signno);
116 0 : sigset_t sa_mask;
117 0 : int sa_flags;
118 0 : void (*sa_sigaction)(int signo, siginfo_t *info, void *context);
119 : };
120 :
121 0 : typedef void (*sighandler_t)(int signo);
122 :
123 0 : unsigned int alarm(unsigned int seconds);
124 0 : int kill(pid_t pid, int sig);
125 0 : int pause(void);
126 0 : int raise(int signo);
127 0 : TOOLCHAIN_DISABLE_WARNING(TOOLCHAIN_WARNING_SHADOW);
128 0 : int sigaction(int sig, const struct sigaction *ZRESTRICT act, struct sigaction *ZRESTRICT oact);
129 0 : TOOLCHAIN_ENABLE_WARNING(TOOLCHAIN_WARNING_SHADOW);
130 0 : int sigpending(sigset_t *set);
131 0 : int sigsuspend(const sigset_t *sigmask);
132 0 : int sigwait(const sigset_t *ZRESTRICT set, int *ZRESTRICT signo);
133 0 : char *strsignal(int signum);
134 0 : int sigemptyset(sigset_t *set);
135 0 : int sigfillset(sigset_t *set);
136 0 : int sigaddset(sigset_t *set, int signo);
137 0 : int sigdelset(sigset_t *set, int signo);
138 0 : int sigismember(const sigset_t *set, int signo);
139 0 : sighandler_t signal(int signo, sighandler_t handler);
140 0 : int sigprocmask(int how, const sigset_t *ZRESTRICT set, sigset_t *ZRESTRICT oset);
141 :
142 0 : int pthread_sigmask(int how, const sigset_t *ZRESTRICT set, sigset_t *ZRESTRICT oset);
143 :
144 : #ifdef __cplusplus
145 : }
146 : #endif
147 :
148 : #endif /* ZEPHYR_INCLUDE_POSIX_SIGNAL_H_ */
|