UbixOS V2  2.0
signal.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2002-2018 The UbixOS Project.
3  * All rights reserved.
4  *
5  * This was developed by Christopher W. Olsen for the UbixOS Project.
6  *
7  * Redistribution and use in source and binary forms, with or without modification, are permitted
8  * provided that the following conditions are met:
9  *
10  * 1) Redistributions of source code must retain the above copyright notice, this list of
11  * conditions, the following disclaimer and the list of authors.
12  * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13  * conditions, the following disclaimer and the list of authors in the documentation and/or
14  * other materials provided with the distribution.
15  * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16  * endorse or promote products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _SYS_SIGNAL_H
30 #define _SYS_SIGNAL_H
31 
32 #include <sys/types.h>
33 
34 #define _SIG_WORDS 4
35 #define _SIG_MAXSIG 128
36 #define _SIG_IDX(sig) ((sig) - 1)
37 #define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
38 #define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
39 #define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
40 
41 // Flags for sigprocmask:
42 #define SIG_BLOCK 1 /* block specified signal set */
43 #define SIG_UNBLOCK 2 /* unblock specified signal set */
44 #define SIG_SETMASK 3 /* set specified signal set */
45 
46 union sigval {
47  /* Members as suggested by Annex C of POSIX 1003.1b. */
48  int sival_int;
49  void *sival_ptr;
50  /* 6.0 compatibility */
52  void *sigval_ptr;
53 };
54 
55 typedef struct __siginfo {
56  int si_signo; /* signal number */
57  int si_errno; /* errno association */
58  /*
59  * Cause of signal, one of the SI_ macros or signal-specific
60  * values, i.e. one of the FPE_... values for SIGFPE. This
61  * value is equivalent to the second argument to an old-style
62  * FreeBSD signal handler.
63  */
64  int si_code; /* signal code */
65  __pid_t si_pid; /* sending process */
66  __uid_t si_uid; /* sender's ruid */
67  int si_status; /* exit value */
68  void *si_addr; /* faulting instruction */
69  union sigval si_value; /* signal value */
70  union {
71  struct {
72  int _trapno;/* machine specific trap code */
73  } _fault;
74  struct {
75  int _timerid;
76  int _overrun;
77  } _timer;
78  struct {
79  int _mqd;
80  } _mesgq;
81  struct {
82  long _band; /* band event for SIGPOLL */
83  } _poll; /* was this ever used ? */
84  struct {
85  long __spare1__;
86  int __spare2__[7];
87  } __spare__;
88  } _reason;
89 } siginfo_t;
90 
91 
92 // Signal vector "template" used in sigaction call.
93 struct sigaction {
94  union {
95  void (*__sa_handler)(int);
96  void (*__sa_sigaction)(int, struct __siginfo *, void *);
97  } __sigaction_u; /* signal handler */
98  int sa_flags; /* see signal options below */
99  sigset_t sa_mask; /* signal mask to apply */
100 };
101 
102 #define sa_handler __sigaction_u.__sa_handler
103 #define sa_sigaction __sigaction_u.__sa_sigaction
104 
105 #endif /* END _SYS_SIGNAL_H */
__siginfo::si_status
int si_status
Definition: signal.h:67
__siginfo::_trapno
int _trapno
Definition: signal.h:72
__siginfo::_mesgq
struct __siginfo::@13::@16 _mesgq
siginfo_t
struct __siginfo siginfo_t
sigaction
Definition: signal.h:93
__siginfo::_band
long _band
Definition: signal.h:82
sigval::sival_ptr
void * sival_ptr
Definition: signal.h:49
__siginfo::__spare1__
long __spare1__
Definition: signal.h:85
__siginfo::_timerid
int _timerid
Definition: signal.h:75
sigaction::__sa_sigaction
void(* __sa_sigaction)(int, struct __siginfo *, void *)
Definition: signal.h:96
__siginfo
Definition: signal.h:55
types.h
__uid_t
__uint32_t __uid_t
Definition: _types.h:50
sigaction::sa_flags
int sa_flags
Definition: signal.h:98
__siginfo::si_pid
__pid_t si_pid
Definition: signal.h:65
__sigset
Definition: _sigset.h:42
__siginfo::si_uid
__uid_t si_uid
Definition: signal.h:66
__siginfo::si_errno
int si_errno
Definition: signal.h:57
__siginfo::_mqd
int _mqd
Definition: signal.h:79
sigval::sigval_ptr
void * sigval_ptr
Definition: signal.h:52
sigval::sigval_int
int sigval_int
Definition: signal.h:51
__siginfo::si_value
union sigval si_value
Definition: signal.h:69
sigval::sival_int
int sival_int
Definition: signal.h:48
sigval
Definition: signal.h:46
__siginfo::__spare2__
int __spare2__[7]
Definition: signal.h:86
__siginfo::si_signo
int si_signo
Definition: signal.h:56
__siginfo::_timer
struct __siginfo::@13::@15 _timer
__pid_t
__int32_t __pid_t
Definition: _types.h:57
__siginfo::_fault
struct __siginfo::@13::@14 _fault
sigaction::__sa_handler
void(* __sa_handler)(int)
Definition: signal.h:95
__siginfo::_poll
struct __siginfo::@13::@17 _poll
sigaction::__sigaction_u
union sigaction::@19 __sigaction_u
__siginfo::si_addr
void * si_addr
Definition: signal.h:68
__siginfo::__spare__
struct __siginfo::@13::@18 __spare__
__siginfo::_reason
union __siginfo::@13 _reason
sigaction::sa_mask
sigset_t sa_mask
Definition: signal.h:99
__siginfo::_overrun
int _overrun
Definition: signal.h:76
__siginfo::si_code
int si_code
Definition: signal.h:64