14 |
|
#include <sys/types.h> |
15 |
|
#include <sys/stat.h> |
16 |
|
|
17 |
+ |
#ifndef FRAGWARN |
18 |
+ |
#define FRAGWARN 20 /* fragmentation for warning (%) */ |
19 |
+ |
#endif |
20 |
|
#ifndef MAXQTIME |
21 |
|
#define MAXQTIME 5 /* target maximum seconds in queue */ |
22 |
|
#endif |
150 |
|
if (gotsig++) /* two signals and we're gone! */ |
151 |
|
_exit(signo); |
152 |
|
|
153 |
< |
alarm(60); /* allow 60 seconds to clean up */ |
153 |
> |
alarm(120); /* allow 2 minutes to clean up */ |
154 |
|
signal(SIGALRM, SIG_DFL); /* make certain we do die */ |
155 |
|
eputs("signal - "); |
156 |
|
eputs(sigerr[signo]); |
272 |
|
|
273 |
|
rholo() /* holodeck main loop */ |
274 |
|
{ |
275 |
+ |
static long nextfragwarn = 100*(1L<<20); |
276 |
|
static int idle = 0; |
277 |
|
PACKET *pl = NULL, *plend; |
278 |
+ |
long fsiz; |
279 |
|
int pksiz; |
280 |
|
register PACKET *p; |
281 |
|
time_t t; |
289 |
|
return(1); |
290 |
|
} else if (idle) |
291 |
|
return(0); /* all done */ |
292 |
< |
/* check file size */ |
293 |
< |
if (maxdisk > 0 && hdfilen(hdlist[0]->fd) >= maxdisk) { |
292 |
> |
fsiz = hdfilen(hdlist[0]->fd); /* check file size */ |
293 |
> |
if (maxdisk > 0 && fsiz >= maxdisk) { |
294 |
|
error(WARNING, "file limit exceeded"); |
295 |
|
done_rtrace(); |
296 |
|
return(1); /* comes back */ |
297 |
|
} |
298 |
+ |
#if FRAGWARN |
299 |
+ |
if (fsiz >= nextfragwarn && |
300 |
+ |
(fsiz-hdfiluse(hdlist[0]->fd,0))/(fsiz/100) > FRAGWARN) { |
301 |
+ |
sprintf(errmsg, "holodeck file fragmentation is %.0f%%", |
302 |
+ |
100.*(fsiz-hdfiluse(hdlist[0]->fd,1))/fsiz); |
303 |
+ |
error(WARNING, errmsg); |
304 |
+ |
nextfragwarn = fsiz + (fsiz>>2); /* decent interval */ |
305 |
+ |
} |
306 |
+ |
#endif |
307 |
|
t = time(NULL); /* check time */ |
308 |
|
if (endtime > 0 && t >= endtime) { |
309 |
|
error(WARNING, "time limit exceeded"); |
381 |
|
for (i = 0; i < 3; i++) |
382 |
|
len[i] = VLEN(gp->xv[i]); |
383 |
|
if (!vdef(GRID)) { |
384 |
< |
d = 2/5e5*( len[0]*len[0]*(len[1]*len[1] + |
384 |
> |
d = 2/2e5*( len[0]*len[0]*(len[1]*len[1] + |
385 |
|
len[2]*len[2] + 4*len[1]*len[2]) |
386 |
|
+ len[1]*len[1]*len[2]*(len[2] + 4*len[0]) |
387 |
|
+ 4*len[0]*len[1]*len[2]*len[2] ); |
434 |
|
} |
435 |
|
|
436 |
|
|
437 |
+ |
int |
438 |
|
headline(s) /* process information header line */ |
439 |
|
char *s; |
440 |
|
{ |
448 |
|
HOLOFMT, hdkfile, FMTSTR, fmt); |
449 |
|
error(USER, errmsg); |
450 |
|
} |
451 |
< |
return; |
451 |
> |
return(0); |
452 |
|
} |
453 |
|
for (cp = s; *cp; cp++) /* take off any comments */ |
454 |
|
if (*cp == '#') { |
456 |
|
break; |
457 |
|
} |
458 |
|
setvariable(s, matchvar); /* don't flag errors */ |
459 |
+ |
return(0); |
460 |
|
} |
461 |
|
|
462 |
|
|