| 224 |
|
ray_pnidle--; /* now she's busy */ |
| 225 |
|
} |
| 226 |
|
if (sfirst != r_send_next) |
| 227 |
< |
error(CONSISTENCY, "code screwup in ray_pflush"); |
| 227 |
> |
error(CONSISTENCY, "code screwup in ray_pflush()"); |
| 228 |
|
r_send_next = 0; |
| 229 |
|
return(sfirst); /* return total # sent */ |
| 230 |
|
} |
| 239 |
|
return; |
| 240 |
|
/* flush output if necessary */ |
| 241 |
|
if (sendq_full() && ray_pflush() <= 0) |
| 242 |
< |
error(INTERNAL, "ray_pflush failed in ray_psend"); |
| 242 |
> |
error(INTERNAL, "ray_pflush failed in ray_psend()"); |
| 243 |
|
|
| 244 |
|
r_queue[r_send_next++] = *r; |
| 245 |
|
} |
| 329 |
|
poll ? &tpoll : (struct timeval *)NULL)) < 0) |
| 330 |
|
if (errno != EINTR) { |
| 331 |
|
error(WARNING, |
| 332 |
< |
"select call failed in ray_presult"); |
| 332 |
> |
"select call failed in ray_presult()"); |
| 333 |
|
ray_pclose(0); |
| 334 |
|
return(-1); |
| 335 |
|
} |
| 408 |
|
/* get smuggled set length */ |
| 409 |
|
n2 = sizeof(RAY)*r_queue[0].crtype - n; |
| 410 |
|
if (n2 < 0) |
| 411 |
< |
error(INTERNAL, "buffer over-read in ray_pchild"); |
| 411 |
> |
error(INTERNAL, "buffer over-read in ray_pchild()"); |
| 412 |
|
if (n2 > 0) { /* read the rest of the set */ |
| 413 |
|
i = readbuf(fd_in, (char *)r_queue + n, n2); |
| 414 |
|
if (i != n2) |
| 430 |
|
/* write back our results */ |
| 431 |
|
i = writebuf(fd_out, (char *)r_queue, sizeof(RAY)*n); |
| 432 |
|
if (i != sizeof(RAY)*n) |
| 433 |
< |
error(SYSTEM, "write error in ray_pchild"); |
| 433 |
> |
error(SYSTEM, "write error in ray_pchild()"); |
| 434 |
|
} |
| 435 |
|
if (n) |
| 436 |
< |
error(SYSTEM, "read error in ray_pchild"); |
| 436 |
> |
error(SYSTEM, "read error in ray_pchild()"); |
| 437 |
|
ambsync(); |
| 438 |
|
quit(0); /* normal exit */ |
| 439 |
|
} |
| 468 |
|
close(r_proc[pn].fd_recv); |
| 469 |
|
} |
| 470 |
|
close(p0[0]); close(p1[1]); |
| 471 |
+ |
close(0); /* don't share stdin */ |
| 472 |
|
/* following call never returns */ |
| 473 |
|
ray_pchild(p1[0], p0[1]); |
| 474 |
|
} |
| 513 |
|
while (nsub--) { |
| 514 |
|
int status; |
| 515 |
|
ray_pnprocs--; |
| 515 |
– |
close(r_proc[ray_pnprocs].fd_recv); |
| 516 |
|
close(r_proc[ray_pnprocs].fd_send); |
| 517 |
|
if (waitpid(r_proc[ray_pnprocs].pid, &status, 0) < 0) |
| 518 |
|
status = 127<<8; |
| 519 |
+ |
close(r_proc[ray_pnprocs].fd_recv); |
| 520 |
|
if (status) { |
| 521 |
|
sprintf(errmsg, |
| 522 |
|
"rendering process %d exited with code %d", |