Xenomai
3.0-rc7
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
signal.h
1
/*
2
* Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
3
* Copyright (C) 2013 Philippe Gerum <rpm@xenomai.org>.
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18
*/
19
#ifndef _COBALT_UAPI_SIGNAL_H
20
#define _COBALT_UAPI_SIGNAL_H
21
22
/*
23
* Those are pseudo-signals only available with pthread_kill() to
24
* suspend/resume/unblock threads synchronously, force them out of
25
* primary mode or even demote them to the SCHED_OTHER class via the
26
* low-level nucleus interface. Can't block those signals, queue them,
27
* or even set them in a sigset. Those are nasty, strictly anti-POSIX
28
* things; we do provide them nevertheless only because we are mean
29
* people doing harmful code for no valid reason. Can't go against
30
* your nature, right? Nah... (this said, don't blame us for POSIX,
31
* we are not _that_ mean).
32
*/
33
#define SIGSUSP (SIGRTMAX + 1)
34
#define SIGRESM (SIGRTMAX + 2)
35
#define SIGRELS (SIGRTMAX + 3)
36
#define SIGKICK (SIGRTMAX + 4)
37
#define SIGDEMT (SIGRTMAX + 5)
38
39
/*
40
* Regular POSIX signals with specific handling by Xenomai.
41
*/
42
#define SIGSHADOW SIGWINCH
43
#define sigshadow_action(code) ((code) & 0xff)
44
#define sigshadow_arg(code) (((code) >> 8) & 0xff)
45
#define sigshadow_int(action, arg) ((action) | ((arg) << 8))
46
47
/* SIGSHADOW action codes. */
48
#define SIGSHADOW_ACTION_HARDEN 1
49
#define SIGSHADOW_ACTION_BACKTRACE 2
50
#define SIGSHADOW_BACKTRACE_DEPTH 16
51
52
#define SIGDEBUG SIGXCPU
53
#define sigdebug_code(si) ((si)->si_value.sival_int)
54
#define sigdebug_reason(si) (sigdebug_code(si) & 0xff)
55
#define sigdebug_marker 0xfccf0000
56
#define sigdebug_marked(si) \
57
((sigdebug_code(si) & 0xffff0000) == sigdebug_marker)
58
59
/* Possible values of sigdebug_reason() */
60
#define SIGDEBUG_UNDEFINED 0
61
#define SIGDEBUG_MIGRATE_SIGNAL 1
62
#define SIGDEBUG_MIGRATE_SYSCALL 2
63
#define SIGDEBUG_MIGRATE_FAULT 3
64
#define SIGDEBUG_MIGRATE_PRIOINV 4
65
#define SIGDEBUG_NOMLOCK 5
66
#define SIGDEBUG_WATCHDOG 6
67
#define SIGDEBUG_RESCNT_IMBALANCE 7
68
#define SIGDEBUG_LOCK_BREAK 8
69
#define SIGDEBUG_MUTEX_SLEEP 9
70
71
#define COBALT_DELAYMAX 2147483647U
72
73
/*
74
* Internal accessors to extra siginfo/sigevent fields, extending some
75
* existing base field. The extra data should be grouped in a
76
* dedicated struct type. The extra space is taken from the padding
77
* area available from the original structure definitions.
78
*
79
* e.g. getting the address of the following extension to
80
* _sifields._rt from siginfo_t,
81
*
82
* struct bar {
83
* int foo;
84
* };
85
*
86
* would be noted as:
87
*
88
* siginfo_t si;
89
* struct bar *p = __cobalt_si_extra(&si, _rt, struct bar);
90
*
91
* This code is shared between kernel and user space. Proper
92
* definitions of siginfo_t and sigevent_t should have been read prior
93
* to including this file.
94
*
95
* CAUTION: this macro does not handle alignment issues for the extra
96
* data. The extra type definition should take care of this.
97
*/
98
#ifdef __OPTIMIZE__
99
extern
void
*__siginfo_overflow(
void
);
100
static
inline
101
const
void
*__check_si_overflow(
size_t
fldsz,
size_t
extrasz,
const
void
*p)
102
{
103
siginfo_t *si __attribute__((unused));
104
105
if
(fldsz + extrasz <=
sizeof
(si->_sifields))
106
return
p;
107
108
return
__siginfo_overflow();
109
}
110
#define __cobalt_si_extra(__si, __basefield, __type) \
111
((__type *)__check_si_overflow(sizeof(__si->_sifields.__basefield), \
112
sizeof(__type), &(__si->_sifields.__basefield) + 1))
113
#else
114
#define __cobalt_si_extra(__si, __basefield, __type) \
115
((__type *)((&__si->_sifields.__basefield) + 1))
116
#endif
117
118
/* Same approach, this time for extending sigevent_t. */
119
120
#ifdef __OPTIMIZE__
121
extern
void
*__sigevent_overflow(
void
);
122
static
inline
123
const
void
*__check_sev_overflow(
size_t
fldsz,
size_t
extrasz,
const
void
*p)
124
{
125
sigevent_t *sev __attribute__((unused));
126
127
if
(fldsz + extrasz <=
sizeof
(sev->_sigev_un))
128
return
p;
129
130
return
__sigevent_overflow();
131
}
132
#define __cobalt_sev_extra(__sev, __basefield, __type) \
133
((__type *)__check_sev_overflow(sizeof(__sev->_sigev_un.__basefield), \
134
sizeof(__type), &(__sev->_sigev_un.__basefield) + 1))
135
#else
136
#define __cobalt_sev_extra(__sev, __basefield, __type) \
137
((__type *)((&__sev->_sigev_un.__basefield) + 1))
138
#endif
139
140
#endif
/* !_COBALT_UAPI_SIGNAL_H */
include
cobalt
uapi
signal.h
Generated by
1.8.9.1