apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Nicholes" <BNICHO...@novell.com>
Subject Re: cvs commit: apr/poll/unix poll.c pollacc.c
Date Tue, 18 Nov 2003 17:24:14 GMT
  The deprecated apr_poll  APIs are still being referenced in several
places within Apache (ie. mod_ext_filter.c, proxy_connect.c, several
mpm's, etc.)  Are these references being cleaned up or is that work to
be done?  Currently the 2.1 HEAD does not build.

Brad

Brad Nicholes
Senior Software Engineer
Novell, Inc., the leading provider of Net business solutions
http://www.novell.com 

>>> gstein@apache.org Sunday, November 16, 2003 5:32:36 PM >>>
gstein      2003/11/16 16:32:36

  Modified:    include  apr_poll.h
               poll/os2 Makefile.in
               poll/unix poll.c pollacc.c
  Removed:     poll/os2 poll.c
  Log:
  Remove the old/deprecated apr_poll interface.
  
  * include/apr_poll.h:
    (apr_poll, apr_poll_setup, apr_poll_socket_add,
apr_poll_socket_mask,
        apr_poll_socket_remove, apr_poll_socket_clear,
        apr_poll_revents_get): removed. these were deprecated a while
back,
      in favor of the apr_pollset_t interfaces.
  
  * poll/os2/poll.c: removed. this implemented apr_poll() which was
      deprecated by the new apr_pollset_t interfaces.
  
  * poll/os/Makefile.in: remove reference to poll.lo
  
  * poll/unix/poll.c:
    - remove include of alloca.h; no longer needed
    (apr_poll): removed both implementations
  
  * poll/unix/pollacc.c:
    (apr_poll_setup, apr_poll_socket_add, apr_poll_socket_mask,
        apr_poll_socket_remove, apr_poll_socket_clear,
        apr_poll_revents_get): removed these deprecated functions.
  
  Revision  Changes    Path
  1.12      +0 -46     apr/include/apr_poll.h
  
  Index: apr_poll.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_poll.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apr_poll.h	28 Oct 2003 11:11:08 -0000	1.11
  +++ apr_poll.h	17 Nov 2003 00:32:36 -0000	1.12
  @@ -119,29 +119,6 @@
   };
   
   
  -/**
  - * Poll the sockets in the poll structure
  - * @param aprset The poll structure we will be using. 
  - * @param numsock The number of sockets we are polling
  - * @param nsds The number of sockets signalled.
  - * @param timeout The amount of time in microseconds to wait.  This
is 
  - *                a maximum, not a minimum.  If a socket is
signalled, we 
  - *                will wake up before this time.  A negative number
means 
  - *                wait until a socket is signalled.
  - * @remark
  - * <PRE>
  - * The number of sockets signalled is returned in the second
argument. 
  - *
  - *        This is a blocking call, and it will not return until
either a 
  - *        socket has been signalled, or the timeout has expired. 
  - * </PRE>
  - */
  -/* ### is this deprecated, too? */
  -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t
numsock,
  -                                   apr_int32_t *nsds, 
  -                                   apr_interval_time_t timeout);
  -
  -
   /* General-purpose poll API for arbitrarily large numbers of
    * file descriptors
    */
  @@ -200,29 +177,6 @@
                                              const apr_pollfd_t
**descriptors);
   
   /** @} */
  -
  -
  -/* These functions are deprecated. If you want doc, then go to
older
  -   versions of this header file.
  -
  -   ### should probably just be removed.
  -*/
  -APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new_poll, 
  -                                         apr_int32_t num,
  -                                         apr_pool_t *cont);
  -APR_DECLARE(apr_status_t) apr_poll_socket_add(apr_pollfd_t *aprset,

  -                                              apr_socket_t *sock,
  -                                              apr_int16_t event);
  -APR_DECLARE(apr_status_t) apr_poll_socket_mask(apr_pollfd_t
*aprset,
  -                                               apr_socket_t *sock,
  -                                               apr_int16_t events);
  -APR_DECLARE(apr_status_t) apr_poll_socket_remove(apr_pollfd_t
*aprset, 
  -                                                 apr_socket_t
*sock);
  -APR_DECLARE(apr_status_t) apr_poll_socket_clear(apr_pollfd_t
*aprset, 
  -                                                 apr_int16_t
events);
  -APR_DECLARE(apr_status_t) apr_poll_revents_get(apr_int16_t *event, 
  -                                          apr_socket_t *sock,
  -                                          apr_pollfd_t *aprset);
   
   
   #ifdef __cplusplus
  
  
  
  1.4       +0 -1      apr/poll/os2/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/poll/os2/Makefile.in,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile.in	9 Aug 2002 09:11:52 -0000	1.3
  +++ Makefile.in	17 Nov 2003 00:32:36 -0000	1.4
  @@ -2,7 +2,6 @@
   VPATH = @srcdir@
   
   TARGETS = \
  -	poll.lo \
   	pollset.lo \
   	pollacc.lo
   
  
  
  
  1.40      +3 -204    apr/poll/unix/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/apr/poll/unix/poll.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- poll.c	28 Oct 2003 11:31:34 -0000	1.39
  +++ poll.c	17 Nov 2003 00:32:36 -0000	1.40
  @@ -64,15 +64,14 @@
   #if HAVE_SYS_POLL_H
   #include <sys/poll.h>
   #endif
  -#if HAVE_ALLOCA_H
  -#include <alloca.h>
  -#endif
  +
   
   #ifdef NETWARE
   #define HAS_SOCKETS(dt) (dt == APR_POLL_SOCKET) ? 1 : 0
   #define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
   #endif
   
  +
   #ifdef HAVE_POLL    /* We can just use poll to do our socket
polling. */
   
   static apr_int16_t get_event(apr_int16_t event)
  @@ -115,207 +114,7 @@
       return rv;
   }        
   
  -#define SMALL_POLLSET_LIMIT  8
  -
  -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t
num,
  -                      apr_int32_t *nsds, apr_interval_time_t
timeout)
  -{
  -    int i, num_to_poll;
  -#ifdef HAVE_VLA
  -    /* XXX: I trust that this is a segv when insufficient stack
exists? */
  -    struct pollfd pollset[num];
  -#elif defined(HAVE_ALLOCA)
  -    struct pollfd *pollset = alloca(sizeof(struct pollfd) * num);
  -    if (!pollset)
  -        return APR_ENOMEM;
  -#else
  -    struct pollfd tmp_pollset[SMALL_POLLSET_LIMIT];
  -    struct pollfd *pollset;
  -
  -    if (num <= SMALL_POLLSET_LIMIT) {
  -        pollset = tmp_pollset;
  -    }
  -    else {
  -        /* This does require O(n) to copy the descriptors to the
internal
  -         * mapping.
  -         */
  -        pollset = malloc(sizeof(struct pollfd) * num);
  -        /* The other option is adding an apr_pool_abort() fn to
invoke
  -         * the pool's out of memory handler
  -         */
  -        if (!pollset)
  -            return APR_ENOMEM;
  -    }
  -#endif
  -    for (i = 0; i < num; i++) {
  -        if (aprset[i].desc_type == APR_POLL_SOCKET) {
  -            pollset[i].fd = aprset[i].desc.s->socketdes;
  -        }
  -        else if (aprset[i].desc_type == APR_POLL_FILE) {
  -            pollset[i].fd = aprset[i].desc.f->filedes;
  -        }
  -        else {
  -            break;
  -        }
  -        pollset[i].events = get_event(aprset[i].reqevents);
  -    }
  -    num_to_poll = i;
  -
  -    if (timeout > 0) {
  -        timeout /= 1000; /* convert microseconds to milliseconds */
  -    }
  -
  -    i = poll(pollset, num_to_poll, timeout);
  -    (*nsds) = i;
  -
  -    for (i = 0; i < num; i++) {
  -        aprset[i].rtnevents = get_revent(pollset[i].revents);
  -    }
  -    
  -#if !defined(HAVE_VLA) && !defined(HAVE_ALLOCA)
  -    if (num > SMALL_POLLSET_LIMIT) {
  -        free(pollset);
  -    }
  -#endif
  -
  -    if ((*nsds) < 0) {
  -        return apr_get_netos_error();
  -    }
  -    if ((*nsds) == 0) {
  -        return APR_TIMEUP;
  -    }
  -    return APR_SUCCESS;
  -}
  -
  -
  -#else    /* Use select to mimic poll */
  -
  -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num,
apr_int32_t *nsds, 
  -		    apr_interval_time_t timeout)
  -{
  -    fd_set readset, writeset, exceptset;
  -    int rv, i;
  -    int maxfd = -1;
  -    struct timeval tv, *tvptr;
  -#ifdef NETWARE
  -    apr_datatype_e set_type = APR_NO_DESC;
  -#endif
  -
  -    if (timeout < 0) {
  -        tvptr = NULL;
  -    }
  -    else {
  -        tv.tv_sec = (long)apr_time_sec(timeout);
  -        tv.tv_usec = (long)apr_time_usec(timeout);
  -        tvptr = &tv;
  -    }
  -
  -    FD_ZERO(&readset);
  -    FD_ZERO(&writeset);
  -    FD_ZERO(&exceptset);
  -
  -    for (i = 0; i < num; i++) {
  -        apr_os_sock_t fd;
  -
  -        aprset[i].rtnevents = 0;
  -
  -        if (aprset[i].desc_type == APR_POLL_SOCKET) {
  -#ifdef NETWARE
  -            if (HAS_PIPES(set_type)) {
  -                return APR_EBADF;
  -            }
  -            else {
  -                set_type = APR_POLL_SOCKET;
  -            }
  -#endif
  -            fd = aprset[i].desc.s->socketdes;
  -        }
  -        else if (aprset[i].desc_type == APR_POLL_FILE) {
  -#if !APR_FILES_AS_SOCKETS
  -            return APR_EBADF;
  -#else
  -#ifdef NETWARE
  -            if (aprset[i].desc.f->is_pipe && !HAS_SOCKETS(set_type))
{
  -                set_type = APR_POLL_FILE;
  -            }
  -            else
  -                return APR_EBADF;
  -#endif /* NETWARE */
  -
  -            fd = aprset[i].desc.f->filedes;
  -
  -#endif /* APR_FILES_AS_SOCKETS */
  -        }
  -        else {
  -            break;
  -        }
  -        if (aprset[i].reqevents & APR_POLLIN) {
  -            FD_SET(fd, &readset);
  -        }
  -        if (aprset[i].reqevents & APR_POLLOUT) {
  -            FD_SET(fd, &writeset);
  -        }
  -        if (aprset[i].reqevents & 
  -            (APR_POLLPRI | APR_POLLERR | APR_POLLHUP |
APR_POLLNVAL)) {
  -            FD_SET(fd, &exceptset);
  -        }
  -        if ((int)fd > maxfd) {
  -            maxfd = (int)fd;
  -        }
  -    }
  -
  -#ifdef NETWARE
  -    if (HAS_PIPES(set_type)) {
  -        rv = pipe_select(maxfd + 1, &readset, &writeset, &exceptset,
tvptr);
  -    }
  -    else {
  -#endif
  -
  -    rv = select(maxfd + 1, &readset, &writeset, &exceptset, tvptr);
  -
  -#ifdef NETWARE
  -    }
  -#endif
  -
  -    (*nsds) = rv;
  -    if ((*nsds) == 0) {
  -        return APR_TIMEUP;
  -    }
  -    if ((*nsds) < 0) {
  -        return apr_get_netos_error();
  -    }
  -
  -    for (i = 0; i < num; i++) {
  -        apr_os_sock_t fd;
  -
  -        if (aprset[i].desc_type == APR_POLL_SOCKET) {
  -            fd = aprset[i].desc.s->socketdes;
  -        }
  -        else if (aprset[i].desc_type == APR_POLL_FILE) {
  -#if !APR_FILES_AS_SOCKETS
  -            return APR_EBADF;
  -#else
  -            fd = aprset[i].desc.f->filedes;
  -#endif
  -        }
  -        else {
  -            break;
  -        }
  -        if (FD_ISSET(fd, &readset)) {
  -            aprset[i].rtnevents |= APR_POLLIN;
  -        }
  -        if (FD_ISSET(fd, &writeset)) {
  -            aprset[i].rtnevents |= APR_POLLOUT;
  -        }
  -        if (FD_ISSET(fd, &exceptset)) {
  -            aprset[i].rtnevents |= APR_POLLERR;
  -        }
  -    }
  -
  -    return APR_SUCCESS;
  -}
  -
  -#endif 
  +#endif /* HAVE_POLL */
   
   
   struct apr_pollset_t {
  
  
  
  1.9       +2 -118    apr/poll/unix/pollacc.c
  
  Index: pollacc.c
  ===================================================================
  RCS file: /home/cvs/apr/poll/unix/pollacc.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- pollacc.c	7 Jan 2003 00:52:56 -0000	1.8
  +++ pollacc.c	17 Nov 2003 00:32:36 -0000	1.9
  @@ -53,133 +53,17 @@
    */
   
   #include "apr.h"
  -#include "apr_poll.h"
   #include "apr_arch_networkio.h"
   #include "apr_arch_file_io.h"
  -#if HAVE_POLL_H
  -#include <poll.h>
  -#endif
  -#if HAVE_SYS_POLL_H
  -#include <sys/poll.h>
  -#endif
   
  -APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new,
apr_int32_t num, apr_pool_t *cont)
  -{
  -    (*new) = (apr_pollfd_t *)apr_pcalloc(cont, sizeof(apr_pollfd_t)
* (num + 1));
  -    if ((*new) == NULL) {
  -        return APR_ENOMEM;
  -    }
  -    (*new)[num].desc_type = APR_POLL_LASTDESC;
  -    (*new)[0].p = cont;
  -    return APR_SUCCESS;
  -}
  -
  -static apr_pollfd_t *find_poll_sock(apr_pollfd_t *aprset,
apr_socket_t *sock)
  -{
  -    apr_pollfd_t *curr = aprset;
  -    
  -    while (curr->desc.s != sock) {
  -        if (curr->desc_type == APR_POLL_LASTDESC) {
  -            return NULL;
  -        }
  -        curr++;
  -    }
  -
  -    return curr;
  -}
  -
  -APR_DECLARE(apr_status_t) apr_poll_socket_add(apr_pollfd_t *aprset,

  -			       apr_socket_t *sock, apr_int16_t event)
  -{
  -    apr_pollfd_t *curr = aprset;
  -    
  -    while (curr->desc_type != APR_NO_DESC) {
  -        if (curr->desc_type == APR_POLL_LASTDESC) {
  -            return APR_ENOMEM;
  -        }
  -        curr++;
  -    }
  -    curr->desc.s = sock;
  -    curr->desc_type = APR_POLL_SOCKET;
  -    curr->reqevents = event;
  -
  -    return APR_SUCCESS;
  -}
  -
  -APR_DECLARE(apr_status_t) apr_poll_revents_get(apr_int16_t *event,
apr_socket_t *sock, apr_pollfd_t *aprset)
  -{
  -    apr_pollfd_t *curr = find_poll_sock(aprset, sock);
  -    if (curr == NULL) {
  -        return APR_NOTFOUND;
  -    }
  -
  -    (*event) = curr->rtnevents;
  -    return APR_SUCCESS;
  -}
  -
  -APR_DECLARE(apr_status_t) apr_poll_socket_mask(apr_pollfd_t *aprset,

  -                                  apr_socket_t *sock, apr_int16_t
events)
  -{
  -    apr_pollfd_t *curr = find_poll_sock(aprset, sock);
  -    if (curr == NULL) {
  -        return APR_NOTFOUND;
  -    }
  -    
  -    if (curr->reqevents & events) {
  -        curr->reqevents ^= events;
  -    }
  -
  -    return APR_SUCCESS;
  -}
  -
  -APR_DECLARE(apr_status_t) apr_poll_socket_remove(apr_pollfd_t
*aprset, apr_socket_t *sock)
  -{
  -    apr_pollfd_t *match = NULL;
  -    apr_pollfd_t *curr;
  -
  -    for (curr = aprset; (curr->desc_type != APR_POLL_LASTDESC) &&
  -             (curr->desc_type != APR_NO_DESC); curr++) {
  -        if (curr->desc.s == sock) {
  -            match = curr;
  -        }
  -    }
  -    if (match == NULL) {
  -        return APR_NOTFOUND;
  -    }
  -
  -    /* Remove this entry by swapping the last entry into its place.
  -     * This ensures that the non-APR_NO_DESC entries are all at the
  -     * start of the array, so that apr_poll() doesn't have to worry
  -     * about invalid entries in the middle of the pollset.
  -     */
  -    curr--;
  -    if (curr != match) {
  -        *match = *curr;
  -    }
  -    curr->desc_type = APR_NO_DESC;
  -
  -    return APR_SUCCESS;
  -}
  -
  -APR_DECLARE(apr_status_t) apr_poll_socket_clear(apr_pollfd_t
*aprset, apr_int16_t events)
  -{
  -    apr_pollfd_t *curr = aprset;
  -
  -    while (curr->desc_type != APR_POLL_LASTDESC) {
  -        if (curr->reqevents & events) {
  -            curr->reqevents &= ~events;
  -        }
  -        curr++;
  -    }
  -    return APR_SUCCESS;
  -}
   
   #if APR_FILES_AS_SOCKETS
   /* I'm not sure if this needs to return an apr_status_t or not, but
    * for right now, we'll leave it this way, and change it later if
    * necessary.
    */
  -APR_DECLARE(apr_status_t) apr_socket_from_file(apr_socket_t
**newsock, apr_file_t *file)
  +APR_DECLARE(apr_status_t) apr_socket_from_file(apr_socket_t
**newsock,
  +                                               apr_file_t *file)
   {
       (*newsock) = apr_pcalloc(file->pool, sizeof(**newsock));
       (*newsock)->socketdes = file->filedes;
  
  
  

Mime
View raw message