httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/os/win32 iol_socket.c iol_socket.h
Date Fri, 30 Jun 2000 18:08:27 GMT
rbb         00/06/30 11:08:23

  Modified:    src/main Makefile.in
               src/modules/mpm/beos beos.c
               src/modules/mpm/dexter dexter.c
               src/modules/mpm/mpmt_beos mpmt_beos.c
               src/modules/mpm/mpmt_pthread mpmt_pthread.c
               src/modules/mpm/prefork prefork.c
               src/modules/mpm/spmt_os2 spmt_os2.c
               src/modules/mpm/winnt mpm_winnt.c
               src/modules/proxy proxy_connect.c proxy_ftp.c proxy_http.c
               src/modules/standard mod_cgid.c
               src/os/unix Makefile.in
  Added:       src/include iol_socket.h
               src/main iol_socket.c
  Removed:     src/os/beos iol_socket.c iol_socket.h
               src/os/os2 iol_socket.c iol_socket.h
               src/os/unix iol_socket.c iol_socket.h
               src/os/win32 iol_socket.c iol_socket.h
  Log:
  Combine some common code.  Before this, all platforms implemented their
  own iol_sockets using APR.  This just combines all of that code to a
  common file and moves that file to main.  I have tested this with all of
  the Unix MPM's, but I am willing to bet I missed something (Makefiles) for
  Windows, and possibly moving some code for OS/2 and BeOS.
  
  Revision  Changes    Path
  1.1                  apache-2.0/src/include/iol_socket.h
  
  Index: iol_socket.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * Portions of this software are based upon public domain software
   * originally written at the National Center for Supercomputing Applications,
   * University of Illinois, Urbana-Champaign.
   */
  
  #ifndef OS_UNIX_IOL_SOCKET_H
  #define OS_UNIX_IOL_SOCKET_H
  
  API_EXPORT(ap_iol *) ap_iol_attach_socket(ap_socket_t *sock);
  
  #endif
  
  
  
  1.15      +2 -2      apache-2.0/src/main/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/Makefile.in,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Makefile.in	2000/06/22 18:28:06	1.14
  +++ Makefile.in	2000/06/30 18:07:05	1.15
  @@ -7,8 +7,8 @@
   	buff.c http_config.c http_core.c http_log.c http_main.c \
   	http_protocol.c http_request.c http_vhost.c util.c util_date.c \
   	util_script.c util_uri.c util_md5.c util_cfgtree.c util_ebcdic.c \
  -	rfc1413.c http_connection.c iol_file.c listen.c mpm_common.c \
  -	util_charset.c util_debug.c
  +	rfc1413.c http_connection.c iol_file.c iol_socket.c listen.c \
  +        mpm_common.c util_charset.c util_debug.c
   
   include $(top_srcdir)/build/ltlib.mk
   
  
  
  
  1.1                  apache-2.0/src/main/iol_socket.c
  
  Index: iol_socket.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * Portions of this software are based upon public domain software
   * originally written at the National Center for Supercomputing Applications,
   * University of Illinois, Urbana-Champaign.
   */
  
  #define CORE_PRIVATE
  #include "ap_config.h"
  #include "httpd.h"
  #include "ap_iol.h"
  #include "apr_network_io.h"
  #include "apr_file_io.h"
  #include "iol_socket.h"
  #ifdef HAVE_STDLIB_H
  #include <stdlib.h>
  #endif
  
  #define FD_NONBLOCKING_SET	(1)
  
  typedef struct {
      ap_iol iol;
      ap_socket_t *sock;
  } iol_socket;
  
  static ap_status_t socket_setopt(ap_iol *viol, ap_iol_option opt,
                                 const void *value)
  {
      iol_socket *iol = (iol_socket *)viol;
  
      switch (opt) {
      case AP_IOL_TIMEOUT:
          ap_setsocketopt(iol->sock, APR_SO_TIMEOUT, 
                          *(const int*)value * AP_USEC_PER_SEC);
          break;
      default:
  	    return APR_EINVAL;
      }
      return APR_SUCCESS;
  }
  
  static ap_status_t socket_getopt(ap_iol *viol, ap_iol_option opt, void *value)
  {
      iol_socket *iol = (iol_socket *)viol;
  
      switch (opt) {
      case AP_IOL_TIMEOUT:
          ap_getsocketopt(iol->sock, APR_SO_TIMEOUT, (ap_int32_t *) value);
          (*(ap_int32_t *)value) /= AP_USEC_PER_SEC;
          break;
      default:
          return APR_EINVAL;
      }
      return APR_SUCCESS;
  }
  
  
  static ap_status_t socket_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);
  }
  
  static ap_status_t socket_writev(ap_iol *viol, const struct iovec *vec, ap_size_t nvec,
      ap_ssize_t *nbytes)
  {
  #ifndef HAVE_NETINET_TCP_H
      /* At present BeOS doesn't support writev for sockets... */
      *nbytes = vec[0].iov_len;
      return ap_send(((iol_socket *)viol)->sock, vec[0].iov_base, nbytes);
  #else
      return ap_sendv(((iol_socket *)viol)->sock, vec, nvec, nbytes);
  #endif
  }
  
  static ap_status_t socket_read(ap_iol *viol, char* buf, ap_size_t size,
       ap_ssize_t *nbytes)
  {
      *nbytes = size;
      return ap_recv(((iol_socket *)viol)->sock, buf, nbytes);
  }
  
  static ap_status_t socket_close(ap_iol *viol)
  {
      iol_socket *iol = (iol_socket *)viol;
      int saved_errno;
  
      saved_errno = ap_close_socket(iol->sock);
      free(iol);
      iol = NULL;
      if (saved_errno == 0) {
          return APR_SUCCESS;
      }
      return saved_errno;
  }
  
  static ap_status_t socket_shutdown(ap_iol *viol, int how)
  {
      iol_socket *iol = (iol_socket *)viol;
  
      return ap_shutdown(iol->sock, how);
  }
      
  static const ap_iol_methods socket_methods = {
      socket_close,
      socket_write,
      socket_writev,
      socket_read,
      socket_setopt,
      socket_getopt,
      NULL,
      socket_shutdown,
  };
  
  API_EXPORT(ap_iol *) ap_iol_attach_socket(ap_socket_t *sock)
  {
      iol_socket *iol;
  
      iol = malloc(sizeof(iol_socket));
      iol->iol.methods = &socket_methods;
      iol->sock = sock;
      return (ap_iol *)iol;
  }
  
  
  
  1.4       +1 -1      apache-2.0/src/modules/mpm/beos/beos.c
  
  Index: beos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/beos/beos.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- beos.c	2000/06/26 13:26:22	1.3
  +++ beos.c	2000/06/30 18:07:12	1.4
  @@ -393,7 +393,7 @@
   	    return;
       }
       
  -    iol = beos_attach_socket(sock);
  +    iol = ap_iol_attach_socket(sock);
       if (iol == NULL) {
           ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
             "error attaching to socket");
  
  
  
  1.106     +1 -1      apache-2.0/src/modules/mpm/dexter/dexter.c
  
  Index: dexter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- dexter.c	2000/06/28 14:33:36	1.105
  +++ dexter.c	2000/06/30 18:07:14	1.106
  @@ -509,7 +509,7 @@
       }
   
       sock_disable_nagle(csd);
  -    iol = unix_attach_socket(sock);
  +    iol = ap_iol_attach_socket(sock);
       conn_io = ap_bcreate(p, B_RDWR);
       ap_bpush_iol(conn_io, iol);
   
  
  
  
  1.35      +1 -1      apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c
  
  Index: mpmt_beos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- mpmt_beos.c	2000/06/21 13:15:28	1.34
  +++ mpmt_beos.c	2000/06/30 18:07:19	1.35
  @@ -370,7 +370,7 @@
       long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
       int csd;
   
  -    iol = beos_attach_socket(sock);
  +    iol = ap_iol_attach_socket(sock);
       if (iol == NULL) {
           if (errno == EBADF) {
               ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, NULL,
  
  
  
  1.100     +1 -1      apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- mpmt_pthread.c	2000/06/27 22:35:40	1.99
  +++ mpmt_pthread.c	2000/06/30 18:07:24	1.100
  @@ -504,7 +504,7 @@
   
       sock_disable_nagle(csd);
   
  -    iol = unix_attach_socket(sock);
  +    iol = ap_iol_attach_socket(sock);
   
       (void) ap_update_child_status(my_child_num, my_thread_num,  
   				  SERVER_BUSY_READ, (request_rec *) NULL);
  
  
  
  1.112     +1 -1      apache-2.0/src/modules/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- prefork.c	2000/06/28 14:33:37	1.111
  +++ prefork.c	2000/06/30 18:07:29	1.112
  @@ -1039,7 +1039,7 @@
   
   	sock_disable_nagle(sockdes);
   
  -	iol = unix_attach_socket(csd);
  +	iol = ap_iol_attach_socket(csd);
   	(void) ap_update_child_status(my_child_num, SERVER_BUSY_READ,
   				   (request_rec *) NULL);
   
  
  
  
  1.48      +1 -1      apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c
  
  Index: spmt_os2.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- spmt_os2.c	2000/06/25 08:22:13	1.47
  +++ spmt_os2.c	2000/06/30 18:07:35	1.48
  @@ -994,7 +994,7 @@
   
   	sock_disable_nagle(csd);
   
  -        iol = os2_attach_socket(csd);
  +        iol = ap_iol_attach_socket(csd);
   
   	if (iol == NULL) {
             ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, NULL,
  
  
  
  1.82      +1 -1      apache-2.0/src/modules/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- mpm_winnt.c	2000/06/22 19:17:17	1.81
  +++ mpm_winnt.c	2000/06/30 18:07:39	1.82
  @@ -1085,7 +1085,7 @@
           sock_disable_nagle(context->accept_socket);
           ap_put_os_sock(&context->sock, &context->accept_socket, context->ptrans);
   
  -        iol = win32_attach_socket(context->ptrans, context->sock);
  +        iol = ap_iol_attach_socket(context->sock);
           if (iol == NULL) {
               ap_log_error(APLOG_MARK, APLOG_ERR, APR_ENOMEM, server_conf,
                            "worker_main: attach_socket() failed. Continuing...");
  
  
  
  1.7       +1 -1      apache-2.0/src/modules/proxy/proxy_connect.c
  
  Index: proxy_connect.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/proxy_connect.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- proxy_connect.c	2000/06/13 06:17:47	1.6
  +++ proxy_connect.c	2000/06/30 18:07:44	1.7
  @@ -211,7 +211,7 @@
       }
   
       sock_buff = ap_bcreate(r->pool, B_RDWR);
  -    ap_bpush_iol(sock_buff, unix_attach_socket(sock));
  +    ap_bpush_iol(sock_buff, ap_iol_attach_socket(sock));
   
       if(ap_setup_poll(&pollfd, 2, r->pool) != APR_SUCCESS)
       {
  
  
  
  1.12      +3 -3      apache-2.0/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- proxy_ftp.c	2000/06/13 06:17:47	1.11
  +++ proxy_ftp.c	2000/06/30 18:07:45	1.12
  @@ -589,7 +589,7 @@
       }
   
       f = ap_bcreate(p, B_RDWR);
  -    ap_bpush_iol(f, unix_attach_socket(sock));
  +    ap_bpush_iol(f, ap_iol_attach_socket(sock));
   /* shouldn't we implement telnet control options here? */
   
   #ifdef CHARSET_EBCDIC
  @@ -1146,11 +1146,11 @@
               }
           }
           data = ap_bcreate(p, B_RDWR);
  -        ap_bpush_iol(f, unix_attach_socket(csd));
  +        ap_bpush_iol(f, ap_iol_attach_socket(csd));
       }
       else {
           data = ap_bcreate(p, B_RDWR);
  -        ap_bpush_iol(data, unix_attach_socket(dsock));
  +        ap_bpush_iol(data, ap_iol_attach_socket(dsock));
       }
   
   /* send response */
  
  
  
  1.11      +1 -1      apache-2.0/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- proxy_http.c	2000/06/13 06:17:47	1.10
  +++ proxy_http.c	2000/06/30 18:07:46	1.11
  @@ -269,7 +269,7 @@
       clear_connection(r->pool, r->headers_in);    /* Strip connection-based headers
*/
   
       f = ap_bcreate(p, B_RDWR);
  -    ap_bpush_iol(f, unix_attach_socket(sock));
  +    ap_bpush_iol(f, ap_iol_attach_socket(sock));
   
       ap_bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF,
                 NULL);
  
  
  
  1.24      +1 -1      apache-2.0/src/modules/standard/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgid.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- mod_cgid.c	2000/06/24 17:34:03	1.23
  +++ mod_cgid.c	2000/06/30 18:07:52	1.24
  @@ -898,7 +898,7 @@
   
       ap_put_os_sock(&tempsock, &sd, pcgi);
   
  -    iol = unix_attach_socket(tempsock);
  +    iol = ap_iol_attach_socket(tempsock);
   
       ap_bpush_iol(script, iol); 
   
  
  
  
  1.5       +1 -1      apache-2.0/src/os/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/os/unix/Makefile.in,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Makefile.in	2000/05/15 23:02:57	1.4
  +++ Makefile.in	2000/06/30 18:08:13	1.5
  @@ -1,5 +1,5 @@
   
   LTLIBRARY_NAME    = libos.la
  -LTLIBRARY_SOURCES = os-inline.c unixd.c iol_socket.c
  +LTLIBRARY_SOURCES = os-inline.c unixd.c
   
   include $(top_srcdir)/build/ltlib.mk
  
  
  

Mime
View raw message