| 76 |
|
static int rholo(void); |
| 77 |
|
static void setdefaults(HDGRID *gp); |
| 78 |
|
static void creatholo(HDGRID *gp); |
| 79 |
< |
static int headline(char *s); |
| 79 |
> |
static gethfunc headline; |
| 80 |
|
static void loadholo(void); |
| 81 |
|
static void rootname(char *rn, char *fn); |
| 82 |
|
static void badvalue(int vc); |
| 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 long nextfragwarn = 100L<<20; |
| 323 |
|
static int idle = 0; |
| 324 |
|
PACKET *pl = NULL, *plend; |
| 325 |
|
off_t fsiz; |
| 343 |
|
return(1); /* comes back */ |
| 344 |
|
} |
| 345 |
|
#if FRAGWARN |
| 346 |
< |
if (fsiz >= nextfragwarn && |
| 347 |
< |
(fsiz-hdfiluse(hdlist[0]->fd,0))/(fsiz/100) > FRAGWARN) { |
| 348 |
< |
sprintf(errmsg, "holodeck file fragmentation is %.0f%%", |
| 349 |
< |
100.*(fsiz-hdfiluse(hdlist[0]->fd,1))/fsiz); |
| 350 |
< |
error(WARNING, errmsg); |
| 351 |
< |
nextfragwarn = fsiz + (fsiz>>2); /* decent interval */ |
| 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 */ |
| 490 |
|
|
| 491 |
|
static int |
| 492 |
|
headline( /* process information header line */ |
| 493 |
< |
char *s |
| 493 |
> |
char *s, |
| 494 |
> |
void *p |
| 495 |
|
) |
| 496 |
|
{ |
| 497 |
|
extern char FMTSTR[]; |
| 661 |
|
if ((ncprocs > 0) & (force >= 0) && vdef(REPORT)) { |
| 662 |
|
off_t fsiz, fuse; |
| 663 |
|
fsiz = hdfilen(hdlist[0]->fd); |
| 664 |
< |
fuse = hdfiluse(hdlist[0]->fd, 1); |
| 664 |
> |
fuse = hdfiluse(hdlist[0]->fd); |
| 665 |
|
fprintf(stderr, |
| 666 |
|
"%s: %.1f Mbyte holodeck file, %.1f%% fragmentation\n", |
| 667 |
|
hdkfile, fsiz/(1024.*1024.), |