Xenomai 3.3.2
Loading...
Searching...
No Matches
signal.h
1/*
2 * Copyright (C) 2013 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef _COBALT_POSIX_SIGNAL_H
19#define _COBALT_POSIX_SIGNAL_H
20
21#include <linux/signal.h>
22#include <cobalt/kernel/timer.h>
23#include <cobalt/kernel/list.h>
24#include <cobalt/uapi/signal.h>
25#include <xenomai/posix/syscall.h>
26
27struct cobalt_thread;
28
29struct cobalt_sigpending {
30 struct siginfo si;
31 struct list_head next;
32};
33
34static inline
35void cobalt_copy_siginfo(int code,
36 struct siginfo *__restrict__ dst,
37 const struct siginfo *__restrict__ src)
38{
39 dst->si_signo = src->si_signo;
40 dst->si_errno = src->si_errno;
41 dst->si_code = code;
42
43 switch (code) {
44 case SI_TIMER:
45 dst->si_tid = src->si_tid;
46 dst->si_overrun = src->si_overrun;
47 dst->si_value = src->si_value;
48 break;
49 case SI_QUEUE:
50 case SI_MESGQ:
51 dst->si_value = src->si_value;
52 fallthrough;
53 case SI_USER:
54 dst->si_pid = src->si_pid;
55 dst->si_uid = src->si_uid;
56 }
57}
58
59int __cobalt_sigwait(sigset_t *set);
60
61int __cobalt_sigtimedwait(sigset_t *set,
62 const struct timespec64 *timeout,
63 void __user *u_si,
64 bool compat);
65
66int __cobalt_sigwaitinfo(sigset_t *set,
67 void __user *u_si,
68 bool compat);
69
70int __cobalt_sigqueue(pid_t pid, int sig, const union sigval *value);
71
72int cobalt_signal_send(struct cobalt_thread *thread,
73 struct cobalt_sigpending *sigp,
74 int group);
75
76int cobalt_signal_send_pid(pid_t pid,
77 struct cobalt_sigpending *sigp);
78
79struct cobalt_sigpending *cobalt_signal_alloc(void);
80
81void cobalt_signal_free(struct cobalt_sigpending *sigp);
82
83void cobalt_signal_flush(struct cobalt_thread *thread);
84
85int cobalt_signal_wait(sigset_t *set, struct siginfo *si,
86 xnticks_t timeout, xntmode_t tmode);
87
88int __cobalt_kill(struct cobalt_thread *thread,
89 int sig, int group);
90
91COBALT_SYSCALL_DECL(sigwait,
92 (const sigset_t __user *u_set, int __user *u_sig));
93
94COBALT_SYSCALL_DECL(sigtimedwait,
95 (const sigset_t __user *u_set,
96 struct siginfo __user *u_si,
97 const struct __kernel_old_timespec __user *u_timeout));
98
99COBALT_SYSCALL_DECL(sigtimedwait64,
100 (const sigset_t __user *u_set,
101 struct siginfo __user *u_si,
102 const struct __kernel_timespec __user *u_timeout));
103
104COBALT_SYSCALL_DECL(sigwaitinfo,
105 (const sigset_t __user *u_set,
106 struct siginfo __user *u_si));
107
108COBALT_SYSCALL_DECL(sigpending,
109 (old_sigset_t __user *u_set));
110
111COBALT_SYSCALL_DECL(kill, (pid_t pid, int sig));
112
113COBALT_SYSCALL_DECL(sigqueue,
114 (pid_t pid, int sig, const union sigval __user *u_value));
115
116int cobalt_signal_init(void);
117
118void cobalt_signal_cleanup(void);
119
120#endif /* !_COBALT_POSIX_SIGNAL_H */