9 |
|
*/ |
10 |
|
|
11 |
|
#include "standard.h" |
12 |
+ |
|
13 |
+ |
#ifdef F_SETLKW |
14 |
+ |
|
15 |
|
#include "paths.h" |
16 |
|
#include <signal.h> |
17 |
|
#include <sys/types.h> |
18 |
|
#include <sys/stat.h> |
19 |
|
|
20 |
+ |
#ifndef TIMELIM |
21 |
+ |
#define TIMELIM (8*3600) /* time limit for holding pattern */ |
22 |
+ |
#endif |
23 |
+ |
|
24 |
|
extern char *strcpy(), *index(); |
25 |
|
|
26 |
|
extern int headismine; /* boolean true if header belongs to me */ |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
< |
sig_noop() {} |
93 |
> |
int sig_noop() {} |
94 |
|
|
95 |
|
|
96 |
|
pfhold() /* holding pattern for idle rendering process */ |
99 |
|
register int n; |
100 |
|
/* close input and output descriptors */ |
101 |
|
close(fileno(stdin)); |
95 |
– |
fflush(stdout); |
102 |
|
close(fileno(stdout)); |
103 |
|
/* create named pipes for input and output */ |
104 |
|
if (mknod(mktemp(strcpy(inpname,TEMPLATE)), S_IFIFO|0600) < 0) |
111 |
|
n = strlen(buf); |
112 |
|
if (write(persistfd, buf, n) < n) |
113 |
|
error(SYSTEM, "error writing persist file in pfhold"); |
114 |
< |
/* wait for someone to signal us */ |
115 |
< |
signal(SIGALRM, sig_noop); |
114 |
> |
/* wait TIMELIM for someone to signal us */ |
115 |
> |
signal(SIGIO, sig_noop); |
116 |
> |
alarm(TIMELIM); |
117 |
|
pflock(0); |
118 |
|
pause(); |
119 |
+ |
alarm(0); |
120 |
+ |
signal(SIGIO, SIG_DFL); |
121 |
|
pflock(1); |
122 |
|
/* someone wants us; reopen stdin and stdout */ |
123 |
|
if (freopen(inpname, "r", stdin) == NULL) |
164 |
|
if (cp-buf != nr) |
165 |
|
goto formerr; |
166 |
|
/* wake up rendering process */ |
167 |
< |
if (kill(pid, SIGALRM) < 0) |
167 |
> |
if (kill(pid, SIGIO) < 0) |
168 |
|
error(SYSTEM, "cannot signal rendering process in io_process"); |
169 |
|
pid = fork(); /* fork i/o process */ |
170 |
|
if (pid < 0) |
196 |
|
formerr: |
197 |
|
error(USER, "format error in persist file"); |
198 |
|
} |
199 |
+ |
|
200 |
+ |
#endif |