1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
/* -*- C++ -*- */
// $Id$
// Signal.i
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss)
: sigset_ (*ss) // Structure assignment
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
}
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (int fill)
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
if (fill)
ACE_OS::sigfillset (&this->sigset_);
else
ACE_OS::sigemptyset (&this->sigset_);
}
ACE_INLINE
ACE_Sig_Set::~ACE_Sig_Set (void)
{
ACE_TRACE ("ACE_Sig_Set::~ACE_Sig_Set");
ACE_OS::sigemptyset (&this->sigset_);
}
ACE_INLINE int
ACE_Sig_Set::empty_set (void)
{
ACE_TRACE ("ACE_Sig_Set::empty_set");
return ACE_OS::sigemptyset (&this->sigset_);
}
ACE_INLINE int
ACE_Sig_Set::fill_set (void)
{
ACE_TRACE ("ACE_Sig_Set::fill_set");
return ACE_OS::sigfillset (&this->sigset_);
}
ACE_INLINE int
ACE_Sig_Set::sig_add (int signo)
{
ACE_TRACE ("ACE_Sig_Set::sig_add");
return ACE_OS::sigaddset (&this->sigset_, signo);
}
ACE_INLINE int
ACE_Sig_Set::sig_del (int signo)
{
ACE_TRACE ("ACE_Sig_Set::sig_del");
return ACE_OS::sigdelset (&this->sigset_, signo);
}
ACE_INLINE int
ACE_Sig_Set::is_member (int signo) const
{
ACE_TRACE ("ACE_Sig_Set::is_member");
return ACE_OS::sigismember ((sigset_t *) &this->sigset_, signo);
}
ACE_INLINE
ACE_Sig_Set::operator sigset_t *(void)
{
ACE_TRACE ("ACE_Sig_Set::operator sigset_t *");
return &this->sigset_;
}
ACE_INLINE sigset_t
ACE_Sig_Set::sigset (void)
{
ACE_TRACE ("ACE_Sig_Set::sigset");
return this->sigset_;
}
ACE_INLINE int
ACE_Sig_Action::flags (void)
{
ACE_TRACE ("ACE_Sig_Action::flags");
return this->sa_.sa_flags;
}
ACE_INLINE void
ACE_Sig_Action::flags (int flags)
{
ACE_TRACE ("ACE_Sig_Action::flags");
this->sa_.sa_flags = flags;
}
ACE_INLINE sigset_t *
ACE_Sig_Action::mask (void)
{
ACE_TRACE ("ACE_Sig_Action::mask");
return &this->sa_.sa_mask;
}
ACE_INLINE void
ACE_Sig_Action::mask (sigset_t *ss)
{
ACE_TRACE ("ACE_Sig_Action::mask");
if (ss != 0)
this->sa_.sa_mask = *ss; // Structure assignment
}
ACE_INLINE void
ACE_Sig_Action::mask (ACE_Sig_Set &ss)
{
ACE_TRACE ("ACE_Sig_Action::mask");
this->sa_.sa_mask = ss.sigset (); // Structure assignment
}
ACE_INLINE ACE_SignalHandler
ACE_Sig_Action::handler (void)
{
ACE_TRACE ("ACE_Sig_Action::handler");
return ACE_SignalHandler (this->sa_.sa_handler);
}
ACE_INLINE void
ACE_Sig_Action::handler (ACE_SignalHandler handler)
{
ACE_TRACE ("ACE_Sig_Action::handler");
#if !defined(ACE_HAS_TANDEM_SIGNALS)
this->sa_.sa_handler = ACE_SignalHandlerV (handler);
#else
this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (handler);
#endif /* !ACE_HAS_TANDEM_SIGNALS */
}
ACE_INLINE void
ACE_Sig_Action::set (struct sigaction *sa)
{
ACE_TRACE ("ACE_Sig_Action::set");
this->sa_ = *sa; // Structure assignment.
}
ACE_INLINE struct sigaction *
ACE_Sig_Action::get (void)
{
ACE_TRACE ("ACE_Sig_Action::get");
return &this->sa_;
}
ACE_INLINE
ACE_Sig_Action::operator ACE_SIGACTION * ()
{
ACE_TRACE ("ACE_Sig_Action::operator ACE_SIGACTION *");
return &this->sa_;
}
ACE_INLINE
ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Action &s)
{
ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action");
*this = s; // structure copy.
}
ACE_INLINE int
ACE_Sig_Action::register_action (int signum, ACE_Sig_Action *oaction)
{
ACE_TRACE ("ACE_Sig_Action::register_action");
struct sigaction *sa = oaction == 0 ? 0 : oaction->get ();
return ACE_OS::sigaction (signum, &this->sa_, sa);
}
ACE_INLINE int
ACE_Sig_Action::retrieve_action (int signum)
{
ACE_TRACE ("ACE_Sig_Action::retrieve_action");
return ACE_OS::sigaction (signum, 0, &this->sa_);
}
ACE_INLINE int
ACE_Sig_Action::restore_action (int signum, ACE_Sig_Action &oaction)
{
ACE_TRACE ("ACE_Sig_Action::restore_action");
this->sa_ = *oaction.get (); // Structure assignment
return ACE_OS::sigaction (signum, &this->sa_, 0);
}
// Block out the signal MASK until the destructor is called.
ACE_INLINE
ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask)
{
//ACE_TRACE ("ACE_Sig_Guard::ACE_Sig_Guard");
// If MASK is 0 then block all signals!
if (mask == 0)
{
ACE_Sig_Set smask (1);
#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
ACE_OS::sigprocmask (SIG_BLOCK, (sigset_t *) smask, (sigset_t *)
this->omask_);
#else
ACE_OS::thr_sigsetmask (SIG_BLOCK, (sigset_t *) smask, (sigset_t *)
this->omask_);
#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
}
else
#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
ACE_OS::sigprocmask (SIG_BLOCK, (sigset_t *) *mask, (sigset_t *)
this->omask_);
#else
ACE_OS::thr_sigsetmask (SIG_BLOCK, (sigset_t *) *mask, (sigset_t *)
this->omask_);
#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
}
// Restore the signal mask.
ACE_INLINE
ACE_Sig_Guard::~ACE_Sig_Guard (void)
{
//ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard");
#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK)
ACE_OS::sigprocmask (SIG_SETMASK, (sigset_t *) this->omask_, 0);
#else
ACE_OS::thr_sigsetmask (SIG_SETMASK, (sigset_t *) this->omask_, 0);
#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */
}
ACE_INLINE int
ACE_Sig_Handler::in_range (int signum)
{
ACE_TRACE ("ACE_Sig_Handler::in_range");
return signum > 0 && signum < NSIG;
}
|