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

Comparing ray/src/rt/persist.c (file contents):
Revision 2.33 by greg, Wed Oct 22 02:06:35 2003 UTC vs.
Revision 2.34 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 17 | Line 17 | static const char      RCSid[] = "$Id$";
17   #include "rtprocess.h" /* getpid() */
18   #include "standard.h"
19   #include "random.h"
20 + #include "ray.h"
21  
22   #ifdef F_SETLKW
23   #include "paths.h"
# Line 26 | Line 27 | static const char      RCSid[] = "$Id$";
27   #define TIMELIM         (8*3600)        /* time limit for holding pattern */
28   #endif
29  
29 extern void     io_process();
30
30   extern int      headismine;     /* boolean true if header belongs to me */
32
31   extern char     *progname;      /* global program name */
34
32   extern char     *errfile;       /* global error file name */
36
33   static char     *persistfname = NULL;   /* persist file name */
34   static int      persistfd = -1;         /* persist file descriptor */
39
35   static char     inpname[TEMPLEN+1], outpname[TEMPLEN+1], errname[TEMPLEN+1];
36  
37 + typedef void (sighandler_t)(int);
38 + static sighandler_t sig_io;
39 + static sighandler_t sig_alrm;
40  
41 < void
42 < pfdetach()              /* release persist (and header) resources */
41 >
42 > extern void
43 > pfdetach(void)          /* release persist (and header) resources */
44   {
45          if (persistfd >= 0)
46                  close(persistfd);
# Line 54 | Line 53 | pfdetach()             /* release persist (and header) resources
53   }
54  
55  
56 < void
57 < pfclean()               /* clean up persist files */
56 > extern void
57 > pfclean(void)           /* clean up persist files */
58   {
59          if (persistfd >= 0)
60                  close(persistfd);
# Line 70 | Line 69 | pfclean()              /* clean up persist files */
69   }
70  
71  
72 < void
73 < pflock(lf)              /* place or release exclusive lock on file */
74 < int     lf;
72 > extern void
73 > pflock(         /* place or release exclusive lock on file */
74 >        int     lf
75 > )
76   {
77          struct flock    fls;
78  
# Line 85 | Line 85 | int    lf;
85   }
86  
87  
88 < void
89 < persistfile(pfn)        /* open persist file and lock it */
90 < char    *pfn;
88 > extern void
89 > persistfile(    /* open persist file and lock it */
90 >        char    *pfn
91 > )
92   {
93          persistfd = open(pfn, O_WRONLY|O_CREAT|O_EXCL, 0644);
94          if (persistfd >= 0) {
# Line 108 | Line 109 | char   *pfn;
109  
110   static int      got_io;
111  
112 < static void sig_io() { got_io++; }
112 > static void sig_io(int i) { got_io++; }
113  
114 < static void sig_alrm() { quit(0); }
114 > static void sig_alrm(int i) { quit(0); }
115  
116  
117 < void
118 < pfhold()                /* holding pattern for idle rendering process */
117 > extern void
118 > pfhold(void)            /* holding pattern for idle rendering process */
119   {
120 <        void    (*oldalrm)();
120 >        sighandler_t    *oldalrm;
121          char    buf[512];
122          register int    n;
123                                  /* close input and output descriptors */
# Line 141 | Line 142 | pfhold()               /* holding pattern for idle rendering proces
142                                  /* wait TIMELIM for someone to signal us */
143          got_io = 0;
144          signal(SIGIO, sig_io);
145 <        oldalrm = (void (*)())signal(SIGALRM, sig_alrm);
145 >        oldalrm = signal(SIGALRM, sig_alrm);
146          alarm(TIMELIM);
147          pflock(0);                      /* unlock persist file for attach */
148          while (!got_io)
# Line 184 | Line 185 | openerr:
185   }
186  
187  
188 < void
189 < io_process()            /* just act as go-between for actual process */
188 > extern void
189 > io_process(void)                /* just act as go-between for actual process */
190   {
191          register char   *cp;
192          register int    nr, n;
# Line 334 | Line 335 | io_process()           /* just act as go-between for actual pro
335                                  } while ((nr -= n) > 0);
336                  }
337          }
338 <        wait(0);                /* wait for feeder process */
338 >        wait(0);                /* wait for feeder process */ /* XXX platform */
339          _exit(status);
340   formerr:
341          error(USER, "format error in persist file");
# Line 346 | Line 347 | writerr:
347  
348   #else
349  
350 < void pfclean() {}
350 > extern void pfclean(void) {}
351  
352   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines