bjh         99/10/29 08:06:23

  Modified:    src/os/os2 iol_socket.c
  Log:
  Some cleaning up of OS/2 iol_socket.c.
  
  Revision  Changes    Path
  1.5       +2 -81     apache-2.0/src/os/os2/iol_socket.c
  
  Index: iol_socket.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/os/os2/iol_socket.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- iol_socket.c      1999/10/29 14:37:28     1.4
  +++ iol_socket.c      1999/10/29 15:06:22     1.5
  @@ -97,96 +97,17 @@
       return APR_SUCCESS;
   }
   
  -/* the timeout code is a separate routine because it requires
  -    a stack frame... and we don't want to pay that setup cost
  -    on every call */
  -
  -/* this macro expands into the four basic i/o methods */
  -
  -#define method(name, args, syscall, selread, selwrite)       \
  -    static ap_status_t os2_##name##_timeout args \
  -    { \
  -     iol_socket *iol = (iol_socket *)viol; \
  -     fd_set fdset; \
  -     struct timeval tv; \
  -     int rv; \
  - \
  -     FD_ZERO(&fdset); \
  -     FD_SET(iol->fd, &fdset); \
  -     tv.tv_sec = iol->timeout; \
  -     tv.tv_usec = 0; \
  -     do { \
  -         rv = ap_select(iol->fd + 1, selread, selwrite, NULL, iol->timeout < 
0 ? NULL : &tv); \
  -     } while (rv == -1 && errno == EINTR); \
  -     if (!FD_ISSET(iol->fd, &fdset)) { \
  -            *nbytes = 0; \
  -         return APR_ETIMEDOUT; \
  -     } \
  -     do { \
  -         rv = syscall(iol->fd, arg1, arg2); \
  -     } while (rv == -1 && errno == EINTR); \
  -        if (rv >= 0) { \
  -            *nbytes = rv; \
  -            return APR_SUCCESS; \
  -        } \
  -        *nbytes = 0; \
  -     return errno; \
  -     \
  -    } \
  - \
  -    static ap_status_t os2_##name args \
  -    { \
  -     iol_socket *iol = (iol_socket *)viol; \
  -     int rv; \
  - \
  -        /* Preset to zero until some bytes are actually written */ \
  -        *nbytes = 0; \
  -     if (!(iol->flags & FD_NONBLOCKING_SET)) { \
  -         if (iol->timeout < 0) { \
  -             rv = syscall(iol->fd, arg1, arg2); \
  -                if (rv >= 0) { \
  -                    *nbytes = rv; \
  -                    return APR_SUCCESS; \
  -                } \
  -                return errno; \
  -         } \
  -         /* must shift descriptor to blocking mode now */ \
  -         if ((rv = set_nonblock(iol->fd)) != APR_SUCCESS) { \
  -             return rv; \
  -         } \
  -         iol->flags |= FD_NONBLOCKING_SET; \
  -     } \
  - \
  -     /* try writing, ignoring EINTR, the upper layer has to handle \
  -         partial read/writes anyhow, so we can return early */ \
  -     do { \
  -         rv = syscall(iol->fd, arg1, arg2); \
  -     } while (rv == -1 && errno == EINTR); \
  -     if (rv >= 0) { \
  -         *nbytes = rv; \
  -            return APR_SUCCESS; \
  -     } \
  -     if ((errno == EWOULDBLOCK || errno == EAGAIN) && iol->timeout != 0) { \
  -         return os2_##name##_timeout(viol, arg1, arg2, nbytes); \
  -     } \
  -     return errno; \
  -    }
  -
  -// method(write, (ap_iol *viol, const char *arg1, ap_size_t arg2, ap_ssize_t 
*nbytes), write, NULL, &fdset)
   ap_status_t os2_write(ap_iol *viol, const char *buf, ap_size_t size, 
ap_ssize_t *nbytes)
   {
       *nbytes = size;
       return ap_send(((iol_socket *)viol)->sock, buf, nbytes);
   }
   
  -// method(writev, (ap_iol *viol, const struct iovec *arg1, int arg2, 
ap_ssize_t *nbytes), writev, NULL, &fdset)
  -ap_status_t os2_writev(ap_iol *viol, const struct iovec *vec, int size, 
ap_ssize_t *nbytes)
  +ap_status_t os2_writev(ap_iol *viol, const struct iovec *vec, int nvec, 
ap_ssize_t *nbytes)
   {
  -    *nbytes = size;
  -    return ap_sendv(((iol_socket *)viol)->sock, vec, size, nbytes);
  +    return ap_sendv(((iol_socket *)viol)->sock, vec, nvec, nbytes);
   }
   
  -// method(read, (ap_iol *viol, char *arg1, ap_size_t arg2, ap_ssize_t 
*nbytes), read, &fdset, NULL)
   ap_status_t os2_read(ap_iol *viol, char *buf, ap_size_t size, ap_ssize_t 
*nbytes)
   {
       *nbytes = size;
  
  
  

Reply via email to