9 |
|
#include <ctype.h> |
10 |
|
|
11 |
|
#include "platform.h" |
12 |
– |
#include "rtprocess.h" |
12 |
|
#include "mkillum.h" |
13 |
|
#include "random.h" |
14 |
|
|
157 |
|
quit(0); |
158 |
|
} |
159 |
|
|
160 |
+ |
|
161 |
+ |
#ifndef SIGALRM |
162 |
+ |
#define SIGALRM SIGTERM |
163 |
+ |
#endif |
164 |
|
static void |
165 |
|
killpersist(void) /* kill persistent rtrace process */ |
166 |
|
{ |
174 |
|
fclose(fp); |
175 |
|
} |
176 |
|
|
177 |
+ |
|
178 |
|
int |
179 |
|
done_rprocs(struct rtproc *rtp) |
180 |
|
{ |
218 |
|
ofun[OBJ_SPHERE].funp = o_sphere; |
219 |
|
ofun[OBJ_RING].funp = o_ring; |
220 |
|
/* set up signal handling */ |
221 |
< |
#ifdef SIGPIPE /* not present on Windows */ |
221 |
> |
signal(SIGINT, quit); |
222 |
> |
#ifdef SIGHUP |
223 |
> |
signal(SIGHUP, quit); |
224 |
> |
#endif |
225 |
> |
#ifdef SIGTERM |
226 |
> |
signal(SIGTERM, quit); |
227 |
> |
#endif |
228 |
> |
#ifdef SIGPIPE |
229 |
|
signal(SIGPIPE, quit); |
230 |
|
#endif |
231 |
|
rtp = &rt0; /* start rtrace process(es) */ |
239 |
|
} |
240 |
|
if (maxbytes < 0) |
241 |
|
error(SYSTEM, "cannot start rtrace process"); |
231 |
– |
if (!i && np > 1) |
232 |
– |
sleep(2); /* wait for persist file */ |
242 |
|
rtp->bsiz = maxbytes/(6*sizeof(float)); |
243 |
|
rtp->buf = (float *)malloc(6*sizeof(float)*rtp->bsiz--); |
244 |
|
rtp->dest = (float **)calloc(rtp->bsiz, sizeof(float *)); |
247 |
|
rtp->nrays = 0; |
248 |
|
if (i == np) /* last process? */ |
249 |
|
break; |
250 |
+ |
if (np > 1) |
251 |
+ |
sleep(2); /* wait for persist file */ |
252 |
|
rtp->next = (struct rtproc *)malloc(sizeof(struct rtproc)); |
253 |
|
if (rtp->next == NULL) |
254 |
|
error(SYSTEM, "out of memory in init"); |