You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/08/09 19:58:14 UTC

cvs commit: apache-apr/include apr_errno.h apr_network_io.h

rbb         99/08/09 10:58:12

  Modified:    apr/network_io/unix poll.c
               include  apr_errno.h apr_network_io.h
  Log:
  Adding some new functions for poll.  Will test them as soon as I fix Windows
  and ab_apr.
  Adding CVS:
  
  Revision  Changes    Path
  1.16      +72 -0     apache-apr/apr/network_io/unix/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/unix/poll.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- poll.c	1999/07/29 19:23:25	1.15
  +++ poll.c	1999/08/09 17:57:53	1.16
  @@ -218,6 +218,51 @@
       return APR_SUCCESS;
   }
   
  +/* ***APRDOC********************************************************
  + * ap_status_t ap_remove_poll_socket(ap_pollfd_t *, ap_socket_t *, ap_int16_t)
  + *    Add a socket to the poll structure. 
  + * arg 1) The poll structure we will be using. 
  + * arg 2) The socket to remove from the current poll structure. 
  + * arg 3) The events to stop looking for during the poll.  One of:
  + *            APR_POLLIN    -- signal if read will not block
  + *            APR_POLLPRI   -- signal if prioirty data is availble to be read
  + *            APR_POLLOUT   -- signal if write will not block
  + */
  +ap_status_t ap_remove_poll_socket(struct pollfd_t *aprset, 
  +                                  struct socket_t *sock, ap_int16_t events)
  +{
  +    ap_int16_t newevents;
  +    int i = 0;
  +    
  +    while (i < aprset->curpos && aprset[i].sock->socketdes != sock->socketdes) {
  +        i++;
  +    }
  +    if (i >= aprset->curpos) {
  +        return APR_NOTFOUND;
  +    } 
  +    aprset[i].sock = sock;
  +    newevents = get_event(events);
  +    if (aprset[i].events & newevents) {
  +        aprset[i].events ^= newevents;
  +    }
  +
  +    return APR_SUCCESS;
  +}
  +
  +/* ***APRDOC********************************************************
  + * ap_status_t ap_clear_poll_socket(ap_pollfd_t *)
  + *    Remove all sockets from the poll structure. 
  + * arg 1) The poll structure we will be using. 
  + * arg 2) The socket to add to the current poll structure. 
  + * arg 3) The events to look for when we do the poll.  One of:
  + *            APR_POLLIN    -- signal if read will not block
  + *            APR_POLLPRI   -- signal if prioirty data is availble to be read
  + *            APR_POLLOUT   -- signal if write will not block
  + */
  +ap_status_t ap_clear_poll_sockets(struct pollfd_t *aprset)
  +{
  +    aprset->curpos = 0; 
  +}
   #else    /* Use select to mimic poll */
   
   ap_status_t ap_setup_poll(ap_context_t *cont, ap_int32_t num, struct pollfd_t **
  @@ -330,6 +375,33 @@
       }
   
       (*event) = revents;
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_remove_poll_socket(struct pollfd_t *aprset, 
  +                                  struct socket_t *sock, ap_int16_t events)
  +{
  +    if (event & APR_POLLIN) {
  +        FD_CLR(sock->socketdes, aprset->read);
  +    }
  +    if (event & APR_POLLPRI) {
  +        FD_CLR(sock->socketdes, aprset->read);
  +    }
  +    if (event & APR_POLLOUT) {
  +        FD_CLR(sock->socketdes, aprset->write);
  +    }
  +    if (sock->socketdes > aprset->highsock) {
  +        aprset->highsock = sock->socketdes;
  +    }
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_clear_poll_sockets(struct pollfd_t *aprset)
  +{
  +    FD_ZERO(aprset->read);
  +    FD_ZERO(aprset->read);
  +    FD_ZERO(aprset->write);
  +    aprset->highsock = 0;
       return APR_SUCCESS;
   }
   
  
  
  
  1.22      +1 -1      apache-apr/include/apr_errno.h
  
  Index: apr_errno.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_errno.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- apr_errno.h	1999/07/27 17:58:37	1.21
  +++ apr_errno.h	1999/08/09 17:58:00	1.22
  @@ -412,7 +412,7 @@
   #define APR_BADCH          5012
   #define APR_BADARG         5013
   #define APR_EOF            5014
  -
  +#define APR_NOTFOUND       5015
   #ifdef __cplusplus
   }
   #endif
  
  
  
  1.26      +2 -0      apache-apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- apr_network_io.h	1999/06/22 16:57:38	1.25
  +++ apr_network_io.h	1999/08/09 17:58:02	1.26
  @@ -121,6 +121,8 @@
   ap_status_t ap_setup_poll(ap_context_t *, ap_int32_t, ap_pollfd_t **);
   ap_status_t ap_poll(ap_pollfd_t *, ap_int32_t *, ap_int32_t);
   ap_status_t ap_add_poll_socket(ap_pollfd_t *, ap_socket_t *, ap_int16_t);
  +ap_status_t ap_remove_poll_socket(ap_pollfd_t *, ap_socket_t *, ap_int16_t);
  +ap_status_t ap_clear_poll_sockets(ap_pollfd_t *);
   ap_status_t ap_get_revents(ap_pollfd_t *, ap_socket_t *, ap_int16_t *);
   ap_status_t ap_get_polldata(ap_pollfd_t *, void *);
   ap_status_t ap_set_polldata(ap_pollfd_t *, void *);