| 10 |
|
|
| 11 |
|
#include "rholo.h" |
| 12 |
|
#include "random.h" |
| 13 |
+ |
#include "paths.h" |
| 14 |
+ |
#include "selcall.h" |
| 15 |
|
#include <signal.h> |
| 16 |
|
#include <sys/time.h> |
| 17 |
|
|
| 19 |
|
#define MAXPROC 16 |
| 20 |
|
#endif |
| 21 |
|
|
| 22 |
< |
static char PFILE[] = "/usr/tmp/RHpersist"; /* persist file name */ |
| 22 |
> |
static char pfile[] = TEMPLATE; /* persist file name */ |
| 23 |
|
|
| 24 |
|
static int rtpd[MAXPROC][3]; /* process descriptors */ |
| 25 |
|
static float *rtbuf = NULL; /* allocated i/o buffer */ |
| 55 |
|
rtargv[rtargc++] = "-x"; rtargv[rtargc++] = buf1; |
| 56 |
|
rtargv[rtargc++] = "-y"; rtargv[rtargc++] = "0"; |
| 57 |
|
rtargv[rtargc++] = "-fff"; |
| 58 |
< |
rtargv[rtargc++] = "-ovl"; |
| 58 |
> |
rtargv[rtargc++] = vbool(VDIST) ? "-ovl" : "-ovL"; |
| 59 |
|
rtargv[rtargc++] = nowarn ? "-w-" : "-w+"; |
| 60 |
|
if (npt > 1) { |
| 61 |
< |
rtargv[rtargc++] = "-PP"; rtargv[rtargc++] = PFILE; |
| 61 |
> |
mktemp(pfile); |
| 62 |
> |
rtargv[rtargc++] = "-PP"; rtargv[rtargc++] = pfile; |
| 63 |
|
} |
| 64 |
|
rtargv[rtargc++] = vval(OCTREE); |
| 65 |
|
rtargv[rtargc] = NULL; |
| 210 |
|
if (n) /* read past end? */ |
| 211 |
|
error(INTERNAL, "packet sync error in get_packets"); |
| 212 |
|
/* take from queue */ |
| 213 |
< |
if (pldone = NULL) |
| 213 |
> |
if (pldone == NULL) |
| 214 |
|
pldone = plend = pqueue[pn]; |
| 215 |
|
else |
| 216 |
|
plend->next = pqueue[pn]; |
| 221 |
|
} |
| 222 |
|
return(pldone); /* return finished packets */ |
| 223 |
|
eoferr: |
| 224 |
< |
error(USER, "unexpected EOF from rtrace process"); |
| 224 |
> |
error(USER, "rtrace process died"); |
| 225 |
|
} |
| 226 |
|
|
| 227 |
|
|
| 255 |
|
if (pqlen[i]) { |
| 256 |
|
if (rpdone == NULL) { /* tack on queue */ |
| 257 |
|
rpdone = rpl = pqueue[i]; |
| 258 |
< |
n = rpl->nr; |
| 258 |
> |
if ((nr = rpl->nr) < RPACKSIZ) nr++; |
| 259 |
|
} else { |
| 260 |
|
rpl->next = pqueue[i]; |
| 261 |
< |
n = 0; |
| 261 |
> |
nr = 0; |
| 262 |
|
} |
| 263 |
< |
while (rpl->next != NULL) |
| 264 |
< |
n += (rpl = rpl->next)->nr; |
| 263 |
> |
while (rpl->next != NULL) { |
| 264 |
> |
nr += (rpl = rpl->next)->nr; |
| 265 |
> |
if (rpl->nr < RPACKSIZ) |
| 266 |
> |
nr++; /* add flush block */ |
| 267 |
> |
} |
| 268 |
|
n = readbuf(rtpd[i][0], (char *)rtbuf, |
| 269 |
< |
4*sizeof(float)*n); |
| 269 |
> |
4*sizeof(float)*nr); |
| 270 |
|
if (n < 0) |
| 271 |
|
error(SYSTEM, "read failure in flush_queue"); |
| 272 |
|
bp = rtbuf; /* process packets */ |
| 293 |
|
FILE *fp; |
| 294 |
|
int pid; |
| 295 |
|
|
| 296 |
< |
if ((fp = fopen(PFILE, "r")) == NULL) |
| 296 |
> |
if ((fp = fopen(pfile, "r")) == NULL) |
| 297 |
|
return; |
| 298 |
|
if (fscanf(fp, "%*s %d", &pid) != 1 || kill(pid, SIGALRM) < 0) |
| 299 |
< |
unlink(PFILE); |
| 299 |
> |
unlink(pfile); |
| 300 |
|
fclose(fp); |
| 301 |
|
} |
| 302 |
|
|