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.22 by gregl, Fri Nov 7 12:12:53 1997 UTC vs.
Revision 2.25 by gregl, Sat Jan 3 20:07:31 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1996 Regents of the University of California */
1 > /* Copyright (c) 1997 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ LBL";
4 > static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
# Line 9 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9   */
10  
11   #include "standard.h"
12 + #include "random.h"
13  
14   #ifdef F_SETLKW
15   #include "paths.h"
# Line 170 | Line 171 | io_process()           /* just act as go-between for actual pro
171          char    buf[BUFSIZ], *pfin, *pfout, *pferr;
172          int     pid, nfds;
173          int     fdout, fderr = -1;
174 +        int     status = 0;
175          fd_set  readfds, excepfds;
176                                          /* load persist file */
177          n = 40;
# Line 177 | Line 179 | io_process()           /* just act as go-between for actual pro
179                  if (!n--)
180                          error(USER, "unattended persist file?");
181                  pflock(0);
182 <                sleep(15);              /* wait until ready */
182 >                sleep(3+(3*getpid()+random())%13);      /* wait until ready */
183                  pflock(1);
184          }
185          if (nr < 0)
# Line 268 | Line 270 | io_process()           /* just act as go-between for actual pro
270                                  close(fderr);
271                                  /* close(2);    don't close stderr! */
272                                  fderr = -1;
273 <                        } else
274 <                                do {            /* write it all */
273 >                        } else {
274 >                                cp[nr] = '\0';  /* deduce status if we can */
275 >                                n = strlen(progname);
276 >                                if (!strncmp(cp, progname, n) &&
277 >                                                cp[n++] == ':' &&
278 >                                                cp[n++] == ' ') {
279 >                                        register struct erract  *ep;
280 >                                        for (ep = erract; ep < erract+NERRS;
281 >                                                        ep++)
282 >                                                if (ep->pre[0] &&
283 >                                                        !strncmp(cp+n, ep->pre,
284 >                                                            strlen(ep->pre))) {
285 >                                                        status = ep->ec;
286 >                                                        break;
287 >                                                }
288 >                                }
289 >                                do {            /* write message */
290                                          if ((n = write(2, cp, nr)) <= 0)
291                                                  goto writerr;
292                                          cp += n;
293                                  } while ((nr -= n) > 0);
294 +                        }
295                  }
296                                                  /* renderer stdout */
297                  if (fdout >= 0 && (FD_ISSET(fdout, &readfds) ||
# Line 293 | Line 311 | io_process()           /* just act as go-between for actual pro
311                                  } while ((nr -= n) > 0);
312                  }
313          }
314 <        _exit(0);               /* we ought to return renderer error status! */
314 >        wait(0);                /* wait for feeder process */
315 >        _exit(status);
316   formerr:
317          error(USER, "format error in persist file");
318   readerr:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines