Mercurial > hg > octave-nkf
annotate src/sighandlers.cc @ 14861:f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
* bitfcns.cc, comment-list.cc, data.cc, defun.cc, error.cc, gl-render.cc,
graphics.cc, graphics.in.h, load-path.cc, load-path.h, load-save.cc,
ls-hdf5.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-ascii.cc, mappers.cc, mex.cc,
oct-map.cc, oct-obj.cc, ov-base-int.cc, ov-base-mat.h, ov-base-sparse.cc,
ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-class.cc, ov-complex.cc,
ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc,
ov-flt-re-mat.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc,
ov-struct.cc, ov-usr-fcn.cc, ov.cc, pr-output.cc, procstream.h, sighandlers.cc,
sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, symtab.cc, syscalls.cc, sysdep.cc,
txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h: Use Octave coding
conventions for cuddling parentheses.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 14 Jul 2012 06:22:56 -0700 |
parents | 47fba1dc31b8 |
children | 577df411e0c7 |
rev | line source |
---|---|
1 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13983
diff
changeset
|
3 Copyright (C) 1993-2012 John W. Eaton |
1 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
240 | 23 #ifdef HAVE_CONFIG_H |
1230 | 24 #include <config.h> |
1 | 25 #endif |
26 | |
2536 | 27 #include <cstdlib> |
28 | |
3503 | 29 #include <iostream> |
1344 | 30 #include <new> |
31 | |
834 | 32 #include <sys/types.h> |
33 #include <unistd.h> | |
1343 | 34 |
3281 | 35 #include "cmd-edit.h" |
5453 | 36 #include "oct-syscalls.h" |
4153 | 37 #include "quit.h" |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
38 #include "singleton-cleanup.h" |
3281 | 39 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7481
diff
changeset
|
40 #include "debug.h" |
4185 | 41 #include "defun.h" |
1352 | 42 #include "error.h" |
10194 | 43 #include "input.h" |
1373 | 44 #include "load-save.h" |
4294 | 45 #include "oct-map.h" |
2091 | 46 #include "pager.h" |
4185 | 47 #include "pt-bp.h" |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7481
diff
changeset
|
48 #include "pt-eval.h" |
1 | 49 #include "sighandlers.h" |
4787 | 50 #include "sysdep.h" |
1352 | 51 #include "syswait.h" |
2091 | 52 #include "toplev.h" |
1 | 53 #include "utils.h" |
5794 | 54 #include "variables.h" |
1 | 55 |
56 // Nonzero means we have already printed a message for this series of | |
57 // SIGPIPES. We assume that the writer will eventually give up. | |
58 int pipe_handler_error_count = 0; | |
59 | |
3018 | 60 // TRUE means we can be interrupted. |
61 bool can_interrupt = false; | |
1 | 62 |
4185 | 63 // TRUE means we should try to enter the debugger on SIGINT. |
64 static bool Vdebug_on_interrupt = false; | |
65 | |
4449 | 66 // Allow users to avoid writing octave-core for SIGHUP (sent by |
67 // closing gnome-terminal, for example). Note that this variable has | |
68 // no effect if Vcrash_dumps_octave_core is FALSE. | |
5794 | 69 static bool Vsighup_dumps_octave_core = true; |
4449 | 70 |
71 // Similar to Vsighup_dumps_octave_core, but for SIGTERM signal. | |
5794 | 72 static bool Vsigterm_dumps_octave_core = true; |
4449 | 73 |
5142 | 74 // List of signals we have caught since last call to octave_signal_handler. |
75 static bool octave_signals_caught[NSIG]; | |
76 | |
11525
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
77 // Signal handler return type. |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
78 #ifndef BADSIG |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
79 #define BADSIG (void (*)(int))-1 |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
80 #endif |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
81 |
14338
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
82 // The following is a workaround for an apparent bug in GCC 4.1.2 and |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
83 // possibly earlier versions. See Octave bug report #30685 for details. |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
84 #if defined (__GNUC__) |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
85 # if ! (__GNUC__ > 4 \ |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
86 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 \ |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
87 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 2)))) |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
88 # undef GNULIB_NAMESPACE |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
89 # define GNULIB_NAMESPACE |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
90 # warning "disabling GNULIB_NAMESPACE for signal functions -- consider upgrading to a current version of GCC" |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
91 # endif |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
92 #endif |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
93 |
11525
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
94 #define BLOCK_SIGNAL(sig, nvar, ovar) \ |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
95 do \ |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
96 { \ |
14338
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
97 GNULIB_NAMESPACE::sigemptyset (&nvar); \ |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
98 GNULIB_NAMESPACE::sigaddset (&nvar, sig); \ |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
99 GNULIB_NAMESPACE::sigemptyset (&ovar); \ |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
100 GNULIB_NAMESPACE::sigprocmask (SIG_BLOCK, &nvar, &ovar); \ |
11525
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
101 } \ |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
102 while (0) |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
103 |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
104 #if !defined (SIGCHLD) && defined (SIGCLD) |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
105 #define SIGCHLD SIGCLD |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
106 #endif |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
107 |
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
108 #define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar) |
14338
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
109 #define UNBLOCK_CHILD(ovar) GNULIB_NAMESPACE::sigprocmask (SIG_SETMASK, &ovar, 0) |
11525
ab231f944252
avoid exposing gnulib:: in header files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
110 |
10142
829e69ec3110
make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
111 // Called from octave_quit () to actually do something about the signals |
5142 | 112 // we have caught. |
113 | |
114 void | |
115 octave_signal_handler (void) | |
116 { | |
117 // The list of signals is relatively short, so we will just go | |
118 // linearly through the list. | |
119 | |
120 for (int i = 0; i < NSIG; i++) | |
121 { | |
122 if (octave_signals_caught[i]) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
123 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
124 octave_signals_caught[i] = false; |
5142 | 125 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
126 switch (i) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
127 { |
5451 | 128 #ifdef SIGCHLD |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
129 case SIGCHLD: |
11555
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
130 { |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
131 volatile octave_interrupt_handler saved_interrupt_handler |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
132 = octave_ignore_interrupts (); |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
133 |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
134 sigset_t set, oset; |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
135 |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
136 BLOCK_CHILD (set, oset); |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
137 |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
138 octave_child_list::wait (); |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
139 |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
140 octave_set_interrupt_handler (saved_interrupt_handler); |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
141 |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
142 UNBLOCK_CHILD (oset); |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
143 |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
144 octave_child_list::reap (); |
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
145 } |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
146 break; |
5451 | 147 #endif |
5142 | 148 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
149 case SIGFPE: |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
150 std::cerr << "warning: floating point exception -- trying to return to prompt" << std::endl; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
151 break; |
5142 | 152 |
5451 | 153 #ifdef SIGPIPE |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
154 case SIGPIPE: |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
155 std::cerr << "warning: broken pipe -- some output may be lost" << std::endl; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
156 break; |
5451 | 157 #endif |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
158 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
159 } |
5142 | 160 } |
161 } | |
162 | |
1 | 163 static void |
4787 | 164 my_friendly_exit (const char *sig_name, int sig_number, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
165 bool save_vars = true) |
1 | 166 { |
2536 | 167 static bool been_there_done_that = false; |
168 | |
169 if (been_there_done_that) | |
170 { | |
2554 | 171 #if defined (SIGABRT) |
2536 | 172 octave_set_signal_handler (SIGABRT, SIG_DFL); |
173 #endif | |
174 | |
3644 | 175 std::cerr << "panic: attempted clean up apparently failed -- aborting...\n"; |
5451 | 176 |
177 MINGW_SIGNAL_CLEANUP (); | |
178 | |
2536 | 179 abort (); |
180 } | |
181 else | |
182 { | |
183 been_there_done_that = true; | |
1373 | 184 |
3644 | 185 std::cerr << "panic: " << sig_name << " -- stopping myself...\n"; |
2536 | 186 |
4787 | 187 if (save_vars) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
188 dump_octave_core (); |
2536 | 189 |
3162 | 190 if (sig_number < 0) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
191 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
192 MINGW_SIGNAL_CLEANUP (); |
5451 | 193 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
194 exit (1); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
195 } |
3162 | 196 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
197 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
198 octave_set_signal_handler (sig_number, SIG_DFL); |
3162 | 199 |
14338
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
200 GNULIB_NAMESPACE::raise (sig_number); |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
201 } |
2536 | 202 } |
1 | 203 } |
204 | |
1446 | 205 sig_handler * |
5770 | 206 octave_set_signal_handler (int sig, sig_handler *handler, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
207 bool restart_syscalls) |
1446 | 208 { |
209 struct sigaction act, oact; | |
5144 | 210 |
1446 | 211 act.sa_handler = handler; |
212 act.sa_flags = 0; | |
5144 | 213 |
10344
65974373505a
Do not use SIGALRM unconditinally.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10315
diff
changeset
|
214 #if defined (SIGALRM) |
5144 | 215 if (sig == SIGALRM) |
216 { | |
217 #if defined (SA_INTERRUPT) | |
218 act.sa_flags |= SA_INTERRUPT; | |
219 #endif | |
220 } | |
10344
65974373505a
Do not use SIGALRM unconditinally.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10315
diff
changeset
|
221 #endif |
5144 | 222 #if defined (SA_RESTART) |
10344
65974373505a
Do not use SIGALRM unconditinally.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10315
diff
changeset
|
223 #if defined (SIGALRM) |
65974373505a
Do not use SIGALRM unconditinally.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10315
diff
changeset
|
224 else |
65974373505a
Do not use SIGALRM unconditinally.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10315
diff
changeset
|
225 #endif |
5775 | 226 // FIXME -- Do we also need to explicitly disable SA_RESTART? |
10344
65974373505a
Do not use SIGALRM unconditinally.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10315
diff
changeset
|
227 if (restart_syscalls) |
5770 | 228 act.sa_flags |= SA_RESTART; |
5144 | 229 #endif |
230 | |
14338
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
231 GNULIB_NAMESPACE::sigemptyset (&act.sa_mask); |
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
232 GNULIB_NAMESPACE::sigemptyset (&oact.sa_mask); |
5144 | 233 |
14338
1ecfba4427ff
workaround for apparent bug in GCC 4.1.2 (bug #30685)
John W. Eaton <jwe@octave.org>
parents:
14154
diff
changeset
|
234 GNULIB_NAMESPACE::sigaction (sig, &act, &oact); |
5144 | 235 |
1446 | 236 return oact.sa_handler; |
237 } | |
238 | |
10246 | 239 static void |
1446 | 240 generic_sig_handler (int sig) |
1 | 241 { |
5844 | 242 my_friendly_exit (strsignal (sig), sig); |
1 | 243 } |
244 | |
2091 | 245 // Handle SIGCHLD. |
1230 | 246 |
4064 | 247 #ifdef SIGCHLD |
10246 | 248 static void |
2092 | 249 sigchld_handler (int /* sig */) |
1230 | 250 { |
11555
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
251 octave_signal_caught = 1; |
2626 | 252 |
11555
f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
John W. Eaton <jwe@octave.org>
parents:
11525
diff
changeset
|
253 octave_signals_caught[SIGCHLD] = true; |
1230 | 254 } |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
255 #endif /* defined (SIGCHLD) */ |
1230 | 256 |
4064 | 257 #ifdef SIGFPE |
1373 | 258 #if defined (__alpha__) |
10246 | 259 static void |
1488 | 260 sigfpe_handler (int /* sig */) |
1373 | 261 { |
5142 | 262 if (can_interrupt && octave_interrupt_state >= 0) |
263 { | |
264 octave_signal_caught = 1; | |
1373 | 265 |
5142 | 266 octave_signals_caught[SIGFPE] = true; |
4182 | 267 |
5142 | 268 octave_interrupt_state++; |
269 } | |
1373 | 270 } |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
271 #endif /* defined (__alpha__) */ |
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
272 #endif /* defined (SIGFPE) */ |
1373 | 273 |
4449 | 274 #if defined (SIGHUP) || defined (SIGTERM) |
10246 | 275 static void |
4449 | 276 sig_hup_or_term_handler (int sig) |
277 { | |
278 switch (sig) | |
279 { | |
280 #if defined (SIGHUP) | |
281 case SIGHUP: | |
282 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
283 if (Vsighup_dumps_octave_core) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
284 dump_octave_core (); |
4449 | 285 } |
286 break; | |
287 #endif | |
288 | |
289 #if defined (SIGTERM) | |
290 case SIGTERM: | |
291 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
292 if (Vsigterm_dumps_octave_core) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
293 dump_octave_core (); |
4449 | 294 } |
295 break; | |
296 #endif | |
297 | |
298 default: | |
299 break; | |
300 } | |
301 | |
302 clean_up_and_exit (0); | |
303 } | |
304 #endif | |
305 | |
3343 | 306 #if 0 |
3281 | 307 #if defined (SIGWINCH) |
10246 | 308 static void |
3281 | 309 sigwinch_handler (int /* sig */) |
310 { | |
311 command_editor::resize_terminal (); | |
312 } | |
313 #endif | |
3343 | 314 #endif |
3281 | 315 |
635 | 316 // Handle SIGINT by restarting the parser (see octave.cc). |
2554 | 317 // |
318 // This also has to work for SIGBREAK (on systems that have it), so we | |
319 // use the value of sig, instead of just assuming that it is called | |
320 // for SIGINT only. | |
635 | 321 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7481
diff
changeset
|
322 static void |
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7481
diff
changeset
|
323 user_abort (const char *sig_name, int sig_number) |
1 | 324 { |
4172 | 325 if (! octave_initialized) |
326 exit (1); | |
327 | |
1 | 328 if (can_interrupt) |
329 { | |
4185 | 330 if (Vdebug_on_interrupt) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
331 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
332 if (! octave_debug_on_interrupt_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
333 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
334 tree_evaluator::debug_mode = true; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
335 octave_debug_on_interrupt_state = true; |
4185 | 336 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
337 return; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
338 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
339 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
340 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
341 // Clear the flag and do normal interrupt stuff. |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
7481
diff
changeset
|
342 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
343 tree_evaluator::debug_mode |
10194 | 344 = bp_table::have_breakpoints () || Vdebugging; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
345 octave_debug_on_interrupt_state = false; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
346 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
347 } |
4185 | 348 |
4153 | 349 if (octave_interrupt_immediately) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
350 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
351 if (octave_interrupt_state == 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
352 octave_interrupt_state = 1; |
7481
78f3811155f7
use exceptions in liboctave error handler
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
353 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
354 octave_jump_to_enclosing_context (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
355 } |
4429 | 356 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
357 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
358 // If we are already cleaning up from a previous interrupt, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
359 // take note of the fact that another interrupt signal has |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
360 // arrived. |
4793 | 361 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
362 if (octave_interrupt_state < 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
363 octave_interrupt_state = 0; |
4793 | 364 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
365 octave_signal_caught = 1; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
366 octave_interrupt_state++; |
4787 | 367 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
368 if (interactive && octave_interrupt_state == 2) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
369 std::cerr << "Press Control-C again to abort." << std::endl; |
4787 | 370 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
371 if (octave_interrupt_state >= 3) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
372 my_friendly_exit (sig_name, sig_number, true); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
373 } |
1 | 374 } |
375 | |
5451 | 376 } |
377 | |
10246 | 378 static void |
5451 | 379 sigint_handler (int sig) |
380 { | |
381 #ifdef USE_W32_SIGINT | |
382 if (w32_in_main_thread ()) | |
5844 | 383 user_abort (strsignal (sig), sig); |
5451 | 384 else |
385 w32_raise (sig); | |
386 #else | |
5844 | 387 user_abort (strsignal (sig), sig); |
5451 | 388 #endif |
1 | 389 } |
390 | |
4064 | 391 #ifdef SIGPIPE |
10246 | 392 static void |
1488 | 393 sigpipe_handler (int /* sig */) |
1 | 394 { |
5142 | 395 octave_signal_caught = 1; |
396 | |
397 octave_signals_caught[SIGPIPE] = true; | |
1 | 398 |
1358 | 399 // Don't loop forever on account of this. |
400 | |
5142 | 401 if (pipe_handler_error_count++ > 100 && octave_interrupt_state >= 0) |
4787 | 402 octave_interrupt_state++; |
1 | 403 } |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
404 #endif /* defined (SIGPIPE) */ |
1 | 405 |
5451 | 406 #ifdef USE_W32_SIGINT |
407 static BOOL CALLBACK | |
408 w32_sigint_handler (DWORD sig) | |
409 { | |
410 const char *sig_name; | |
411 | |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
412 switch (sig) |
5451 | 413 { |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11555
diff
changeset
|
414 case CTRL_BREAK_EVENT: |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11555
diff
changeset
|
415 sig_name = "Ctrl-Break"; |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
416 break; |
5451 | 417 case CTRL_C_EVENT: |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
418 sig_name = "Ctrl-C"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
419 break; |
5451 | 420 case CTRL_CLOSE_EVENT: |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
421 sig_name = "close console"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
422 break; |
5451 | 423 case CTRL_LOGOFF_EVENT: |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
424 sig_name = "logoff"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
425 break; |
5451 | 426 case CTRL_SHUTDOWN_EVENT: |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
427 sig_name = "shutdown"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
428 break; |
5451 | 429 default: |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
430 sig_name = "unknown console event"; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
431 break; |
5451 | 432 } |
433 | |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
434 switch (sig) |
5451 | 435 { |
436 case CTRL_BREAK_EVENT: | |
437 case CTRL_C_EVENT: | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
438 w32_raise (SIGINT); |
5451 | 439 break; |
440 | |
441 case CTRL_CLOSE_EVENT: | |
14443
47fba1dc31b8
Fix closing window bug on MinGW (bug #33798)
Tatsuro MATSUOKA <tmacchant@yahoo.co.jp>
parents:
14429
diff
changeset
|
442 clean_up_and_exit (0); |
47fba1dc31b8
Fix closing window bug on MinGW (bug #33798)
Tatsuro MATSUOKA <tmacchant@yahoo.co.jp>
parents:
14429
diff
changeset
|
443 break; |
5451 | 444 case CTRL_LOGOFF_EVENT: |
445 case CTRL_SHUTDOWN_EVENT: | |
446 default: | |
447 // We should do the following: | |
448 // clean_up_and_exit (0); | |
449 // We can't because we aren't running in the normal Octave thread. | |
14861
f7afecdd87ef
maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents:
14443
diff
changeset
|
450 user_abort (sig_name, sig); |
5451 | 451 break; |
452 } | |
453 | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11555
diff
changeset
|
454 // Return TRUE if the event was handled, or FALSE if another handler |
5451 | 455 // should be called. |
5775 | 456 // FIXME check that windows terminates the thread. |
5451 | 457 return TRUE; |
458 } | |
459 #endif /* w32_sigint_handler */ | |
460 | |
461 | |
2705 | 462 octave_interrupt_handler |
2554 | 463 octave_catch_interrupts (void) |
464 { | |
2705 | 465 octave_interrupt_handler retval; |
2554 | 466 |
467 #ifdef SIGINT | |
2705 | 468 retval.int_handler = octave_set_signal_handler (SIGINT, sigint_handler); |
2554 | 469 #endif |
470 | |
471 #ifdef SIGBREAK | |
2705 | 472 retval.brk_handler = octave_set_signal_handler (SIGBREAK, sigint_handler); |
2554 | 473 #endif |
2705 | 474 |
5451 | 475 #ifdef USE_W32_SIGINT |
476 | |
477 // Intercept windows console control events. | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11555
diff
changeset
|
478 // Note that the windows console signal handlers chain, so if |
5451 | 479 // install_signal_handlers is called more than once in the same program, |
480 // then first call the following to avoid duplicates: | |
481 // | |
482 // SetConsoleCtrlHandler (w32_sigint_handler, FALSE); | |
483 | |
484 if (! SetConsoleCtrlHandler (w32_sigint_handler, TRUE)) | |
485 error ("SetConsoleCtrlHandler failed with %ld\n", GetLastError ()); | |
486 | |
487 w32_set_quiet_shutdown (); | |
488 | |
489 #endif | |
490 | |
2705 | 491 return retval; |
2554 | 492 } |
493 | |
2705 | 494 octave_interrupt_handler |
495 octave_ignore_interrupts (void) | |
2554 | 496 { |
2705 | 497 octave_interrupt_handler retval; |
498 | |
2554 | 499 #ifdef SIGINT |
2705 | 500 retval.int_handler = octave_set_signal_handler (SIGINT, SIG_IGN); |
2554 | 501 #endif |
502 | |
503 #ifdef SIGBREAK | |
2705 | 504 retval.brk_handler = octave_set_signal_handler (SIGBREAK, SIG_IGN); |
2554 | 505 #endif |
2705 | 506 |
507 return retval; | |
508 } | |
509 | |
510 octave_interrupt_handler | |
5770 | 511 octave_set_interrupt_handler (const volatile octave_interrupt_handler& h, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
512 bool restart_syscalls) |
2705 | 513 { |
514 octave_interrupt_handler retval; | |
515 | |
516 #ifdef SIGINT | |
5770 | 517 retval.int_handler = octave_set_signal_handler (SIGINT, h.int_handler, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
518 restart_syscalls); |
2705 | 519 #endif |
520 | |
521 #ifdef SIGBREAK | |
5770 | 522 retval.brk_handler = octave_set_signal_handler (SIGBREAK, h.brk_handler, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
523 restart_syscalls); |
2705 | 524 #endif |
525 | |
526 return retval; | |
1651 | 527 } |
528 | |
635 | 529 // Install all the handlers for the signals we might care about. |
530 | |
1 | 531 void |
532 install_signal_handlers (void) | |
533 { | |
5142 | 534 for (int i = 0; i < NSIG; i++) |
535 octave_signals_caught[i] = false; | |
536 | |
2554 | 537 octave_catch_interrupts (); |
538 | |
1 | 539 #ifdef SIGABRT |
1446 | 540 octave_set_signal_handler (SIGABRT, generic_sig_handler); |
1 | 541 #endif |
542 | |
543 #ifdef SIGALRM | |
1446 | 544 octave_set_signal_handler (SIGALRM, generic_sig_handler); |
1 | 545 #endif |
546 | |
547 #ifdef SIGBUS | |
1446 | 548 octave_set_signal_handler (SIGBUS, generic_sig_handler); |
1 | 549 #endif |
550 | |
1230 | 551 #ifdef SIGCHLD |
1446 | 552 octave_set_signal_handler (SIGCHLD, sigchld_handler); |
1230 | 553 #endif |
554 | |
3174 | 555 // SIGCLD |
556 // SIGCONT | |
557 | |
1 | 558 #ifdef SIGEMT |
1446 | 559 octave_set_signal_handler (SIGEMT, generic_sig_handler); |
1 | 560 #endif |
561 | |
562 #ifdef SIGFPE | |
1373 | 563 #if defined (__alpha__) |
1446 | 564 octave_set_signal_handler (SIGFPE, sigfpe_handler); |
1373 | 565 #else |
1446 | 566 octave_set_signal_handler (SIGFPE, generic_sig_handler); |
1 | 567 #endif |
1373 | 568 #endif |
1 | 569 |
570 #ifdef SIGHUP | |
4449 | 571 octave_set_signal_handler (SIGHUP, sig_hup_or_term_handler); |
1 | 572 #endif |
573 | |
574 #ifdef SIGILL | |
1446 | 575 octave_set_signal_handler (SIGILL, generic_sig_handler); |
1 | 576 #endif |
577 | |
3174 | 578 // SIGINFO |
579 // SIGINT | |
580 | |
1 | 581 #ifdef SIGIOT |
1446 | 582 octave_set_signal_handler (SIGIOT, generic_sig_handler); |
1 | 583 #endif |
584 | |
585 #ifdef SIGLOST | |
1446 | 586 octave_set_signal_handler (SIGLOST, generic_sig_handler); |
1 | 587 #endif |
588 | |
589 #ifdef SIGPIPE | |
1446 | 590 octave_set_signal_handler (SIGPIPE, sigpipe_handler); |
1 | 591 #endif |
592 | |
593 #ifdef SIGPOLL | |
1446 | 594 octave_set_signal_handler (SIGPOLL, SIG_IGN); |
1 | 595 #endif |
596 | |
5866 | 597 // SIGPROF |
3174 | 598 // SIGPWR |
599 | |
1 | 600 #ifdef SIGQUIT |
1446 | 601 octave_set_signal_handler (SIGQUIT, generic_sig_handler); |
1 | 602 #endif |
603 | |
604 #ifdef SIGSEGV | |
1446 | 605 octave_set_signal_handler (SIGSEGV, generic_sig_handler); |
1 | 606 #endif |
607 | |
3174 | 608 // SIGSTOP |
609 | |
1 | 610 #ifdef SIGSYS |
1446 | 611 octave_set_signal_handler (SIGSYS, generic_sig_handler); |
1 | 612 #endif |
613 | |
614 #ifdef SIGTERM | |
4449 | 615 octave_set_signal_handler (SIGTERM, sig_hup_or_term_handler); |
1 | 616 #endif |
617 | |
618 #ifdef SIGTRAP | |
1446 | 619 octave_set_signal_handler (SIGTRAP, generic_sig_handler); |
1 | 620 #endif |
621 | |
3174 | 622 // SIGTSTP |
623 // SIGTTIN | |
624 // SIGTTOU | |
625 // SIGURG | |
626 | |
1 | 627 #ifdef SIGUSR1 |
1446 | 628 octave_set_signal_handler (SIGUSR1, generic_sig_handler); |
1 | 629 #endif |
630 | |
631 #ifdef SIGUSR2 | |
1446 | 632 octave_set_signal_handler (SIGUSR2, generic_sig_handler); |
1 | 633 #endif |
634 | |
635 #ifdef SIGVTALRM | |
1446 | 636 octave_set_signal_handler (SIGVTALRM, generic_sig_handler); |
1 | 637 #endif |
638 | |
895 | 639 #ifdef SIGIO |
1446 | 640 octave_set_signal_handler (SIGIO, SIG_IGN); |
895 | 641 #endif |
642 | |
3343 | 643 #if 0 |
3281 | 644 #ifdef SIGWINCH |
645 octave_set_signal_handler (SIGWINCH, sigwinch_handler); | |
646 #endif | |
3343 | 647 #endif |
3174 | 648 |
1 | 649 #ifdef SIGXCPU |
1446 | 650 octave_set_signal_handler (SIGXCPU, generic_sig_handler); |
1 | 651 #endif |
652 | |
653 #ifdef SIGXFSZ | |
1446 | 654 octave_set_signal_handler (SIGXFSZ, generic_sig_handler); |
1 | 655 #endif |
5451 | 656 |
1 | 657 } |
658 | |
11066
e678346a47d9
toplev.cc, sighandlers.cc, utils.cc, octave.cc, pt-eval.cc pt-idx.cc: Octave_map to octave_map and octave_scalar_map conversion
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
659 static octave_scalar_map |
4294 | 660 make_sig_struct (void) |
661 { | |
11066
e678346a47d9
toplev.cc, sighandlers.cc, utils.cc, octave.cc, pt-eval.cc pt-idx.cc: Octave_map to octave_map and octave_scalar_map conversion
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
662 octave_scalar_map m; |
4294 | 663 |
664 #ifdef SIGABRT | |
4675 | 665 m.assign ("ABRT", SIGABRT); |
4294 | 666 #endif |
667 | |
668 #ifdef SIGALRM | |
4675 | 669 m.assign ("ALRM", SIGALRM); |
4294 | 670 #endif |
671 | |
672 #ifdef SIGBUS | |
4675 | 673 m.assign ("BUS", SIGBUS); |
4294 | 674 #endif |
675 | |
676 #ifdef SIGCHLD | |
4675 | 677 m.assign ("CHLD", SIGCHLD); |
4294 | 678 #endif |
679 | |
680 #ifdef SIGCLD | |
4675 | 681 m.assign ("CLD", SIGCLD); |
4294 | 682 #endif |
683 | |
684 #ifdef SIGCONT | |
4675 | 685 m.assign ("CONT", SIGCONT); |
4294 | 686 #endif |
687 | |
688 #ifdef SIGEMT | |
4675 | 689 m.assign ("EMT", SIGEMT); |
4294 | 690 #endif |
691 | |
692 #ifdef SIGFPE | |
4675 | 693 m.assign ("FPE", SIGFPE); |
4294 | 694 #endif |
695 | |
696 #ifdef SIGHUP | |
4675 | 697 m.assign ("HUP", SIGHUP); |
4294 | 698 #endif |
699 | |
700 #ifdef SIGILL | |
4675 | 701 m.assign ("ILL", SIGILL); |
4294 | 702 #endif |
703 | |
704 #ifdef SIGINFO | |
4675 | 705 m.assign ("INFO", SIGINFO); |
4294 | 706 #endif |
707 | |
708 #ifdef SIGINT | |
4675 | 709 m.assign ("INT", SIGINT); |
4294 | 710 #endif |
711 | |
712 #ifdef SIGIOT | |
4675 | 713 m.assign ("IOT", SIGIOT); |
4294 | 714 #endif |
715 | |
716 #ifdef SIGLOST | |
4675 | 717 m.assign ("LOST", SIGLOST); |
4294 | 718 #endif |
719 | |
720 #ifdef SIGPIPE | |
4675 | 721 m.assign ("PIPE", SIGPIPE); |
4294 | 722 #endif |
723 | |
724 #ifdef SIGPOLL | |
4675 | 725 m.assign ("POLL", SIGPOLL); |
4294 | 726 #endif |
727 | |
728 #ifdef SIGPROF | |
4675 | 729 m.assign ("PROF", SIGPROF); |
4294 | 730 #endif |
731 | |
732 #ifdef SIGPWR | |
4675 | 733 m.assign ("PWR", SIGPWR); |
4294 | 734 #endif |
735 | |
736 #ifdef SIGQUIT | |
4675 | 737 m.assign ("QUIT", SIGQUIT); |
4294 | 738 #endif |
739 | |
740 #ifdef SIGSEGV | |
4675 | 741 m.assign ("SEGV", SIGSEGV); |
4294 | 742 #endif |
743 | |
744 #ifdef SIGSTOP | |
4675 | 745 m.assign ("STOP", SIGSTOP); |
4294 | 746 #endif |
747 | |
748 #ifdef SIGSYS | |
4675 | 749 m.assign ("SYS", SIGSYS); |
4294 | 750 #endif |
751 | |
752 #ifdef SIGTERM | |
4675 | 753 m.assign ("TERM", SIGTERM); |
4294 | 754 #endif |
755 | |
756 #ifdef SIGTRAP | |
4675 | 757 m.assign ("TRAP", SIGTRAP); |
4294 | 758 #endif |
759 | |
760 #ifdef SIGTSTP | |
4675 | 761 m.assign ("TSTP", SIGTSTP); |
4294 | 762 #endif |
763 | |
764 #ifdef SIGTTIN | |
4675 | 765 m.assign ("TTIN", SIGTTIN); |
4294 | 766 #endif |
767 | |
768 #ifdef SIGTTOU | |
4675 | 769 m.assign ("TTOU", SIGTTOU); |
4294 | 770 #endif |
771 | |
772 #ifdef SIGURG | |
4675 | 773 m.assign ("URG", SIGURG); |
4294 | 774 #endif |
775 | |
776 #ifdef SIGUSR1 | |
4675 | 777 m.assign ("USR1", SIGUSR1); |
4294 | 778 #endif |
779 | |
780 #ifdef SIGUSR2 | |
4675 | 781 m.assign ("USR2", SIGUSR2); |
4294 | 782 #endif |
783 | |
784 #ifdef SIGVTALRM | |
4675 | 785 m.assign ("VTALRM", SIGVTALRM); |
4294 | 786 #endif |
787 | |
788 #ifdef SIGIO | |
4675 | 789 m.assign ("IO", SIGIO); |
4294 | 790 #endif |
791 | |
792 #ifdef SIGWINCH | |
4675 | 793 m.assign ("WINCH", SIGWINCH); |
4294 | 794 #endif |
795 | |
796 #ifdef SIGXCPU | |
4675 | 797 m.assign ("XCPU", SIGXCPU); |
4294 | 798 #endif |
799 | |
800 #ifdef SIGXFSZ | |
4675 | 801 m.assign ("XFSZ", SIGXFSZ); |
4294 | 802 #endif |
803 | |
804 return m; | |
805 } | |
806 | |
5142 | 807 octave_child_list::octave_child_list_rep *octave_child_list::instance = 0; |
5128 | 808 |
2926 | 809 bool |
810 octave_child_list::instance_ok (void) | |
811 { | |
812 bool retval = true; | |
813 | |
814 if (! instance) | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
815 { |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
816 instance = new octave_child_list_rep (); |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
817 |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
818 if (instance) |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
819 singleton_cleanup_list::add (cleanup_instance); |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
820 } |
2926 | 821 |
822 if (! instance) | |
823 { | |
824 ::error ("unable to create child list object!"); | |
825 | |
826 retval = false; | |
827 } | |
828 | |
829 return retval; | |
830 } | |
831 | |
832 void | |
5142 | 833 octave_child_list::insert (pid_t pid, octave_child::child_event_handler f) |
834 { | |
835 if (instance_ok ()) | |
836 instance->insert (pid, f); | |
837 } | |
838 | |
839 void | |
840 octave_child_list::reap (void) | |
2926 | 841 { |
842 if (instance_ok ()) | |
5142 | 843 instance->reap (); |
844 } | |
845 | |
846 bool | |
847 octave_child_list::wait (void) | |
848 { | |
849 return (instance_ok ()) ? instance->wait () : false; | |
2926 | 850 } |
851 | |
5142 | 852 class pid_equal |
853 { | |
854 public: | |
855 | |
856 pid_equal (pid_t v) : val (v) { } | |
857 | |
858 bool operator () (const octave_child& oc) const { return oc.pid == val; } | |
859 | |
860 private: | |
861 | |
862 pid_t val; | |
863 }; | |
864 | |
2926 | 865 void |
866 octave_child_list::remove (pid_t pid) | |
867 { | |
868 if (instance_ok ()) | |
5142 | 869 instance->remove_if (pid_equal (pid)); |
2926 | 870 } |
871 | |
5142 | 872 #define OCL_REP octave_child_list::octave_child_list_rep |
2926 | 873 |
5142 | 874 void |
875 OCL_REP::insert (pid_t pid, octave_child::child_event_handler f) | |
2926 | 876 { |
5142 | 877 append (octave_child (pid, f)); |
2926 | 878 } |
879 | |
2209 | 880 void |
5142 | 881 OCL_REP::reap (void) |
2209 | 882 { |
5142 | 883 // Mark the record for PID invalid. |
2209 | 884 |
5142 | 885 for (iterator p = begin (); p != end (); p++) |
886 { | |
887 // The call to the octave_child::child_event_handler might | |
888 // invalidate the iterator (for example, by calling | |
889 // octave_child_list::remove), so we increment the iterator | |
890 // here. | |
2209 | 891 |
5142 | 892 octave_child& oc = *p; |
2209 | 893 |
5142 | 894 if (oc.have_status) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
895 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
896 oc.have_status = 0; |
5142 | 897 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
898 octave_child::child_event_handler f = oc.handler; |
5142 | 899 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
900 if (f && f (oc.pid, oc.status)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
901 oc.pid = -1; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
902 } |
2209 | 903 } |
904 | |
5142 | 905 remove_if (pid_equal (-1)); |
2209 | 906 } |
907 | |
5142 | 908 // Wait on our children and record any changes in their status. |
909 | |
910 bool | |
911 OCL_REP::wait (void) | |
2210 | 912 { |
5142 | 913 bool retval = false; |
2210 | 914 |
5142 | 915 for (iterator p = begin (); p != end (); p++) |
2210 | 916 { |
5142 | 917 octave_child& oc = *p; |
918 | |
919 pid_t pid = oc.pid; | |
920 | |
921 if (pid > 0) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
922 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
923 int status; |
2210 | 924 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
925 if (octave_syscalls::waitpid (pid, &status, WNOHANG) > 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
926 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
927 oc.have_status = 1; |
5142 | 928 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
929 oc.status = status; |
5142 | 930 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
931 retval = true; |
5142 | 932 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
933 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
934 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10246
diff
changeset
|
935 } |
2210 | 936 } |
937 | |
5142 | 938 return retval; |
2210 | 939 } |
940 | |
5780 | 941 DEFUN (SIG, args, , |
942 "-*- texinfo -*-\n\ | |
943 @deftypefn {Built-in Function} {} SIG ()\n\ | |
944 Return a structure containing Unix signal names and their defined values.\n\ | |
945 @end deftypefn") | |
946 { | |
947 octave_value retval; | |
948 | |
949 if (args.length () == 0) | |
950 { | |
11066
e678346a47d9
toplev.cc, sighandlers.cc, utils.cc, octave.cc, pt-eval.cc pt-idx.cc: Octave_map to octave_map and octave_scalar_map conversion
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
951 static octave_scalar_map m = make_sig_struct (); |
5780 | 952 |
953 retval = m; | |
954 } | |
955 else | |
5823 | 956 print_usage (); |
5780 | 957 |
958 return retval; | |
959 } | |
960 | |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
961 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
962 %!assert (isstruct (SIG ())) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
963 %!assert (! isempty (SIG ())) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
964 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
965 %!error SIG (1) |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
966 */ |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
967 |
5794 | 968 DEFUN (debug_on_interrupt, args, nargout, |
969 "-*- texinfo -*-\n\ | |
10840 | 970 @deftypefn {Built-in Function} {@var{val} =} debug_on_interrupt ()\n\ |
5794 | 971 @deftypefnx {Built-in Function} {@var{old_val} =} debug_on_interrupt (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
972 @deftypefnx {Built-in Function} {} debug_on_interrupt (@var{new_val}, \"local\")\n\ |
5794 | 973 Query or set the internal variable that controls whether Octave will try\n\ |
974 to enter debugging mode when it receives an interrupt signal (typically\n\ | |
975 generated with @kbd{C-c}). If a second interrupt signal is received\n\ | |
976 before reaching the debugging mode, a normal interrupt will occur.\n\ | |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
977 \n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
978 When called from inside a function with the \"local\" option, the variable is\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
979 changed locally for the function and any subroutines it calls. The original\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
980 variable value is restored when exiting the function.\n\ |
5794 | 981 @end deftypefn") |
4449 | 982 { |
5794 | 983 return SET_INTERNAL_VARIABLE (debug_on_interrupt); |
4449 | 984 } |
985 | |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
986 /* |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
987 %!test |
12832 | 988 %! orig_val = debug_on_interrupt (); |
989 %! old_val = debug_on_interrupt (! orig_val); | |
990 %! assert (orig_val, old_val); | |
991 %! assert (debug_on_interrupt (), ! orig_val); | |
992 %! debug_on_interrupt (orig_val); | |
993 %! assert (debug_on_interrupt (), orig_val); | |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
994 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
995 %!error (debug_on_interrupt (1, 2)) |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
996 */ |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
997 |
5794 | 998 DEFUN (sighup_dumps_octave_core, args, nargout, |
999 "-*- texinfo -*-\n\ | |
10840 | 1000 @deftypefn {Built-in Function} {@var{val} =} sighup_dumps_octave_core ()\n\ |
5794 | 1001 @deftypefnx {Built-in Function} {@var{old_val} =} sighup_dumps_octave_core (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1002 @deftypefnx {Built-in Function} {} sighup_dumps_octave_core (@var{new_val}, \"local\")\n\ |
5794 | 1003 Query or set the internal variable that controls whether Octave tries\n\ |
6653 | 1004 to save all current variables to the file \"octave-core\" if it receives\n\ |
5794 | 1005 a hangup signal.\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1006 \n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1007 When called from inside a function with the \"local\" option, the variable is\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1008 changed locally for the function and any subroutines it calls. The original\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1009 variable value is restored when exiting the function.\n\ |
5794 | 1010 @end deftypefn") |
4185 | 1011 { |
5794 | 1012 return SET_INTERNAL_VARIABLE (sighup_dumps_octave_core); |
1013 } | |
4294 | 1014 |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1015 /* |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1016 %!test |
12832 | 1017 %! orig_val = sighup_dumps_octave_core (); |
1018 %! old_val = sighup_dumps_octave_core (! orig_val); | |
1019 %! assert (orig_val, old_val); | |
1020 %! assert (sighup_dumps_octave_core (), ! orig_val); | |
1021 %! sighup_dumps_octave_core (orig_val); | |
1022 %! assert (sighup_dumps_octave_core (), orig_val); | |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
1023 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
1024 %!error (sighup_dumps_octave_core (1, 2)) |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1025 */ |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1026 |
5794 | 1027 DEFUN (sigterm_dumps_octave_core, args, nargout, |
1028 "-*- texinfo -*-\n\ | |
10840 | 1029 @deftypefn {Built-in Function} {@var{val} =} sigterm_dumps_octave_core ()\n\ |
5794 | 1030 @deftypefnx {Built-in Function} {@var{old_val} =} sigterm_dumps_octave_core (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1031 @deftypefnx {Built-in Function} {} sigterm_dumps_octave_core (@var{new_val}, \"local\")\n\ |
5794 | 1032 Query or set the internal variable that controls whether Octave tries\n\ |
6653 | 1033 to save all current variables to the file \"octave-core\" if it receives\n\ |
5794 | 1034 a terminate signal.\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1035 \n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1036 When called from inside a function with the \"local\" option, the variable is\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1037 changed locally for the function and any subroutines it calls. The original\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12832
diff
changeset
|
1038 variable value is restored when exiting the function.\n\ |
5794 | 1039 @end deftypefn") |
1040 { | |
1041 return SET_INTERNAL_VARIABLE (sigterm_dumps_octave_core); | |
4185 | 1042 } |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1043 |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1044 /* |
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1045 %!test |
12832 | 1046 %! orig_val = sigterm_dumps_octave_core (); |
1047 %! old_val = sigterm_dumps_octave_core (! orig_val); | |
1048 %! assert (orig_val, old_val); | |
1049 %! assert (sigterm_dumps_octave_core (), ! orig_val); | |
1050 %! sigterm_dumps_octave_core (orig_val); | |
1051 %! assert (sigterm_dumps_octave_core (), orig_val); | |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
1052 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14338
diff
changeset
|
1053 %!error (sigterm_dumps_octave_core (1, 2)) |
12827
8c6d71520920
codesprint: new tests for sysdep.cc functions
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
1054 */ |