You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2001/07/18 18:51:49 UTC

cvs commit: apr/test client.c sendfile.c server.c testpoll.c testsockets.c testsockopt.c

wrowe       01/07/18 09:51:49

  Modified:    include  apr_network_io.h
               network_io/os2 sockets.c
               network_io/unix sockets.c
               network_io/win32 sockets.c
               test     client.c sendfile.c server.c testpoll.c
                        testsockets.c testsockopt.c
  Log:
    Back out the inherit flag from apr_socket_create/apr_os_socket_put.
  
  Revision  Changes    Path
  1.105     +2 -11     apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_network_io.h,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- apr_network_io.h	2001/07/16 18:14:20	1.104
  +++ apr_network_io.h	2001/07/18 16:51:48	1.105
  @@ -241,17 +241,12 @@
    * @param new_sock The new socket that has been set up.
    * @param family The address family of the socket (e.g., APR_INET).
    * @param type The type of the socket (e.g., SOCK_STREAM).
  - * @param flag Should this socket be inherited by child processes.  One of
  - * <PRE>
  - *          APR_INHERIT       This socket is inherited by children
  - *          APR_NO_INHERIT    This socket is not inherited by children.
  - * </PRE>
    * @param cont The pool to use
  - * @deffunc apr_status_t apr_socket_create(apr_socket_t **new_sock, int family, int type, apr_int32_t flag, apr_pool_t *cont)
  + * @deffunc apr_status_t apr_socket_create(apr_socket_t **new_sock, int family, int type, apr_pool_t *cont)
    */
   APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock, 
                                               int family, int type,
  -                                            apr_int32_t flag, apr_pool_t *cont);
  +                                            apr_pool_t *cont);
   
   /**
    * Shutdown either reading, writing, or both sides of a tcp socket.
  @@ -811,8 +806,6 @@
    * Set a socket to be inherited by child processes.
    * @param socket The socket to enable inheritance.
    * @deffunc void apr_socket_set_inherit(apr_socket_t *socket)
  - * @tip Same effect as passing the APR_INHERIT flag to apr_socket_create(),
  - * but it is far more efficient to pass the correct value in the first place.
    */
   APR_DECLARE_SET_INHERIT(socket);
   
  @@ -820,8 +813,6 @@
    * Unset a socket from being inherited by child processes.
    * @param socket The socket to disable inheritance.
    * @deffunc void apr_socket_unset_inherit(apr_socket_t *socket)
  - * @tip Same effect as passing the APR_NO_INHERIT flag to apr_socket_create(),
  - * but it is far more efficient to pass the correct value in the first place.
    */
   APR_DECLARE_UNSET_INHERIT(socket);
   
  
  
  
  1.43      +2 -4      apr/network_io/os2/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/os2/sockets.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- sockets.c	2001/07/16 18:45:33	1.42
  +++ sockets.c	2001/07/18 16:51:48	1.43
  @@ -129,9 +129,8 @@
   }
   
   apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type,
  -                               apr_int32_t inherit, apr_pool_t *cont)
  +                               apr_pool_t *cont)
   {
  -    /* TODO: Implement inherit flag */
       int family = ofamily;
   
       if (family == AF_UNSPEC) {
  @@ -271,9 +270,8 @@
   
   apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, 
                                 apr_os_sock_info_t *os_sock_info, 
  -                              apr_int32_t inherit, apr_pool_t *cont)
  +                              apr_pool_t *cont)
   {
  -    /* TODO: Implement inherit flag */
       alloc_socket(apr_sock, cont);
       set_socket_vars(*apr_sock, os_sock_info->family);
       (*apr_sock)->timeout = -1;
  
  
  
  1.83      +7 -12     apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- sockets.c	2001/07/16 23:43:21	1.82
  +++ sockets.c	2001/07/18 16:51:48	1.83
  @@ -127,7 +127,7 @@
   }
   
   apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type,
  -                               apr_int32_t inherit, apr_pool_t *cont)
  +                               apr_pool_t *cont)
   {
       int family = ofamily;
   
  @@ -160,10 +160,9 @@
       set_socket_vars(*new, family, type);
   
       (*new)->timeout = -1;
  -    (*new)->inherit = inherit;
  +    (*new)->inherit = 0;
       apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), socket_cleanup,
  -                              ((*new)->inherit & APR_INHERIT) 
  -                                  ? apr_pool_cleanup_null : socket_cleanup);
  +                              socket_cleanup);
       return APR_SUCCESS;
   } 
   
  @@ -254,10 +253,9 @@
           (*new)->local_interface_unknown = 1;
       }
   
  -    (*new)->inherit = sock->inherit;
  +    (*new)->inherit = 0;
       apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), socket_cleanup,
  -                              ((*new)->inherit & APR_INHERIT) 
  -                                  ? apr_pool_cleanup_null : socket_cleanup);
  +                              socket_cleanup);
       return APR_SUCCESS;
   }
   
  @@ -334,7 +332,6 @@
   
   apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, 
                                 apr_os_sock_info_t *os_sock_info, 
  -                              apr_int32_t inherit,
                                 apr_pool_t *cont)
   {
       alloc_socket(apr_sock, cont);
  @@ -358,11 +355,9 @@
                  (*apr_sock)->remote_addr->salen);
       }
           
  -    (*apr_sock)->inherit = inherit;
  +    (*apr_sock)->inherit = 0;
       apr_pool_cleanup_register((*apr_sock)->cntxt, (void *)(*apr_sock), 
  -                              socket_cleanup,
  -                              ((*apr_sock)->inherit & APR_INHERIT)
  -                                  ? apr_pool_cleanup_null : socket_cleanup);
  +                              socket_cleanup, socket_cleanup);
       return APR_SUCCESS;
   }
   
  
  
  
  1.62      +1 -5      apr/network_io/win32/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockets.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- sockets.c	2001/07/16 18:14:24	1.61
  +++ sockets.c	2001/07/18 16:51:48	1.62
  @@ -118,10 +118,8 @@
   }
   
   APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int ofamily,
  -                                            int type, apr_int32_t inherit,
  -                                            apr_pool_t *cont)
  +                                            int type, apr_pool_t *cont)
   {
  -    /* XXX: Todo: process the inherit value */
       int family = ofamily;
   
       if (family == AF_UNSPEC) {
  @@ -367,10 +365,8 @@
   
   APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock,
                                              apr_os_sock_info_t *os_sock_info,
  -                                           apr_int32_t inherit,
                                              apr_pool_t *cont)
   {
  -    /* XXX: Todo: process the inherit value */
       alloc_socket(apr_sock, cont);
       set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type);
       (*apr_sock)->timeout = -1;
  
  
  
  1.32      +1 -1      apr/test/client.c
  
  Index: client.c
  ===================================================================
  RCS file: /home/cvs/apr/test/client.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- client.c	2001/07/16 16:11:04	1.31
  +++ client.c	2001/07/18 16:51:49	1.32
  @@ -110,7 +110,7 @@
       fprintf(stdout,"OK\n");
   
       fprintf(stdout, "\tClient:  Creating new socket.......");
  -    if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM, APR_NO_INHERIT,
  +    if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM,
                             context) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't create socket\n");
           exit(-1);
  
  
  
  1.16      +1 -1      apr/test/sendfile.c
  
  Index: sendfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/sendfile.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- sendfile.c	2001/07/16 16:11:05	1.15
  +++ sendfile.c	2001/07/18 16:51:49	1.16
  @@ -114,7 +114,7 @@
       }
   
       *sock = NULL;
  -    rv = apr_socket_create(sock, *family, SOCK_STREAM, APR_NO_INHERIT, *p);
  +    rv = apr_socket_create(sock, *family, SOCK_STREAM, *p);
       if (rv != APR_SUCCESS) {
           fprintf(stderr, "apr_socket_create()->%d/%s\n",
                   rv,
  
  
  
  1.30      +1 -1      apr/test/server.c
  
  Index: server.c
  ===================================================================
  RCS file: /home/cvs/apr/test/server.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- server.c	2001/07/16 16:11:05	1.29
  +++ server.c	2001/07/18 16:51:49	1.30
  @@ -132,7 +132,7 @@
       }
   
       fprintf(stdout, "\tServer:  Creating new socket.......");
  -    if (apr_socket_create(&sock, family, SOCK_STREAM, APR_NO_INHERIT, context) != APR_SUCCESS) {
  +    if (apr_socket_create(&sock, family, SOCK_STREAM, context) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't create socket\n");
           exit(-1);
       }
  
  
  
  1.5       +1 -1      apr/test/testpoll.c
  
  Index: testpoll.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testpoll.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testpoll.c	2001/07/16 16:11:05	1.4
  +++ testpoll.c	2001/07/18 16:51:49	1.5
  @@ -72,7 +72,7 @@
           printf("couldn't create control socket information, shutting down");
           return 1;
       }
  -    if (apr_socket_create(sock, (*sa)->sa.sin.sin_family, SOCK_DGRAM, APR_NO_INHERIT, p)
  +    if (apr_socket_create(sock, (*sa)->sa.sin.sin_family, SOCK_DGRAM, p)
           != APR_SUCCESS){
           printf("couldn't create UDP socket, shutting down");
           return 1;
  
  
  
  1.3       +6 -6      apr/test/testsockets.c
  
  Index: testsockets.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testsockets.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testsockets.c	2001/07/16 16:11:05	1.2
  +++ testsockets.c	2001/07/18 16:51:49	1.3
  @@ -101,20 +101,20 @@
       printf("Testing socket creation functions.\n");
   
       STD_TEST_NEQ("    Creating a TCP socket",
  -                 apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_NO_INHERIT, pool))
  +                 apr_socket_create(&sock, APR_INET, SOCK_STREAM, pool))
       close_sock(sock);
   
       STD_TEST_NEQ("    Creating UDP socket",
  -                 apr_socket_create(&sock, APR_INET, SOCK_DGRAM, APR_NO_INHERIT, pool))
  +                 apr_socket_create(&sock, APR_INET, SOCK_DGRAM, pool))
       close_sock(sock);
   
   #if APR_HAVE_IPV6
       STD_TEST_NEQ("    Creating an IPv6 TCP socket",
  -                 apr_socket_create(&sock, APR_INET6, SOCK_STREAM, APR_NO_INHERIT, pool))
  +                 apr_socket_create(&sock, APR_INET6, SOCK_STREAM, pool))
       close_sock(sock);
   
       STD_TEST_NEQ("    Creating an IPv6 UDP socket",
  -                 apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, APR_NO_INHERIT, pool))
  +                 apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, pool))
       close_sock(sock);
   #else
       printf("NO IPv6 support.\n");
  @@ -123,9 +123,9 @@
       printf("Now trying sendto/recvfrom (simple tests only)\n");
   
       STD_TEST_NEQ("    Creating socket #1 for test",
  -                 apr_socket_create(&sock, family, SOCK_DGRAM, APR_NO_INHERIT, pool))
  +                 apr_socket_create(&sock, family, SOCK_DGRAM, pool))
       STD_TEST_NEQ("    Creating socket #2 for test",
  -                 apr_socket_create(&sock2, family, SOCK_DGRAM, APR_NO_INHERIT, pool))
  +                 apr_socket_create(&sock2, family, SOCK_DGRAM, pool))
   
       apr_sockaddr_info_get(&to, US, APR_UNSPEC, 7772, 0, pool);
       apr_sockaddr_info_get(&from, US, APR_UNSPEC, 7771, 0, pool);
  
  
  
  1.8       +1 -1      apr/test/testsockopt.c
  
  Index: testsockopt.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testsockopt.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testsockopt.c	2001/07/16 16:11:05	1.7
  +++ testsockopt.c	2001/07/18 16:51:49	1.8
  @@ -103,7 +103,7 @@
       printf("Testing socket option functions.\n");
   
       printf("\tCreating socket..........................");
  -    if ((stat = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_NO_INHERIT, context))
  +    if ((stat = apr_socket_create(&sock, APR_INET, SOCK_STREAM, context))
            != APR_SUCCESS){
           printf("Failed to create a socket!\n");
           exit(-1);