21 |
|
#else |
22 |
|
#include <sys/times.h> |
23 |
|
#include <sys/utsname.h> |
24 |
< |
#include <limits.h> |
24 |
> |
#include <unistd.h> |
25 |
|
#endif |
26 |
|
#endif |
27 |
|
|
140 |
|
#else |
141 |
|
struct tms tbuf; |
142 |
|
struct utsname nambuf; |
143 |
< |
#define hostname nambuf.sysname |
143 |
> |
double period; |
144 |
> |
#define hostname nambuf.nodename |
145 |
|
#endif |
146 |
|
|
147 |
|
tlastrept = time((time_t *)NULL); |
155 |
|
gethostname(hostname, sizeof(hostname)); |
156 |
|
#else |
157 |
|
times(&tbuf); |
158 |
< |
u = ( tbuf.tms_utime + tbuf.tms_cutime ) / CLK_TCK; |
159 |
< |
s = ( tbuf.tms_stime + tbuf.tms_cstime ) / CLK_TCK; |
158 |
> |
period = 1.0 / sysconf(_SC_CLK_TCK); |
159 |
> |
u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period; |
160 |
> |
s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period; |
161 |
|
uname(&nambuf); |
162 |
|
#endif |
163 |
|
|
166 |
|
nrays, pctdone, u/3600., s/3600., |
167 |
|
(tlastrept-tstart)/3600., hostname); |
168 |
|
eputs(errmsg); |
169 |
+ |
#ifndef BSD |
170 |
+ |
signal(SIGCONT, report); |
171 |
|
#undef hostname |
172 |
+ |
#endif |
173 |
|
} |
174 |
|
#else |
175 |
|
report() /* report progress */ |
178 |
|
sprintf(errmsg, "%lu rays, %4.2f%% after %5.4f hours\n", |
179 |
|
nrays, pctdone, (tlastrept-tstart)/3600.0); |
180 |
|
eputs(errmsg); |
176 |
– |
signal(SIGCONT, report); |
181 |
|
} |
182 |
|
#endif |
183 |
|
|