Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
signal.h
Go to the documentation of this file.
1 
4 #ifndef __SIGNAL_H__
5 #define __SIGNAL_H__
6 
7 #include <sys/types.h>
8 
9 #define SIGUSR1 10
10 #define SIGUSR2 12
11 #define SIGPOLL 29
12 #define SIGSTOP 19
13 #define SIGCONT 18
14 #define SIGKILL 9
15 #define SIGNAL_CNT 6
16 
17 #define SA_SIGINFO 0x2
18 
19 #define SIGEV_NONE 1
20 #define SIGEV_SIGNAL 2
21 
22 typedef uint32_t sigset_t;
23 
24 union sigval {
25  int sival_int;
26  void *sival_ptr;
27 };
28 
29 typedef struct {
30  int si_signo;
31  int si_code;
32  union sigval si_value;
33 } siginfo_t;
34 
35 struct sigaction {
36  union {
37  void (*sa_handler)(int);
38  void (*sa_sigaction)(int, siginfo_t *, void *);
39  };
40  sigset_t sa_mask;
41  int sa_flags;
42 };
43 
44 typedef void (*sa_handler_t)(int);
45 typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
46 
47 struct sigevent {
48  int sigev_notify;
49  int sigev_signo;
50  union sigval sigev_value;
51  void (*sigev_notify_function)(union sigval);
52  void *sigev_notify_attributes;
53  pid_t sigev_notify_thread_id;
54 };
55 
62 int sigemptyset(sigset_t *set);
63 
69 int sigfillset(sigset_t *set);
70 
77 int sigaddset(sigset_t *set, int signum);
78 
85 int sigdelset(sigset_t *set, int signum);
86 
93 int sigismember(const sigset_t *set, int signum);
94 
102 int sigaction(int signum,
103  const struct sigaction *act,
104  struct sigaction *oldact);
105 
113 int sigwait(const sigset_t *set, int *sig);
114 
121 int pause(void);
122 
129 int kill(pid_t pid, int sig);
130 
136 int raise(int sig);
137 
138 #endif
Definition: signal.h:35
Definition: signal.h:47
Definition: signal.h:29
int kill(pid_t pid, int sig)
Send a signal to a task.
Definition: signal.c:131
int pause(void)
To cause the calling task (or thread) to sleep until a signal is delivered that either terminate the ...
Definition: signal.c:112
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
Set up a signal for the task to catch.
Definition: signal.c:100
int sigemptyset(sigset_t *set)
Initialize the signal set given by set to empty, with all signals excluded from the set.
Definition: signal.c:62
int sigismember(const sigset_t *set, int signum)
Test whether sugnum is a member of the set.
Definition: signal.c:94
int sigfillset(sigset_t *set)
Initialize the signal set to full, including all signals.
Definition: signal.c:68
int sigdelset(sigset_t *set, int signum)
Delete a signal from the set.
Definition: signal.c:84
int sigwait(const sigset_t *set, int *sig)
Suspend execution of the calling task until one of the signals specified in the signal set becomes pe...
Definition: signal.c:107
int sigaddset(sigset_t *set, int signum)
Add a signal into the set.
Definition: signal.c:74
Definition: signal.h:24