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

Comparing ray/src/util/rpiece.c (file contents):
Revision 2.11 by greg, Sun Aug 9 23:05:17 1992 UTC vs.
Revision 2.12 by greg, Fri Aug 21 12:31:27 1992 UTC

# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include "view.h"
16   #include "resolu.h"
17  
18 + #ifndef NFS
19 + #define  NFS                    1
20 + #endif
21                                  /* set the following to 0 to forgo forking */
22   #ifndef MAXFORK
23 + #if NFS
24   #define  MAXFORK                3       /* allotment of duped processes */
25 + #else
26 + #define  MAXFORK                0
27   #endif
28 + #endif
29  
30                                  /* rpict command */
31   char  *rpargv[128] = {"rpict", "-S", "1", "-x", "512", "-y", "512", "-pa", "1"};
# Line 179 | Line 186 | char  **av;
186          scanorig = ftell(fp);           /* record position of first scanline */
187          if (fclose(fp) == -1)           /* done with stream i/o */
188                  goto filerr;
189 + #if NFS
190          sync();                         /* flush NFS buffers */
191 + #endif
192                                          /* start rpict process */
193          if (open_process(rpd, rpargv) <= 0) {
194                  fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]);
# Line 352 | Line 361 | int  xpos, ypos;
361   #else
362          pid = -1;               /* no forking */
363   #endif
364 + #if NFS
365                                  /* lock file section so NFS doesn't mess up */
366          fls.l_whence = 0;
367          fls.l_len = (long)vres*hmult*hres*sizeof(COLR);
368          fls.l_start = scanorig + (vmult-1-ypos)*fls.l_len;
369          fls.l_type = F_WRLCK;
370          fcntl(outfd, F_SETLKW, &fls);
371 + #endif
372                                  /* write new piece to file */
373          if (lseek(outfd, fls.l_start+(long)xpos*hres*sizeof(COLR), 0) == -1)
374                  goto seekerr;
# Line 376 | Line 387 | int  xpos, ypos;
387                                  goto seekerr;
388                  }
389          if (pid == -1) {        /* fork failed */
390 + #if NFS
391                  fls.l_type = F_UNLCK;           /* release lock */
392                  fcntl(outfd, F_SETLKW, &fls);
393 + #endif
394                  return(0);
395          }
396          _exit(0);               /* else exit child process (releasing lock) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines