ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rholo4.c
(Generate patch)

Comparing ray/src/hd/rholo4.c (file contents):
Revision 3.2 by gregl, Mon Nov 3 18:33:14 1997 UTC vs.
Revision 3.3 by gregl, Tue Nov 4 09:58:24 1997 UTC

# Line 46 | Line 46 | char   *dname;
46   disp_packet(p)                  /* display a packet */
47   register PACKET *p;
48   {
49        if (pipesiz <= 0)
50                return;
49          disp_result(DS_BUNDLE, sizeof(PACKHEAD) + p->nr*sizeof(RAYVAL),
50                          (char *)p);
51   }
# Line 62 | Line 60 | int    block;
60  
61          if (pipesiz <= 0)
62                  return(-1);
63 < restart:                                /* check read blocking */
63 >                                        /* check read blocking */
64          if (block != (inp_flags == 0)) {
65                  inp_flags = block ? 0 : FNONBLK;
66                  if (fcntl(dpd[0], F_SETFL, inp_flags) < 0)
# Line 75 | Line 73 | restart:                               /* check read blocking */
73                          error(USER, "display process died");
74                  if (errno != EAGAIN & errno != EINTR)
75                          goto readerr;
76 <                return(2);              /* else acceptable failure */
76 >                return(2);              /* acceptable failure */
77          }
78          if (msg.nbytes) {               /* get the message body */
79                  buf = (char *)malloc(msg.nbytes);
# Line 116 | Line 114 | restart:                               /* check read blocking */
114                          error(INTERNAL, "bad DR_ATTEN from display process");
115                                          /* send acknowledgement */
116                  disp_result(DS_ACKNOW, 0, NULL);
117 <                block = 1;              /* block on following request */
120 <                goto restart;
117 >                return(disp_check(1));  /* block on following request */
118          case DR_SHUTDOWN:
119                  if (msg.nbytes)
120                          error(INTERNAL, "bad DR_SHUTDOWN from display process");
# Line 125 | Line 122 | restart:                               /* check read blocking */
122          default:
123                  error(INTERNAL, "unrecognized request from display process");
124          }
125 <        if (msg.nbytes)
125 >        if (msg.nbytes)                 /* clean up */
126                  free(buf);
127          return(1);                      /* normal return value */
128   fcntlerr:
# Line 156 | Line 153 | char   *p;
153          MSGHEAD msg;
154          int     n;
155  
156 +        if (pipesiz <= 0)
157 +                return;
158          msg.type = type;
159          msg.nbytes = nbytes;
160          if (nbytes == 0 || sizeof(MSGHEAD)+nbytes > pipesiz) {
161 <                n = write(dpd[1], (char *)&msg, sizeof(MSGHEAD));
161 >                do
162 >                        n = write(dpd[1], (char *)&msg, sizeof(MSGHEAD));
163 >                while (n < 0 && errno == EINTR);
164                  if (n != sizeof(MSGHEAD))
165                          goto writerr;
166                  if (nbytes > 0) {
# Line 173 | Line 174 | char   *p;
174          iov[0].iov_len = sizeof(MSGHEAD);
175          iov[1].iov_base = p;
176          iov[1].iov_len = nbytes;
177 <        n = writev(dpd[1], iov, 2);
178 <        if (n == nbytes+sizeof(MSGHEAD))
177 >        do
178 >                n = writev(dpd[1], iov, 2);
179 >        while (n < 0 && errno == EINTR);
180 >        if (n == sizeof(MSGHEAD)+nbytes)
181                  return;
182   writerr:
183          error(SYSTEM, "write error in disp_result");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines