--- ray/src/rt/persist.c 2003/02/25 02:47:23 2.27 +++ ray/src/rt/persist.c 2003/07/14 20:02:30 2.30 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: persist.c,v 2.27 2003/02/25 02:47:23 greg Exp $"; +static const char RCSid[] = "$Id: persist.c,v 2.30 2003/07/14 20:02:30 schorsch Exp $"; #endif /* * Routines for persistent rtrace and rpict processes. @@ -9,14 +9,17 @@ static const char RCSid[] = "$Id: persist.c,v 2.27 200 #include "copyright.h" +#include +#include +#include + +#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 */ @@ -85,6 +88,7 @@ int lf; } +void persistfile(pfn) /* open persist file and lock it */ char *pfn; { @@ -204,26 +208,28 @@ io_process() /* just act as go-between for actual pro } if (nr < 0) error(SYSTEM, "error reading persist file"); +#ifndef _WIN32 /* XXX we need a replacement for that one */ ftruncate(persistfd, (off_t)0L); /* truncate persist file */ +#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)