90 |
|
{ |
91 |
|
int i; |
92 |
|
|
93 |
– |
initurand(16384); /* initialize urand */ |
93 |
|
progname = argv[0]; /* get arguments */ |
94 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
95 |
|
switch (argv[i][1]) { |
319 |
|
static int |
320 |
|
rholo(void) /* holodeck main loop */ |
321 |
|
{ |
322 |
< |
static long nextfragwarn = 100*(1L<<20); |
322 |
> |
static off_t nextfragwarn = 100L<<20; |
323 |
|
static int idle = 0; |
324 |
|
PACKET *pl = NULL, *plend; |
325 |
< |
off_t fsiz, fuse; |
325 |
> |
off_t fsiz; |
326 |
|
int pksiz; |
327 |
|
register PACKET *p; |
328 |
|
time_t t; |
338 |
|
return(0); /* all done */ |
339 |
|
fsiz = hdfilen(hdlist[0]->fd); /* check file size */ |
340 |
|
if (maxdisk > 0 && fsiz >= maxdisk) { |
341 |
< |
error(WARNING, "file limit exceeded"); |
341 |
> |
error(USER, "file limit exceeded"); |
342 |
|
done_rtrace(); |
343 |
|
return(1); /* comes back */ |
344 |
|
} |
345 |
|
#if FRAGWARN |
346 |
< |
if (fsiz >= nextfragwarn && |
347 |
< |
(fsiz-(fuse=hdfiluse(hdlist[0]->fd)))/(fsiz/100) > FRAGWARN) { |
348 |
< |
sprintf(errmsg, "holodeck file fragmentation is %.0f%%", |
349 |
< |
100.*(fsiz-fuse)/fsiz); |
350 |
< |
error(WARNING, errmsg); |
351 |
< |
nextfragwarn = fsiz + (fsiz>>2); |
346 |
> |
if (fsiz >= nextfragwarn) { |
347 |
> |
double pctfrag = 100.*(fsiz-hdfiluse(hdlist[0]->fd))/fsiz; |
348 |
> |
if (pctfrag >= (double)FRAGWARN) { |
349 |
> |
sprintf(errmsg, "holodeck file fragmentation is %.0f%%", |
350 |
> |
pctfrag); |
351 |
> |
error(WARNING, errmsg); |
352 |
> |
nextfragwarn = fsiz + (fsiz>>2); |
353 |
> |
} else |
354 |
> |
nextfragwarn = fsiz + (10L<<20); |
355 |
|
} |
356 |
|
#endif |
357 |
|
t = time(NULL); /* check time */ |
358 |
|
if (endtime > 0 && t >= endtime) { |
359 |
< |
error(WARNING, "time limit exceeded"); |
359 |
> |
error(USER, "time limit exceeded"); |
360 |
|
done_rtrace(); |
361 |
|
return(1); /* comes back */ |
362 |
|
} |
534 |
|
error(SYSTEM, errmsg); |
535 |
|
} |
536 |
|
if (ncprocs > 0) { |
537 |
< |
sprintf(errmsg, |
538 |
< |
"\"%s\" opened read-only; new rays will be discarded", |
539 |
< |
hdkfile); |
537 |
> |
sprintf(errmsg, "\"%s\" is read-only", hdkfile); |
538 |
> |
if (outdev == NULL) |
539 |
> |
error(USER, errmsg); |
540 |
> |
strcat(errmsg, "; new rays will be discarded"); |
541 |
|
error(WARNING, errmsg); |
542 |
|
force = -1; |
543 |
|
} |