--- ray/src/rt/persist.c 2003/06/26 00:58:10 2.28 +++ ray/src/rt/persist.c 2003/10/22 02:06:35 2.33 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: persist.c,v 2.28 2003/06/26 00:58:10 schorsch Exp $"; +static const char RCSid[] = "$Id: persist.c,v 2.33 2003/10/22 02:06:35 greg Exp $"; #endif /* * Routines for persistent rtrace and rpict processes. @@ -9,23 +9,23 @@ static const char RCSid[] = "$Id: persist.c,v 2.28 200 #include "copyright.h" +#include +#include +#include + +#include "platform.h" +#include "rtprocess.h" /* getpid() */ #include "standard.h" #include "random.h" #ifdef F_SETLKW #include "paths.h" #include "selcall.h" -#include -#include #ifndef TIMELIM #define TIMELIM (8*3600) /* time limit for holding pattern */ #endif -#ifndef freebsd -#define mkfifo(fn,md) mknod(fn, S_IFIFO|(md), 0) -#endif - extern void io_process(); extern int headismine; /* boolean true if header belongs to me */ @@ -85,6 +85,7 @@ int lf; } +void persistfile(pfn) /* open persist file and lock it */ char *pfn; { @@ -136,7 +137,7 @@ pfhold() /* holding pattern for idle rendering proces n = strlen(buf); if (write(persistfd, buf, n) < n) error(SYSTEM, "error writing persist file"); - lseek(persistfd, (off_t)0L, 0); + lseek(persistfd, (off_t)0, SEEK_SET); /* wait TIMELIM for someone to signal us */ got_io = 0; signal(SIGIO, sig_io); @@ -209,23 +210,23 @@ io_process() /* just act as go-between for actual pro #endif pfdetach(); /* close & release persist file */ buf[nr] = '\0'; /* parse what we got */ - if ((cp = index(buf, ' ')) == NULL) + if ((cp = strchr(buf, ' ')) == NULL) goto formerr; *cp++ = '\0'; if ((pid = atoi(cp)) <= 0) goto formerr; - if ((cp = index(cp, '\n')) == NULL) + if ((cp = strchr(cp, '\n')) == NULL) goto formerr; pfin = ++cp; - if ((cp = index(cp, '\n')) == NULL) + if ((cp = strchr(cp, '\n')) == NULL) goto formerr; *cp++ = '\0'; pfout = cp; - if ((cp = index(cp, '\n')) == NULL) + if ((cp = strchr(cp, '\n')) == NULL) goto formerr; *cp++ = '\0'; pferr = cp; - if ((cp = index(cp, '\n')) == NULL) + if ((cp = strchr(cp, '\n')) == NULL) goto formerr; *cp++ = '\0'; if (cp-buf != nr)