| 5 |
|
* Radiance holodeck generation controller |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
– |
#include "rholo.h" |
| 9 |
– |
#include "random.h" |
| 8 |
|
#include <signal.h> |
| 9 |
|
#include <sys/stat.h> |
| 10 |
+ |
#include <string.h> |
| 11 |
|
|
| 12 |
+ |
#include "rholo.h" |
| 13 |
+ |
#include "random.h" |
| 14 |
+ |
|
| 15 |
|
#ifndef FRAGWARN |
| 16 |
|
#define FRAGWARN 20 /* fragmentation for warning (%) */ |
| 17 |
|
#endif |
| 47 |
|
time_t endtime; /* time we should end by */ |
| 48 |
|
time_t reporttime; /* time for next report */ |
| 49 |
|
|
| 50 |
< |
long maxdisk; /* maximum file space (bytes) */ |
| 50 |
> |
off_t maxdisk; /* maximum file space (bytes) */ |
| 51 |
|
|
| 52 |
|
int rtargc = 1; /* rtrace command */ |
| 53 |
|
char *rtargv[128] = {"rtrace", NULL}; |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
|
| 157 |
+ |
void |
| 158 |
|
onsig(signo) /* fatal signal */ |
| 159 |
|
int signo; |
| 160 |
|
{ |
| 217 |
|
init_global(); |
| 218 |
|
/* record disk space limit */ |
| 219 |
|
if (!vdef(DISKSPACE)) |
| 220 |
< |
maxdisk = (1L<<(sizeof(long)*8-2)) - 1024; |
| 220 |
> |
maxdisk = ((off_t)1<<(sizeof(off_t)*8-2)) - 1024; |
| 221 |
|
else |
| 222 |
|
maxdisk = 1024.*1024.*vflt(DISKSPACE); |
| 223 |
|
/* set up memory cache */ |
| 290 |
|
static long nextfragwarn = 100*(1L<<20); |
| 291 |
|
static int idle = 0; |
| 292 |
|
PACKET *pl = NULL, *plend; |
| 293 |
< |
long fsiz; |
| 293 |
> |
off_t fsiz; |
| 294 |
|
int pksiz; |
| 295 |
|
register PACKET *p; |
| 296 |
|
time_t t; |
| 415 |
|
HDGRID *gp; |
| 416 |
|
{ |
| 417 |
|
extern char VersionID[]; |
| 418 |
< |
int4 lastloc, nextloc; |
| 418 |
> |
int32 lastloc, nextloc; |
| 419 |
|
int n; |
| 420 |
|
int fd; |
| 421 |
|
FILE *fp; |
| 433 |
|
putw(HOLOMAGIC, fp); /* put magic number */ |
| 434 |
|
fd = dup(fileno(fp)); |
| 435 |
|
fclose(fp); /* flush and close stdio stream */ |
| 436 |
< |
lastloc = lseek(fd, (off_t)0L, 2); |
| 436 |
> |
lastloc = lseek(fd, (off_t)0, 2); |
| 437 |
|
for (n = vdef(SECTION); n--; gp++) { /* initialize each section */ |
| 438 |
|
nextloc = 0L; |
| 439 |
|
write(fd, (char *)&nextloc, sizeof(nextloc)); |
| 478 |
|
|
| 479 |
|
loadholo() /* start loading a holodeck from fname */ |
| 480 |
|
{ |
| 478 |
– |
extern long ftell(); |
| 481 |
|
FILE *fp; |
| 482 |
|
int fd; |
| 483 |
|
int n; |
| 484 |
< |
int4 nextloc; |
| 484 |
> |
int32 nextloc; |
| 485 |
|
|
| 486 |
|
if (ncprocs > 0 & force >= 0) |
| 487 |
|
fp = fopen(hdkfile, "r+"); |
| 533 |
|
while (pl != NULL) { |
| 534 |
|
p = pl; pl = p->next; p->next = NULL; |
| 535 |
|
if (p->nr > 0) { /* add to holodeck */ |
| 536 |
< |
bcopy((void *)p->ra, |
| 537 |
< |
(void *)hdnewrays(hdlist[p->hd],p->bi,p->nr), |
| 536 |
> |
memcpy( (void *)hdnewrays(hdlist[p->hd],p->bi,p->nr), |
| 537 |
> |
(void *)p->ra, |
| 538 |
|
p->nr*sizeof(RAYVAL)); |
| 539 |
|
if (outdev != NULL) /* display it */ |
| 540 |
|
disp_packet((PACKHEAD *)p); |
| 610 |
|
if (nprocs > 0) |
| 611 |
|
status = done_rtrace(); /* calls hdsync() */ |
| 612 |
|
if (ncprocs > 0 & force >= 0 && vdef(REPORT)) { |
| 613 |
< |
long fsiz, fuse; |
| 613 |
> |
off_t fsiz, fuse; |
| 614 |
|
fsiz = hdfilen(hdlist[0]->fd); |
| 615 |
|
fuse = hdfiluse(hdlist[0]->fd, 1); |
| 616 |
|
fprintf(stderr, |