Xenomai
3.0-rc3
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
70
#define COBALT_DELAYMAX 2147483647U
71
72
/*
73
* Internal accessors to extra siginfo/sigevent fields, extending some
74
* existing base field. The extra data should be grouped in a
75
* dedicated struct type. The extra space is taken from the padding
76
* area available from the original structure definitions.
77
*
78
* e.g. getting the address of the following extension to
79
* _sifields._rt from siginfo_t,
80
*
81
* struct bar {
82
* int foo;
83
* };
84
*
85
* would be noted as:
86
*
87
* siginfo_t si;
88
* struct bar *p = __cobalt_si_extra(&si, _rt, struct bar);
89
*
90
* This code is shared between kernel and user space. Proper
91
* definitions of siginfo_t and sigevent_t should have been read prior
92
* to including this file.
93
*
94
* CAUTION: this macro does not handle alignment issues for the extra
95
* data. The extra type definition should take care of this.
96
*/
97
#ifdef __OPTIMIZE__
98
extern
void
*__siginfo_overflow(
void
);
99
static
inline
100
const
void
*__check_si_overflow(
size_t
fldsz,
size_t
extrasz,
const
void
*p)
101
{
102
siginfo_t *si __attribute__((unused));
103
104
if
(fldsz + extrasz <=
sizeof
(si->_sifields))
105
return
p;
106
107
return
__siginfo_overflow();
108
}
109
#define __cobalt_si_extra(__si, __basefield, __type) \
110
((__type *)__check_si_overflow(sizeof(__si->_sifields.__basefield), \
111
sizeof(__type), &(__si->_sifields.__basefield) + 1))
112
#else
113
#define __cobalt_si_extra(__si, __basefield, __type) \
114
((__type *)((&__si->_sifields.__basefield) + 1))
115
#endif
116
117
/* Same approach, this time for extending sigevent_t. */
118
119
#ifdef __OPTIMIZE__
120
extern
void
*__sigevent_overflow(
void
);
121
static
inline
122
const
void
*__check_sev_overflow(
size_t
fldsz,
size_t
extrasz,
const
void
*p)
123
{
124
sigevent_t *sev __attribute__((unused));
125
126
if
(fldsz + extrasz <=
sizeof
(sev->_sigev_un))
127
return
p;
128
129
return
__sigevent_overflow();
130
}
131
#define __cobalt_sev_extra(__sev, __basefield, __type) \
132
((__type *)__check_sev_overflow(sizeof(__sev->_sigev_un.__basefield), \
133
sizeof(__type), &(__sev->_sigev_un.__basefield) + 1))
134
#else
135
#define __cobalt_sev_extra(__sev, __basefield, __type) \
136
((__type *)((&__sev->_sigev_un.__basefield) + 1))
137
#endif
138
139
#endif
/* !_COBALT_UAPI_SIGNAL_H */
include
cobalt
uapi
signal.h
Generated by
1.8.8