ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rholo.c
(Generate patch)

Comparing ray/src/hd/rholo.c (file contents):
Revision 3.36 by gregl, Sat Jan 10 16:37:10 1998 UTC vs.
Revision 3.84 by greg, Tue Jan 21 22:30:01 2025 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Radiance holodeck generation controller
6   */
7  
8 < #include "rholo.h"
9 < #include "random.h"
8 > #include <stdio.h>
9 > #include <time.h>
10   #include <signal.h>
14 #include <sys/types.h>
11   #include <sys/stat.h>
12 + #include <string.h>
13  
14 + #include "platform.h"
15 + #include "rterror.h"
16 + #include "resolu.h"
17 + #include "rholo.h"
18 + #include "random.h"
19 +
20 + #ifndef FRAGWARN
21 + #define FRAGWARN        20              /* fragmentation for warning (%) */
22 + #endif
23   #ifndef MAXQTIME
24 < #define MAXQTIME        5               /* target maximum seconds in queue */
24 > #define MAXQTIME        3               /* target maximum seconds in queue */
25   #endif
26 +                                        /* manual cache flushing frequency */
27 + #ifndef RTFLUSH
28 + #if MAXQTIME
29 + #define RTFLUSH         (300/MAXQTIME*totqlen)  /* <= 5 minutes */
30 + #else
31 + #define RTFLUSH         (50*totqlen)            /* just guess */
32 + #endif
33 + #endif
34                          /* the following must be consistent with rholo.h */
35   int     NVARS = NRHVARS;                /* total number of variables */
36  
# Line 26 | Line 40 | char   *progname;              /* our program name */
40   char    *hdkfile;               /* holodeck file name */
41   char    froot[256];             /* root file name */
42  
29 int     nowarn = 0;             /* turn warnings off? */
30
43   int     ncprocs = 0;            /* desired number of compute processes */
44  
45   char    *outdev = NULL;         /* output device name */
46  
47   int     readinp = 0;            /* read commands from stdin */
48  
49 < int     force = 0;              /* allow overwrite of holodeck */
49 > int     force = 0;              /* allow overwrite of holodeck (-1 == read-only) */
50  
51   time_t  starttime;              /* time we got started */
52   time_t  endtime;                /* time we should end by */
53   time_t  reporttime;             /* time for next report */
54  
55 < long    maxdisk;                /* maximum file space (bytes) */
55 > off_t   maxdisk;                /* maximum file space (bytes) */
56  
57   int     rtargc = 1;             /* rtrace command */
58 < char    *rtargv[128] = {"rtrace", NULL};
58 > char    *rtargv[MAXRTARGC] = {"rtrace", NULL};
59  
60   int     orig_mode = -1;         /* original file mode (-1 if unchanged) */
61  
# Line 51 | Line 63 | long   nraysdone = 0L;         /* number of rays done */
63   long    npacksdone = 0L;        /* number of packets done */
64  
65   PACKET  *freepacks;             /* available packets */
66 < int     avgqlen;                /* average queue length when full */
66 > int     totqlen;                /* maximum queue length (number of packets) */
67  
68   char  *sigerr[NSIG];            /* signal error messages */
69  
70 < extern time_t   time();
70 > extern int      nowarn;         /* turn warnings off? */
71  
72 + static void onsig(int  signo);
73 + static void sigdie(int  signo, char  *msg);
74 + static int resfmode(int fd, int mod);
75 + static void initrholo(void);
76 + static int rholo(void);
77 + static void setdefaults(HDGRID  *gp);
78 + static void creatholo(HDGRID    *gp);
79 + static gethfunc headline;
80 + static void loadholo(void);
81 + static void rootname(char       *rn, char       *fn);
82 + static void badvalue(int        vc);
83  
84 < main(argc, argv)
85 < int     argc;
86 < char    *argv[];
84 >
85 > int
86 > main(
87 >        int     argc,
88 >        char    *argv[]
89 > )
90   {
91          int     i;
92  
67        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]) {
# Line 72 | Line 97 | char   *argv[];
97                          nowarn++;
98                          break;
99                  case 'f':                       /* force overwrite */
100 <                        force++;
100 >                        force = 1;
101                          break;
102 +                case 'r':                       /* read-only mode */
103 +                        force = -1;
104 +                        break;
105                  case 'i':                       /* read input from stdin */
106                          readinp++;
107                          break;
# Line 116 | Line 144 | char   *argv[];
144                  HDGRID  hdg[HDMAX];
145                                                          /* set defaults */
146                  setdefaults(hdg);
147 +                                                        /* check read-only */
148 +                if (force < 0)
149 +                        error(USER, "cannot create read-only holodeck");
150                                                          /* holodeck exists? */
151                  if (!force && access(hdkfile, R_OK|W_OK) == 0)
152                          error(USER,
# Line 133 | Line 164 | char   *argv[];
164          quit(0);
165   userr:
166          fprintf(stderr,
167 < "Usage: %s [-n nprocs][-o disp][-w][-f] output.hdk [control.hif|+|- [VAR=val ..]]\n",
167 > "Usage: %s [-n nprocs][-o disp][-i][-w][-r|-f] output.hdk [control.hif|+|- [VAR=val ..]]\n",
168                          progname);
169          quit(1);
170 +        return 1; /* pro forma return */
171   }
172  
173  
174 < onsig(signo)                            /* fatal signal */
175 < int  signo;
174 > static void
175 > onsig(                          /* fatal signal */
176 >        int  signo
177 > )
178   {
179          static int  gotsig = 0;
180  
181 <        if (gotsig++)                   /* two signals and we're gone! */
181 >        if (gotsig > 1)                 /* we're going as fast as we can! */
182 >                return;
183 >        if (gotsig++) {                 /* two signals and we split */
184 >                hdsync(NULL, 0);        /* don't leave w/o saying goodbye */
185                  _exit(signo);
186 <
187 <        alarm(60);                      /* allow 60 seconds to clean up */
151 <        signal(SIGALRM, SIG_DFL);       /* make certain we do die */
186 >        }
187 >        alarm(300);                     /* allow 10 minutes to clean up */
188          eputs("signal - ");
189          eputs(sigerr[signo]);
190          eputs("\n");
# Line 156 | Line 192 | int  signo;
192   }
193  
194  
195 < sigdie(signo, msg)                      /* set fatal signal */
196 < int  signo;
197 < char  *msg;
195 > static void
196 > sigdie(                 /* set fatal signal */
197 >        int  signo,
198 >        char  *msg
199 > )
200   {
201          if (signal(signo, onsig) == SIG_IGN)
202                  signal(signo, SIG_IGN);
# Line 166 | Line 204 | char  *msg;
204   }
205  
206  
207 < int
208 < resfmode(fd, mod)               /* restrict open file access mode */
209 < int     fd, mod;
207 > static int
208 > resfmode(               /* restrict open file access mode */
209 >        int     fd,
210 >        int     mod
211 > )
212   {
213          struct stat     stbuf;
214                                          /* get original mode */
# Line 186 | Line 226 | int    fd, mod;
226   }
227  
228  
229 < initrholo()                     /* get our holodeck running */
229 > static void
230 > initrholo(void)                 /* get our holodeck running */
231   {
232 <        extern int      global_packet();
192 <        register int    i;
232 >        int     i;
233                                                  /* close holodeck on exec() */
234          fcntl(hdlist[0]->fd, F_SETFD, FD_CLOEXEC);
235  
# Line 199 | Line 239 | initrholo()                    /* get our holodeck running */
239                  init_global();
240                                                  /* record disk space limit */
241          if (!vdef(DISKSPACE))
242 <                maxdisk = 0;
242 >                maxdisk = ((off_t)1<<(sizeof(off_t)*8-2)) - 1024;
243          else
244                  maxdisk = 1024.*1024.*vflt(DISKSPACE);
245                                                  /* set up memory cache */
246          if (outdev == NULL)
247 <                hdcachesize = 0;        /* manual flushing */
247 >                hdcachesize = 0;                /* manual flushing */
248          else if (vdef(CACHE))
249                  hdcachesize = 1024.*1024.*vflt(CACHE);
250                                                  /* open report file */
251          if (vdef(REPORT)) {
252 <                register char   *s = sskip2(vval(REPORT), 1);
252 >                char    *s = sskip2(vval(REPORT), 1);
253                  if (*s && freopen(s, "a", stderr) == NULL)
254                          quit(2);
255          }
# Line 222 | Line 262 | initrholo()                    /* get our holodeck running */
262                  endtime = starttime + vflt(TIME)*3600. + .5;
263                                                  /* start rtrace */
264          if (ncprocs > 0) {
265 <                i = start_rtrace();
265 >                totqlen = i = start_rtrace();
266                  if (i < 1)
267                          error(USER, "cannot start rtrace process(es)");
268                  if (vdef(REPORT)) {             /* make first report */
# Line 233 | Line 273 | initrholo()                    /* get our holodeck running */
273                  freepacks = (PACKET *)bmalloc(i*sizeof(PACKET));
274                  if (freepacks == NULL)
275                          goto memerr;
236                if (!(avgqlen = i/nprocs))      /* record mean queue length */
237                        avgqlen = 1;
276                  freepacks[--i].nr = 0;
277                  freepacks[i].next = NULL;
278                  if (!vdef(OBSTRUCTIONS) || !vbool(OBSTRUCTIONS)) {
# Line 253 | Line 291 | initrholo()                    /* get our holodeck running */
291          }
292                                          /* set up signal handling */
293          sigdie(SIGINT, "Interrupt");
256        sigdie(SIGHUP, "Hangup");
294          sigdie(SIGTERM, "Terminate");
295 + #ifdef SIGHUP
296 +        sigdie(SIGHUP, "Hangup");
297 + #endif
298 + #ifdef SIGPIPE
299          sigdie(SIGPIPE, "Broken pipe");
300 + #endif
301 + #ifdef SIGALRM
302          sigdie(SIGALRM, "Alarm clock");
303 + #endif
304   #ifdef  SIGXCPU
305          sigdie(SIGXCPU, "CPU limit exceeded");
306 + #endif
307 + #ifdef  SIGXFSZ
308          sigdie(SIGXFSZ, "File size exceeded");
309   #endif
310 <                                                /* protect holodeck file */
311 <        orig_mode = resfmode(hdlist[0]->fd, ncprocs>0 ? 0 : 0444);
310 >                                        /* protect holodeck file */
311 >        orig_mode = resfmode(hdlist[0]->fd, (ncprocs>0) & (force>=0) ? 0 : 0444);
312          return;
313   memerr:
314          error(SYSTEM, "out of memory in initrholo");
315   }
316  
317  
318 < rholo()                         /* holodeck main loop */
318 > static int
319 > rholo(void)                             /* holodeck main loop */
320   {
321 +        static off_t    nextfragwarn = 100L<<20;
322          static int      idle = 0;
323          PACKET  *pl = NULL, *plend;
324 +        off_t   fsiz;
325          int     pksiz;
326 <        register PACKET *p;
326 >        PACKET  *p;
327          time_t  t;
328                                          /* check display */
329          if (nprocs <= 0)
# Line 286 | Line 335 | rholo()                                /* holodeck main loop */
335                          return(1);
336          } else if (idle)
337                  return(0);              /* all done */
338 <                                        /* check file size */
339 <        if (maxdisk > 0 && hdfilen(hdlist[0]->fd) >= maxdisk) {
340 <                error(WARNING, "file limit exceeded");
338 >        fsiz = hdfilen(hdlist[0]->fd);  /* check file size */
339 >        if (maxdisk > 0 && fsiz >= maxdisk) {
340 >                error(USER, "file limit exceeded");
341                  done_rtrace();
342                  return(1);      /* comes back */
343          }
344 + #if FRAGWARN
345 +        if (fsiz >= nextfragwarn) {
346 +                double  pctfrag = 100.*(fsiz-hdfiluse(hdlist[0]->fd))/fsiz;
347 +                if (pctfrag >= (double)FRAGWARN) {
348 +                        sprintf(errmsg, "holodeck file fragmentation is %.0f%%",
349 +                                        pctfrag);
350 +                        error(WARNING, errmsg);
351 +                        nextfragwarn = fsiz + (fsiz>>2);
352 +                } else
353 +                        nextfragwarn = fsiz + (10L<<20);
354 +        }
355 + #endif
356          t = time(NULL);                 /* check time */
357          if (endtime > 0 && t >= endtime) {
358 <                error(WARNING, "time limit exceeded");
358 >                error(USER, "time limit exceeded");
359                  done_rtrace();
360                  return(1);      /* comes back */
361          }
362          if (reporttime > 0 && t >= reporttime)
363                  report(t);
364                                          /* figure out good packet size */
365 +        pksiz = RPACKSIZ;
366   #if MAXQTIME
367 <        pksiz = nraysdone*MAXQTIME/(avgqlen*(t - starttime + 1L));
368 <        if (pksiz < 1)
369 <                pksiz = 1;
370 <        else if (pksiz > RPACKSIZ)
367 >        if (!chunkycmp) {
368 >                pksiz = nraysdone*MAXQTIME/(totqlen*(t - starttime + 1L));
369 >                if (pksiz < 1) pksiz = 1;
370 >                else if (pksiz > RPACKSIZ) pksiz = RPACKSIZ;
371 >        }
372   #endif
310                pksiz = RPACKSIZ;
373          idle = 0;                       /* get packets to process */
374          while (freepacks != NULL) {
375                  p = freepacks; freepacks = p->next; p->next = NULL;
# Line 326 | Line 388 | rholo()                                /* holodeck main loop */
388   }
389  
390  
391 < setdefaults(gp)                 /* set default values */
392 < register HDGRID *gp;
391 > static void
392 > setdefaults(                    /* set default values */
393 >        HDGRID  *gp
394 > )
395   {
396 <        extern char     *atos();
333 <        register int    i;
396 >        int     i;
397          int     n;
398 <        double  len[3], maxlen, d;
336 <        char    buf[64];
398 >        double  len[3], d;
399  
400          if (!vdef(SECTION)) {
401                  sprintf(errmsg, "%s must be defined", vnam(SECTION));
# Line 351 | Line 413 | register HDGRID        *gp;
413          }
414                                  /* append rendering options */
415          if (vdef(RENDER))
416 <                rtargc += wordstring(rtargv+rtargc, vval(RENDER));
416 >                rtargc += wordstring(rtargv+rtargc, MAXRTARGC-rtargc, vval(RENDER));
417          
418          if (gp == NULL)         /* already initialized? */
419                  return;
# Line 366 | Line 428 | register HDGRID        *gp;
428                                  &gp->xv[2][0], &gp->xv[2][1], &gp->xv[2][2],
429                                  &gp->grid[0], &gp->grid[1], &gp->grid[2]) < 12)
430                          badvalue(SECTION);
369                maxlen = 0.;
431                  for (i = 0; i < 3; i++)
432 <                        if ((len[i] = VLEN(gp->xv[i])) > maxlen)
433 <                                maxlen = len[i];
434 <                if (!vdef(GRID))
435 <                        d = 0.125*maxlen;
436 <                else if ((d = vflt(GRID)) <= FTINY)
432 >                        len[i] = VLEN(gp->xv[i]);
433 >                if (!vdef(GRID)) {
434 >                        d = 2/2e5*( len[0]*len[0]*(len[1]*len[1] +
435 >                                        len[2]*len[2] + 4*len[1]*len[2])
436 >                                + len[1]*len[1]*len[2]*(len[2] + 4*len[0])
437 >                                + 4*len[0]*len[1]*len[2]*len[2] );
438 >                        d = sqrt(sqrt(d));
439 >                } else if ((d = vflt(GRID)) <= FTINY)
440                          badvalue(GRID);
441                  for (i = 0; i < 3; i++)
442                          if (gp->grid[i] <= 0)
# Line 381 | Line 445 | register HDGRID        *gp;
445   }
446  
447  
448 < creatholo(gp)                   /* create a holodeck output file */
449 < HDGRID  *gp;
448 > static void
449 > creatholo(                      /* create a holodeck output file */
450 >        HDGRID  *gp
451 > )
452   {
453          extern char     VersionID[];
454 <        int4    lastloc, nextloc;
454 >        off_t   lastloc, nextloc;
455          int     n;
456          int     fd;
457          FILE    *fp;
458                                          /* open & truncate file */
459 <        if ((fp = fopen(hdkfile, "w+")) == NULL) {
459 >        if ((fp = fopen(hdkfile, "wb+")) == NULL) {
460                  sprintf(errmsg, "cannot open \"%s\" for writing", hdkfile);
461                  error(SYSTEM, errmsg);
462          }
# Line 398 | Line 464 | HDGRID *gp;
464          newheader("RADIANCE", fp);
465          fprintf(fp, "SOFTWARE= %s\n", VersionID);
466          printvars(fp);
467 +        fputendian(fp);
468          fputformat(HOLOFMT, fp);
469          fputc('\n', fp);
470          putw(HOLOMAGIC, fp);            /* put magic number */
471          fd = dup(fileno(fp));
472          fclose(fp);                     /* flush and close stdio stream */
473 <        lastloc = lseek(fd, 0L, 2);
473 >        lastloc = lseek(fd, (off_t)0, SEEK_END);
474          for (n = vdef(SECTION); n--; gp++) {    /* initialize each section */
475                  nextloc = 0L;
476                  write(fd, (char *)&nextloc, sizeof(nextloc));
# Line 411 | Line 478 | HDGRID *gp;
478                  if (!n)
479                          break;
480                  nextloc = hdfilen(fd);          /* write section pointer */
481 <                if (lseek(fd, (long)lastloc, 0) < 0)
481 >                if (lseek(fd, lastloc, SEEK_SET) < 0)
482                          error(SYSTEM,
483                                  "cannot seek on holodeck file in creatholo");
484                  write(fd, (char *)&nextloc, sizeof(nextloc));
485 <                lseek(fd, (long)(lastloc=nextloc), 0);
485 >                lseek(fd, (lastloc=nextloc), SEEK_SET);
486          }
487   }
488  
489  
490 < headline(s)                     /* process information header line */
491 < char    *s;
490 > static int
491 > headline(                       /* process information header line */
492 >        char    *s,
493 >        void    *p
494 > )
495   {
496          extern char     FMTSTR[];
497 <        register char   *cp;
498 <        char    fmt[32];
497 >        char    *cp;
498 >        char    fmt[MAXFMTLEN];
499  
500          if (formatval(fmt, s)) {
501                  if (strcmp(fmt, HOLOFMT)) {
# Line 433 | Line 503 | char   *s;
503                                          HOLOFMT, hdkfile, FMTSTR, fmt);
504                          error(USER, errmsg);
505                  }
506 <                return;
506 >                return(0);
507          }
508          for (cp = s; *cp; cp++)         /* take off any comments */
509                  if (*cp == '#') {
# Line 441 | Line 511 | char   *s;
511                          break;
512                  }
513          setvariable(s, matchvar);       /* don't flag errors */
514 +        return(0);
515   }
516  
517  
518 < loadholo()                      /* start loading a holodeck from fname */
518 > static void
519 > loadholo(void)                  /* start loading a holodeck from fname */
520   {
449        extern long     ftell();
521          FILE    *fp;
522          int     fd;
523          int     n;
524 <        int4    nextloc;
525 <                                        /* open holodeck file */
526 <        if ((fp = fopen(hdkfile, ncprocs>0 ? "r+" : "r")) == NULL) {
527 <                sprintf(errmsg, "cannot open \"%s\" for %s", hdkfile,
528 <                                ncprocs>0 ? "appending" : "reading");
529 <                error(SYSTEM, errmsg);
524 >        off_t   nextloc;
525 >        
526 >        if ((ncprocs > 0) & (force >= 0))
527 >                fp = fopen(hdkfile, "rb+");
528 >        else
529 >                fp = NULL;
530 >        if (fp == NULL) {
531 >                if ((fp = fopen(hdkfile, "rb")) == NULL) {
532 >                        sprintf(errmsg, "cannot open \"%s\"", hdkfile);
533 >                        error(SYSTEM, errmsg);
534 >                }
535 >                if (ncprocs > 0) {
536 >                        sprintf(errmsg, "\"%s\" is read-only", hdkfile);
537 >                        if (outdev == NULL)
538 >                                error(USER, errmsg);
539 >                        strcat(errmsg, "; new rays will be discarded");
540 >                        error(WARNING, errmsg);
541 >                        force = -1;
542 >                }
543          }
544                                          /* load variables from header */
545          getheader(fp, headline, NULL);
# Line 469 | Line 553 | loadholo()                     /* start loading a holodeck from fname */
553          fd = dup(fileno(fp));
554          fclose(fp);                             /* done with stdio */
555          for (n = 0; nextloc > 0L; n++) {        /* initialize each section */
556 <                lseek(fd, (long)nextloc, 0);
556 >                lseek(fd, nextloc, SEEK_SET);
557                  read(fd, (char *)&nextloc, sizeof(nextloc));
558                  hdinit(fd, NULL);
559          }
# Line 481 | Line 565 | loadholo()                     /* start loading a holodeck from fname */
565   }
566  
567  
568 < done_packets(pl)                /* handle finished packets */
569 < PACKET  *pl;
568 > void
569 > done_packets(           /* handle finished packets */
570 >        PACKET  *pl
571 > )
572   {
573          static int      n2flush = 0;
574 <        register PACKET *p;
574 >        PACKET  *p;
575  
576          while (pl != NULL) {
577                  p = pl; pl = p->next; p->next = NULL;
578                  if (p->nr > 0) {                /* add to holodeck */
579 <                        bcopy((char *)p->ra,
580 <                                (char *)hdnewrays(hdlist[p->hd],p->bi,p->nr),
579 >                        memcpy( (void *)hdnewrays(hdlist[p->hd],p->bi,p->nr),
580 >                                (void *)p->ra,
581                                  p->nr*sizeof(RAYVAL));
582                          if (outdev != NULL)     /* display it */
583                                  disp_packet((PACKHEAD *)p);
584 <                        if (hdcachesize <= 0)   /* manual flushing */
584 >                        if (hdcachesize <= 0)
585                                  n2flush++;
586                          nraysdone += p->nr;
587                          npacksdone++;
# Line 504 | Line 590 | PACKET *pl;
590                  p->next = freepacks;            /* push onto free list */
591                  freepacks = p;
592          }
593 <        if (n2flush > 300/MAXQTIME*avgqlen*nprocs) {
594 <                hdflush(NULL);                  /* flush holodeck buffers */
593 >        if (n2flush >= RTFLUSH) {
594 >                if (outdev != NULL)
595 >                        hdsync(NULL, 1);
596 >                else
597 >                        hdflush(NULL);
598                  n2flush = 0;
599          }
600   }
601  
602  
603 < rootname(rn, fn)                /* remove tail from end of fn */
604 < register char   *rn, *fn;
603 > static void
604 > rootname(               /* remove tail from end of fn */
605 >        char    *rn,
606 >        char    *fn
607 > )
608   {
609          char    *tp, *dp;
610  
611 <        for (tp = NULL, dp = rn; *rn = *fn++; rn++)
611 >        for (tp = NULL, dp = rn; (*rn = *fn++); rn++) {
612                  if (*rn == '/')
613                          dp = rn;
614                  else if (*rn == '.')
615                          tp = rn;
616 +        }
617          if (tp != NULL && tp > dp)
618                  *tp = '\0';
619   }
620  
621  
622 < badvalue(vc)                    /* report bad variable value and exit */
623 < int     vc;
622 > static void
623 > badvalue(                       /* report bad variable value and exit */
624 >        int     vc
625 > )
626   {
627          sprintf(errmsg, "bad value for variable '%s'", vnam(vc));
628          error(USER, errmsg);
629   }
630  
631  
632 < eputs(s)                        /* put error message to stderr */
633 < register char  *s;
632 > void
633 > eputs(const char *s)            /* put error message to stderr */
634   {
635          static int  midline = 0;
636  
# Line 553 | Line 648 | register char  *s;
648   }
649  
650  
651 < wputs(s)                        /* put warning string to stderr */
652 < char    *s;
651 > void
652 > quit(int ec)                    /* exit program gracefully */
653   {
559        if (!nowarn)
560                eputs(s);
561 }
562
563
564 quit(ec)                        /* exit program gracefully */
565 int     ec;
566 {
654          int     status = 0;
655  
656          if (hdlist[0] != NULL) {        /* close holodeck */
657                  if (nprocs > 0)
658                          status = done_rtrace();         /* calls hdsync() */
659 <                if (ncprocs > 0 && vdef(REPORT)) {
660 <                        long    fsiz, fuse;
659 >                if ((ncprocs > 0) & (force >= 0) && vdef(REPORT)) {
660 >                        off_t   fsiz, fuse;
661                          fsiz = hdfilen(hdlist[0]->fd);
662 <                        fuse = hdfiluse(hdlist[0]->fd, 1);
662 >                        fuse = hdfiluse(hdlist[0]->fd);
663                          fprintf(stderr,
664                          "%s: %.1f Mbyte holodeck file, %.1f%% fragmentation\n",
665                                          hdkfile, fsiz/(1024.*1024.),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines