Mercurial > octave
comparison src/sighandlers.cc @ 1230:92609e161b29
[project @ 1995-04-10 01:08:57 by jwe]
author | jwe |
---|---|
date | Mon, 10 Apr 1995 01:14:34 +0000 |
parents | dfe01093f657 |
children | 611d403c7f3d |
comparison
equal
deleted
inserted
replaced
1229:7d7c3eaa1d3b | 1230:92609e161b29 |
---|---|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | 21 |
22 */ | 22 */ |
23 | 23 |
24 #ifdef HAVE_CONFIG_H | 24 #ifdef HAVE_CONFIG_H |
25 #include "config.h" | 25 #include <config.h> |
26 #endif | 26 #endif |
27 | 27 |
28 #include <sys/types.h> | 28 #include <sys/types.h> |
29 #ifdef HAVE_UNISTD_H | 29 #ifdef HAVE_UNISTD_H |
30 #include <unistd.h> | 30 #include <unistd.h> |
31 #endif | 31 #endif |
32 #include <sys/wait.h> | |
32 #include <new.h> | 33 #include <new.h> |
33 #include <signal.h> | 34 #include <signal.h> |
35 #include <iostream.h> | |
34 | 36 |
35 #include "sighandlers.h" | 37 #include "sighandlers.h" |
36 #include "octave.h" | 38 #include "octave.h" |
37 #include "error.h" | 39 #include "error.h" |
38 #include "utils.h" | 40 #include "utils.h" |
69 return; | 71 return; |
70 #else | 72 #else |
71 return 0; | 73 return 0; |
72 #endif | 74 #endif |
73 } | 75 } |
76 | |
77 // Handle SIGCHLD. Should use waitpid and ignore stopped jobs. | |
78 // Needs to restore state of plotter such that it will be restarted | |
79 // again when needed. Needs to close file descriptors corresponding | |
80 // to processes started with execute(). | |
81 | |
82 #if 0 | |
83 static RETSIGTYPE | |
84 sigchld_handler (int i) | |
85 { | |
86 int status; | |
87 pid_t pid = wait (&status); | |
88 | |
89 if (pid < 0) | |
90 cerr << "wait error\n"; | |
91 else | |
92 { | |
93 cerr << "sigchld caught, PID = " << pid << "; status: "; | |
94 | |
95 int lo_byte = (status & 0xff); | |
96 int hi_byte = ((status >> 8) & 0xff); | |
97 if (lo_byte == 0177) | |
98 { | |
99 cerr << "stopped with signal = " << hi_byte << "\n"; | |
100 } | |
101 else if (lo_byte) | |
102 { | |
103 int sig_num = (lo_byte & 0x7f); | |
104 cerr << "stopped with signal = " << sig_num << "\n"; | |
105 if (lo_byte & 0200) | |
106 cerr << "child dumped core\n"; | |
107 } | |
108 else | |
109 { | |
110 cerr << "exited with status = " << hi_byte << "\n"; | |
111 } | |
112 } | |
113 | |
114 signal (SIGCHLD, sigchld_handler); | |
115 } | |
116 #endif | |
74 | 117 |
75 // Handle SIGINT by restarting the parser (see octave.cc). | 118 // Handle SIGINT by restarting the parser (see octave.cc). |
76 | 119 |
77 // XXX FIXME XXX -- it would probably be good to try to use POSIX | 120 // XXX FIXME XXX -- it would probably be good to try to use POSIX |
78 // signal interface if it is available. | 121 // signal interface if it is available. |
135 signal (SIGALRM, generic_sig_handler); | 178 signal (SIGALRM, generic_sig_handler); |
136 #endif | 179 #endif |
137 | 180 |
138 #ifdef SIGBUS | 181 #ifdef SIGBUS |
139 signal (SIGBUS, generic_sig_handler); | 182 signal (SIGBUS, generic_sig_handler); |
183 #endif | |
184 | |
185 #if 0 | |
186 #ifdef SIGCHLD | |
187 signal (SIGCHLD, sigchld_handler); | |
188 #endif | |
140 #endif | 189 #endif |
141 | 190 |
142 #ifdef SIGEMT | 191 #ifdef SIGEMT |
143 signal (SIGEMT, generic_sig_handler); | 192 signal (SIGEMT, generic_sig_handler); |
144 #endif | 193 #endif |