Mercurial > octave
annotate liboctave/wrappers/signal-wrappers.c @ 31792:30b6a8be7128 stable
attempt to avoid race condition when initializing list of async signals
* cxx-signal-helpers.cc: New file. Move
(async_signals): New file-scope static const variable.
(octave_block_async_signals, octave_unblock_async_signals,
signal_watcher, octave_create_interrupt_watcher_thread):
Move functions here from signal-wrappers.c. Use file-scope
async_signals variable instead of calling octave_async_signals to get
list of asynchronous signals.
(init_async_signals): Rename from octave_async_signals and move here
from signal-wrappers.cc. Return sigset_t object instead of pointer to
static storage that is local to the function.
* module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Dec 2022 13:57:18 -0500 |
parents | 597f3ee61a48 |
children | 0aa88d03fa50 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
3 // Copyright (C) 2016-2023 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
21938 | 25 |
26 // These functions may be provided by gnulib. We don't include gnulib | |
27 // headers directly in Octave's C++ source files to avoid problems that | |
28 // may be caused by the way that gnulib overrides standard library | |
29 // functions. | |
30 | |
31 #if defined (HAVE_CONFIG_H) | |
32 # include "config.h" | |
33 #endif | |
34 | |
35 #include <sys/types.h> | |
36 #include <signal.h> | |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
37 #include <stdio.h> |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
38 #include <stdlib.h> |
21938 | 39 #include <string.h> |
40 | |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
41 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
42 # include <windows.h> |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
43 #else |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
44 # include <pthread.h> |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
45 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
46 |
21938 | 47 #include "signal-wrappers.h" |
48 | |
21940 | 49 int |
50 octave_kill_wrapper (pid_t pid, int signum) | |
51 { | |
21949
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21941
diff
changeset
|
52 #if defined (HAVE_KILL) |
21940 | 53 return kill (pid, signum); |
29710
97e12df28ee6
make interrupts work in GUI command window again (bug #60079)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
54 #elif defined (HAVE_RAISE) |
97e12df28ee6
make interrupts work in GUI command window again (bug #60079)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
55 octave_unused_parameter (pid); |
97e12df28ee6
make interrupts work in GUI command window again (bug #60079)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
56 |
97e12df28ee6
make interrupts work in GUI command window again (bug #60079)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
57 return raise (signum); |
21949
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21941
diff
changeset
|
58 #else |
24118
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
59 octave_unused_parameter (pid); |
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
60 octave_unused_parameter (signum); |
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
61 |
21949
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21941
diff
changeset
|
62 return -1; |
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21941
diff
changeset
|
63 #endif |
21940 | 64 } |
65 | |
21938 | 66 char * |
67 octave_strsignal_wrapper (int signum) | |
68 { | |
69 return strsignal (signum); | |
70 } | |
21940 | 71 |
72 bool | |
73 octave_have_kill (void) | |
74 { | |
75 #if defined (HAVE_KILL) | |
76 return true; | |
77 #else | |
78 return false; | |
79 #endif | |
80 } | |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
81 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
82 bool |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
83 octave_get_sig_number (const char *signame, int *signum) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
84 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
85 *signum = -1; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
86 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
87 // FIXME: this should probably use a perfect hash function. |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
88 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
89 if (! strcmp (signame, "SIGINT")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
90 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
91 #if defined (SIGINT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
92 *signum = SIGINT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
93 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
94 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
95 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
96 else if (! strcmp (signame, "SIGBREAK")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
97 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
98 #if defined (SIGBREAK) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
99 *signum = SIGBREAK; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
100 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
101 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
102 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
103 else if (! strcmp (signame, "SIGABRT")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
104 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
105 #if defined (SIGABRT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
106 *signum = SIGABRT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
107 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
108 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
109 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
110 else if (! strcmp (signame, "SIGALRM")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
111 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
112 #if defined (SIGALRM) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
113 *signum = SIGALRM; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
114 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
115 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
116 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
117 else if (! strcmp (signame, "SIGBUS")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
118 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
119 #if defined (SIGBUS) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
120 *signum = SIGBUS; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
121 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
122 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
123 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
124 else if (! strcmp (signame, "SIGCHLD")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
125 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
126 #if defined (SIGCHLD) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
127 *signum = SIGCHLD; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
128 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
129 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
130 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
131 else if (! strcmp (signame, "SIGCLD")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
132 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
133 #if defined (SIGCLD) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
134 *signum = SIGCLD; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
135 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
136 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
137 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
138 else if (! strcmp (signame, "SIGCONT")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
139 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
140 #if defined (SIGCONT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
141 *signum = SIGCONT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
142 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
143 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
144 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
145 else if (! strcmp (signame, "SIGEMT")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
146 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
147 #if defined (SIGEMT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
148 *signum = SIGEMT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
149 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
150 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
151 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
152 else if (! strcmp (signame, "SIGFPE")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
153 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
154 #if defined (SIGFPE) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
155 *signum = SIGFPE; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
156 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
157 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
158 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
159 else if (! strcmp (signame, "SIGHUP")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
160 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
161 #if defined (SIGHUP) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
162 *signum = SIGHUP; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
163 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
164 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
165 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
166 else if (! strcmp (signame, "SIGILL")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
167 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
168 #if defined (SIGILL) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
169 *signum = SIGILL; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
170 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
171 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
172 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
173 else if (! strcmp (signame, "SIGINFO")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
174 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
175 #if defined (SIGINFO) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
176 *signum = SIGINFO; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
177 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
178 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
179 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
180 else if (! strcmp (signame, "SIGIOT")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
181 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
182 #if defined (SIGIOT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
183 *signum = SIGIOT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
184 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
185 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
186 } |
27650
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
187 else if (! strcmp (signame, "SIGKILL")) |
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
188 { |
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
189 #if defined (SIGKILL) |
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
190 *signum = SIGKILL; |
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
191 return true; |
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
192 #endif |
2c8fc292ff2c
include SIGKILL in the SIG structure of known signals (bug #57183)
Mike Miller <mtmiller@octave.org>
parents:
26379
diff
changeset
|
193 } |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
194 else if (! strcmp (signame, "SIGLOST")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
195 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
196 #if defined (SIGLOST) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
197 *signum = SIGLOST; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
198 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
199 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
200 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
201 else if (! strcmp (signame, "SIGPIPE")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
202 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
203 #if defined (SIGPIPE) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
204 *signum = SIGPIPE; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
205 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
206 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
207 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
208 else if (! strcmp (signame, "SIGPOLL")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
209 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
210 #if defined (SIGPOLL) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
211 *signum = SIGPOLL; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
212 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
213 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
214 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
215 else if (! strcmp (signame, "SIGPROF")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
216 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
217 #if defined (SIGPROF) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
218 *signum = SIGPROF; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
219 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
220 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
221 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
222 else if (! strcmp (signame, "SIGPWR")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
223 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
224 #if defined (SIGPWR) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
225 *signum = SIGPWR; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
226 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
227 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
228 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
229 else if (! strcmp (signame, "SIGQUIT")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
230 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
231 #if defined (SIGQUIT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
232 *signum = SIGQUIT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
233 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
234 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
235 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
236 else if (! strcmp (signame, "SIGSEGV")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
237 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
238 #if defined (SIGSEGV) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
239 *signum = SIGSEGV; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
240 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
241 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
242 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
243 else if (! strcmp (signame, "SIGSTOP")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
244 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
245 #if defined (SIGSTOP) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
246 *signum = SIGSTOP; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
247 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
248 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
249 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
250 else if (! strcmp (signame, "SIGSYS")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
251 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
252 #if defined (SIGSYS) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
253 *signum = SIGSYS; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
254 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
255 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
256 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
257 else if (! strcmp (signame, "SIGTERM")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
258 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
259 #if defined (SIGTERM) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
260 *signum = SIGTERM; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
261 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
262 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
263 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
264 else if (! strcmp (signame, "SIGTRAP")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
265 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
266 #if defined (SIGTRAP) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
267 *signum = SIGTRAP; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
268 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
269 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
270 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
271 else if (! strcmp (signame, "SIGTSTP")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
272 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
273 #if defined (SIGTSTP) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
274 *signum = SIGTSTP; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
275 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
276 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
277 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
278 else if (! strcmp (signame, "SIGTTIN")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
279 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
280 #if defined (SIGTTIN) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
281 *signum = SIGTTIN; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
282 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
283 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
284 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
285 else if (! strcmp (signame, "SIGTTOU")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
286 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
287 #if defined (SIGTTOU) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
288 *signum = SIGTTOU; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
289 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
290 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
291 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
292 else if (! strcmp (signame, "SIGURG")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
293 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
294 #if defined (SIGURG) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
295 *signum = SIGURG; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
296 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
297 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
298 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
299 else if (! strcmp (signame, "SIGUSR1")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
300 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
301 #if defined (SIGUSR1) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
302 *signum = SIGUSR1; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
303 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
304 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
305 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
306 else if (! strcmp (signame, "SIGUSR2")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
307 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
308 #if defined (SIGUSR2) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
309 *signum = SIGUSR2; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
310 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
311 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
312 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
313 else if (! strcmp (signame, "SIGVTALRM")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
314 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
315 #if defined (SIGVTALRM) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
316 *signum = SIGVTALRM; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
317 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
318 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
319 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
320 else if (! strcmp (signame, "SIGIO")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
321 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
322 #if defined (SIGIO) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
323 *signum = SIGIO; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
324 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
325 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
326 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
327 else if (! strcmp (signame, "SIGWINCH")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
328 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
329 #if defined (SIGWINCH) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
330 *signum = SIGWINCH; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
331 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
332 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
333 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
334 else if (! strcmp (signame, "SIGXCPU")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
335 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
336 #if defined (SIGXCPU) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
337 *signum = SIGXCPU; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
338 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
339 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
340 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
341 else if (! strcmp (signame, "SIGXFSZ")) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
342 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
343 #if defined (SIGXFSZ) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
344 *signum = SIGXFSZ; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
345 return true; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
346 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
347 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
348 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
349 return false; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
350 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
351 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
352 octave_sig_handler * |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
353 octave_set_signal_handler_internal (int sig, octave_sig_handler *handler, |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
354 bool restart_syscalls) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
355 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
356 struct sigaction act, oact; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
357 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
358 act.sa_handler = handler; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
359 act.sa_flags = 0; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
360 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
361 #if defined (SIGALRM) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
362 if (sig == SIGALRM) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
363 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
364 # if defined (SA_INTERRUPT) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
365 act.sa_flags |= SA_INTERRUPT; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
366 # endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
367 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
368 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
369 #if defined (SA_RESTART) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
370 # if defined (SIGALRM) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
371 else |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
372 # endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
373 // FIXME: Do we also need to explicitly disable SA_RESTART? |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
374 if (restart_syscalls) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
375 act.sa_flags |= SA_RESTART; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
376 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
377 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
378 sigemptyset (&act.sa_mask); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
379 sigemptyset (&oact.sa_mask); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
380 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
381 sigaction (sig, &act, &oact); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
382 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
383 return oact.sa_handler; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
384 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
385 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
386 octave_sig_handler * |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
387 octave_set_signal_handler_by_name (const char *signame, |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
388 octave_sig_handler *handler, |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
389 bool restart_syscalls) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
390 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
391 int sig; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
392 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
393 return (octave_get_sig_number (signame, &sig) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
394 ? octave_set_signal_handler_internal (sig, handler, restart_syscalls) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
395 : 0); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
396 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
397 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
398 octave_sig_handler * |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
399 octave_set_default_signal_handler (int sig) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
400 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
401 return octave_set_signal_handler_internal (sig, SIG_DFL, true); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
402 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
403 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
404 octave_sig_handler * |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
405 octave_set_default_signal_handler_by_name (const char *signame) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
406 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
407 return octave_set_signal_handler_by_name (signame, SIG_DFL, true); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
408 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
409 |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
410 int |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
411 octave_num_signals (void) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
412 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
413 return NSIG; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
414 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
415 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
416 typedef struct |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
417 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
418 sigset_t nvar; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
419 sigset_t ovar; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
420 } sigset_info; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
421 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
422 void * |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
423 octave_block_child (void) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
424 { |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
425 #if defined (SIGCHLD) || defined (SIGCLD) |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
426 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
427 sigset_info *context = (sigset_info *) malloc (sizeof (sigset_info)); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
428 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
429 if (context) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
430 { |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
431 sigemptyset (&(context->ovar)); |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
432 sigemptyset (&(context->nvar)); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
433 #if defined (SIGCHLD) |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
434 sigaddset (&(context->nvar), SIGCHLD); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
435 #endif |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
436 #if defined (SIGCLD) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
437 sigaddset (&(context->nvar), SIGCLD); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
438 #endif |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
439 sigprocmask (SIG_BLOCK, &(context->nvar), &(context->ovar)); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
440 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
441 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
442 return context; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
443 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
444 #else |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
445 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
446 return 0; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
447 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
448 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
449 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
450 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
451 void |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
452 octave_unblock_child (void *context_arg) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
453 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
454 if (context_arg) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
455 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
456 sigset_info *context = (sigset_info *) context_arg; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
457 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
458 sigprocmask (SIG_SETMASK, &(context->ovar), 0); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
459 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
460 free (context); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
461 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
462 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
463 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
464 static void |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
465 block_or_unblock_signal (int how, int sig) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
466 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
467 #if ! defined (__WIN32__) || defined (__CYGWIN__) |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
468 |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
469 // Blocking/unblocking signals at thread level is only supported |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
470 // on platform with fully compliant POSIX threads. This is not |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
471 // supported on Win32. Moreover, we have to make sure that SIGINT |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
472 // handler is not installed before calling AllocConsole: installing |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
473 // a SIGINT handler internally calls SetConsoleCtrlHandler, which |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
474 // must be called after AllocConsole to be effective. |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
475 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
476 sigset_t signal_mask; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
477 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
478 sigemptyset (&signal_mask); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
479 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
480 sigaddset (&signal_mask, sig); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
481 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
482 pthread_sigmask (how, &signal_mask, 0); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
483 |
24118
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
484 #else |
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
485 |
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
486 octave_unused_parameter (how); |
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
487 octave_unused_parameter (sig); |
f87c9f5c0f43
maint: silence several compiler warnings when building for Windows
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
488 |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
489 #endif |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
490 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
491 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
492 void |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
493 octave_block_interrupt_signal (void) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
494 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
495 block_or_unblock_signal (SIG_BLOCK, SIGINT); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
496 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
497 #if defined (SIGBREAK) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
498 block_or_unblock_signal (SIG_BLOCK, SIGBREAK); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
499 #endif |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
500 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
501 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
502 void |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
503 octave_unblock_interrupt_signal (void) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
504 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
505 block_or_unblock_signal (SIG_UNBLOCK, SIGINT); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
506 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
507 #if defined (SIGBREAK) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
508 block_or_unblock_signal (SIG_UNBLOCK, SIGBREAK); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
509 #endif |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
510 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
511 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
512 static void |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
513 block_or_unblock_signal_by_name (int how, const char *signame) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
514 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
515 int sig; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
516 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
517 if (octave_get_sig_number (signame, &sig)) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
518 block_or_unblock_signal (how, sig); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
519 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
520 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
521 void |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
522 octave_block_signal_by_name (const char *signame) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
523 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
524 block_or_unblock_signal_by_name (SIG_BLOCK, signame); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
525 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
526 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
527 void |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
528 octave_unblock_signal_by_name (const char *signame) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
529 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
530 block_or_unblock_signal_by_name (SIG_UNBLOCK, signame); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
531 } |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
532 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
533 /* Allow us to save the signal mask and then restore it to the most |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
534 recently saved value. This is necessary when using the POSIX signal |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
535 handling interface on some systems calling longjmp out of the signal |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
536 handler to get to the top level on an interrupt doesn't restore the |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
537 original signal mask. Alternatively, we could use |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
538 sigsetjmp/siglongjmp, but saving and restoring the signal mask |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
539 ourselves works ok and seems simpler just now. */ |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
540 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
541 static sigset_t octave_signal_mask; |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
542 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
543 void |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
544 octave_save_signal_mask (void) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
545 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
546 sigprocmask (0, 0, &octave_signal_mask); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
547 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
548 |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
549 void |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
550 octave_restore_signal_mask (void) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
551 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
552 sigprocmask (SIG_SETMASK, &octave_signal_mask, 0); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
553 } |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
554 |
25284
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
555 void * |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
556 octave_alloc_signal_mask (void) |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
557 { |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
558 return malloc (sizeof (sigset_t)); |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
559 } |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
560 |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
561 void |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
562 octave_free_signal_mask (void *mask) |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
563 { |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
564 free (mask); |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
565 } |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
566 |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
567 void |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
568 octave_get_signal_mask (void *mask) |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
569 { |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
570 sigprocmask (0, 0, mask); |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
571 } |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
572 |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
573 void |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
574 octave_set_signal_mask (void *mask) |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
575 { |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
576 sigprocmask (SIG_SETMASK, (sigset_t *) mask, 0); |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
577 } |
78fb24bdd8bb
unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
578 |
21941
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
579 int |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
580 octave_raise_wrapper (int signum) |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
581 { |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
582 return raise (signum); |
1d23b75cbcd1
hide signal.h from C++ sources
John W. Eaton <jwe@octave.org>
parents:
21940
diff
changeset
|
583 } |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
584 |
24683
328053e1d232
Avoid warnings when compiling for win32 (bug #53049)
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
585 #if ! defined (__WIN32__) |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
586 static void |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
587 print_sigset (FILE *of, const char *prefix, const sigset_t *sigset) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
588 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
589 int sig; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
590 int cnt = 0; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
591 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
592 for (sig = 1; sig < NSIG; sig++) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
593 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
594 if (sigismember (sigset, sig)) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
595 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
596 cnt++; |
25683
bbbf0d961a94
avoid fprintf format warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25284
diff
changeset
|
597 fprintf (of, "%ld: %s%d (%s)\n", (long int) pthread_self (), |
bbbf0d961a94
avoid fprintf format warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25284
diff
changeset
|
598 prefix, sig, strsignal (sig)); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
599 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
600 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
601 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
602 if (cnt == 0) |
25683
bbbf0d961a94
avoid fprintf format warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25284
diff
changeset
|
603 fprintf (of, "%ld: %s<empty signal set>\n", (long int) pthread_self (), |
bbbf0d961a94
avoid fprintf format warning on some systems
John W. Eaton <jwe@octave.org>
parents:
25284
diff
changeset
|
604 prefix); |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
605 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
606 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
607 static int |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
608 print_sigmask (FILE *of, const char *msg) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
609 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
610 sigset_t sigmask; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
611 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
612 if (msg) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
613 fprintf (of, "%s", msg); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
614 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
615 if (pthread_sigmask (SIG_BLOCK, NULL, &sigmask) == -1) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
616 return -1; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
617 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
618 print_sigset (of, "\t\t", &sigmask); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
619 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
620 return 0; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
621 } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
622 #endif |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
623 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
624 void |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
625 octave_show_sigmask (const char *msg) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
626 { |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
627 #if ! defined (__WIN32__) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
628 if (! msg) |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
629 msg = "signal mask\n"; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
630 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
631 print_sigmask (stderr, msg); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
632 #else |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
633 octave_unused_parameter (msg); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
634 |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
635 fputs ("no signal mask on Windows systems\n", stderr); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
636 #endif |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
24118
diff
changeset
|
637 } |