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.4 by gregl, Thu Nov 6 16:12:41 1997 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines