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...@locus.apache.org on 2000/07/10 23:37:25 UTC

cvs commit: apache-2.0/src/modules/mpm/spmt_os2 spmt_os2.c

rbb         00/07/10 14:37:24

  Modified:    src/include ap_listen.h
               src/main listen.c
               src/modules/mpm/beos beos.c
               src/modules/mpm/dexter dexter.c
               src/modules/mpm/mpmt mpmt.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
  Log:
  Move setup_listeners to listen.c.  This renames it to ap_setup_listeners,
  and removes the duplicated code from all effected MPMs.  The only this
  doesn't touch, is Windows.  That MPM was using a different setup_listeners.
  If one of the Windows guys would like to modify the WinNT MPM to use the
  same setup_lsiteners, that would be VERY cool.
  
  Revision  Changes    Path
  1.14      +4 -0      apache-2.0/src/include/ap_listen.h
  
  Index: ap_listen.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/ap_listen.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ap_listen.h	2000/06/17 16:29:46	1.13
  +++ ap_listen.h	2000/07/10 21:37:11	1.14
  @@ -72,7 +72,11 @@
   extern ap_listen_rec *ap_listeners;
   
   void ap_listen_pre_config(void);
  +#ifndef WIN32
  +int ap_setup_listeners(server_rec *s);
  +#else
   int ap_listen_open(process_rec *process, unsigned port);
  +#endif
   const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
   const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips);
   const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
  
  
  
  1.26      +17 -1     apache-2.0/src/main/listen.c
  
  Index: listen.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/listen.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- listen.c	2000/06/17 16:29:48	1.25
  +++ listen.c	2000/07/10 21:37:13	1.26
  @@ -201,7 +201,9 @@
       ap_listeners = new;
   }
   
  -
  +#ifndef WIN32
  +static
  +#endif
   int ap_listen_open(process_rec *process, unsigned port)
   {
       ap_pool_t *pconf = process->pconf;
  @@ -241,6 +243,20 @@
       return num_open ? 0 : -1;
   }
   
  +#ifndef WIN32
  +int ap_setup_listeners(server_rec *s)
  +{
  +    ap_listen_rec *lr;
  +    int num_listeners = 0;
  +    if (ap_listen_open(s->process, s->port)) {
  +       return 0;
  +    }
  +    for (lr = ap_listeners; lr; lr = lr->next) {
  +        num_listeners++;
  +    }
  +    return num_listeners;
  +}
  +#endif
   
   void ap_listen_pre_config(void)
   {
  
  
  
  1.8       +1 -14     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- beos.c	2000/07/10 18:21:19	1.7
  +++ beos.c	2000/07/10 21:37:14	1.8
  @@ -289,19 +289,6 @@
   	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
   }
   
  -static int setup_listeners(server_rec *s)
  -{
  -    ap_listen_rec *lr;
  -    int num_listeners = 0;
  -    if (ap_listen_open(s->process, s->port)) {
  -       return 0;
  -    }
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        num_listeners++;
  -    }
  -    return num_listeners;
  -}
  -
   /*****************************************************************
    * Here follows a long bunch of generic server bookkeeping stuff...
    */
  @@ -692,7 +679,7 @@
           return 1;
       }
          
  -    if ((num_listening_sockets = setup_listeners(ap_server_conf)) < 1) {
  +    if ((num_listening_sockets = ap_setup_listeners(ap_server_conf)) < 1) {
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
               "no listening sockets available, shutting down");
           return 1;
  
  
  
  1.111     +1 -15     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.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- dexter.c	2000/07/10 18:21:20	1.110
  +++ dexter.c	2000/07/10 21:37:16	1.111
  @@ -376,20 +376,6 @@
   #endif
   }
   
  -static int setup_listeners(server_rec *s)
  -{
  -    ap_listen_rec *lr;
  -    int num_listeners = 0;
  -
  -    if (ap_listen_open(s->process, s->port)) {
  -       return 0;
  -    }
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        num_listeners++;
  -    }
  -    return num_listeners;
  -}
  -
   /*****************************************************************
    * Here follows a long bunch of generic server bookkeeping stuff...
    */
  @@ -1026,7 +1012,7 @@
           exit(1);
       }
       ap_server_conf = s;
  -    if ((num_listenfds = setup_listeners(ap_server_conf)) < 1) {
  +    if ((num_listenfds = ap_setup_listeners(ap_server_conf)) < 1) {
           /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
               "no listening sockets available, shutting down");
  
  
  
  1.8       +1 -14     apache-2.0/src/modules/mpm/mpmt/mpmt.c
  
  Index: mpmt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt/mpmt.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mpmt.c	2000/07/10 18:21:21	1.7
  +++ mpmt.c	2000/07/10 21:37:17	1.8
  @@ -404,19 +404,6 @@
   #endif
   }
   
  -static int setup_listeners(server_rec *s)
  -{
  -    ap_listen_rec *lr;
  -    int num_listeners = 0;
  -    if (ap_listen_open(s->process, s->port)) {
  -       return 0;
  -    }
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        num_listeners++;
  -    }
  -    return num_listeners;
  -}
  -
   /*****************************************************************
    * Here follows a long bunch of generic server bookkeeping stuff...
    */
  @@ -1445,7 +1432,7 @@
           exit(1);
       }
       ap_server_conf = s;
  -    if ((num_listensocks = setup_listeners(ap_server_conf)) < 1) {
  +    if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
           /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
               "no listening sockets available, shutting down");
  
  
  
  1.39      +1 -14     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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- mpmt_beos.c	2000/07/10 18:21:21	1.38
  +++ mpmt_beos.c	2000/07/10 21:37:19	1.39
  @@ -277,19 +277,6 @@
   	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
   }
   
  -static int setup_listeners(server_rec *s)
  -{
  -    ap_listen_rec *lr;
  -    int num_listeners = 0;
  -    if (ap_listen_open(s->process, s->port)) {
  -       return 0;
  -    }
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        num_listeners++;
  -    }
  -    return num_listeners;
  -}
  -
   /*****************************************************************
    * Here follows a long bunch of generic server bookkeeping stuff...
    */
  @@ -717,7 +704,7 @@
       ap_server_conf = s;
       port_of_death = create_port(1, "httpd_port_of_death");
   
  -    if ((num_listenfds = setup_listeners(ap_server_conf)) < 1) {
  +    if ((num_listenfds = ap_setup_listeners(ap_server_conf)) < 1) {
           /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, errno, s,
               "no listening sockets available, shutting down");
  
  
  
  1.105     +1 -14     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.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- mpmt_pthread.c	2000/07/10 18:21:22	1.104
  +++ mpmt_pthread.c	2000/07/10 21:37:20	1.105
  @@ -373,19 +373,6 @@
   #endif
   }
   
  -static int setup_listeners(server_rec *s)
  -{
  -    ap_listen_rec *lr;
  -    int num_listeners = 0;
  -    if (ap_listen_open(s->process, s->port)) {
  -       return 0;
  -    }
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        num_listeners++;
  -    }
  -    return num_listeners;
  -}
  -
   /*****************************************************************
    * Here follows a long bunch of generic server bookkeeping stuff...
    */
  @@ -1049,7 +1036,7 @@
           exit(1);
       }
       ap_server_conf = s;
  -    if ((num_listensocks = setup_listeners(ap_server_conf)) < 1) {
  +    if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
           /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
               "no listening sockets available, shutting down");
  
  
  
  1.115     +1 -24     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.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- prefork.c	2000/07/10 18:21:22	1.114
  +++ prefork.c	2000/07/10 21:37:21	1.115
  @@ -1283,29 +1283,6 @@
       }
   }
   
  -static int setup_listeners(server_rec *s)
  -{
  -    ap_listen_rec *lr;
  -    int sockdes;
  -
  -    if (ap_listen_open(s->process, s->port)) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
  -		    "no listening sockets available, shutting down");
  -	return -1;
  -    }
  -
  -    listenmaxfd = -1;
  -    FD_ZERO(&listenfds);
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        ap_get_os_sock(&sockdes, lr->sd);
  -	FD_SET(sockdes, &listenfds);
  -	if (sockdes > listenmaxfd) {
  -	    listenmaxfd = sockdes;
  -	}
  -    }
  -    return 0;
  -}
  -
   /* Useful to erase the status of children that might be from previous
    * generations */
   static void ap_prefork_force_reset_connection_status(long conn_id)
  @@ -1337,7 +1314,7 @@
    
       ap_log_pid(pconf, ap_pid_fname);
   
  -    if (setup_listeners(s)) {
  +    if (ap_setup_listeners(s)) {
   	/* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
   	return 1;
       }
  
  
  
  1.51      +1 -22     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.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- spmt_os2.c	2000/07/10 18:21:24	1.50
  +++ spmt_os2.c	2000/07/10 21:37:23	1.51
  @@ -741,27 +741,6 @@
       return 0;
   }
   
  -
  -
  -static int setup_listeners(ap_pool_t *pchild, ap_pollfd_t **listen_poll)
  -{
  -    ap_listen_rec *lr;
  -    int numfds = 0;
  -
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        numfds++;
  -    }
  -
  -    ap_setup_poll(listen_poll, numfds, pchild);
  -
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -	ap_add_poll_socket(*listen_poll, lr->sd, APR_POLLIN);
  -    }
  -    return 0;
  -}
  -
  -
  -
   static void child_main(void *child_num_arg)
   {
       ap_listen_rec *lr = NULL;
  @@ -796,7 +775,7 @@
       THREAD_GLOBAL(pchild) = pchild;
       ap_create_pool(&ptrans, pchild);
   
  -    if (setup_listeners(pchild, &listen_poll)) {
  +    if (ap_setup_listeners(pchild, &listen_poll)) {
   	clean_child_exit(1);
       }
   
  
  
  

Re: cvs commit: apache-2.0/src/modules/mpm/spmt_os2 spmt_os2.c

Posted by rb...@covalent.net.
On Mon, 10 Jul 2000, Greg Stein wrote:

> This checkin breaks the original prefork MPM and the OS/2 MPM. See below.

I realize it breaks the original prefork.  That module should go away one
way or the other.  Currently, that module is implemented three times in
the code.  once in prefork, once in mpmt_pthread, and once in
mpmt.  Having said that, either prefork and mpmt_pthread or prefork and
mpmt need to go away.  I asked earlier this weekend if I could remove
prefork, and nobody objected.  I am waiting until tomorrow, and then I am
removing it.  I see no reason to make sure it still works, unless somebody
tells me they thing I should keep it.  When I get that e-mail, I'll fix
the MPM to work with the new setup_listeners.

> On Mon, Jul 10, 2000 at 09:37:25PM -0000, rbb@locus.apache.org wrote:
> >   +#ifndef WIN32
> >   +int ap_setup_listeners(server_rec *s)
> >   +{
> >   +    ap_listen_rec *lr;
> >   +    int num_listeners = 0;
> >   +    if (ap_listen_open(s->process, s->port)) {
> >   +       return 0;
> >   +    }
> >   +    for (lr = ap_listeners; lr; lr = lr->next) {
> >   +        num_listeners++;
> >   +    }
> >   +    return num_listeners;
> >   +}
> >   +#endif
> >...
> >   --- spmt_os2.c	2000/07/10 18:21:24	1.50
> >   +++ spmt_os2.c	2000/07/10 21:37:23	1.51
> >   @@ -741,27 +741,6 @@
> >        return 0;
> >    }
> >    
> >   -
> >   -
> >   -static int setup_listeners(ap_pool_t *pchild, ap_pollfd_t **listen_poll)
> >   -{
> >   -    ap_listen_rec *lr;
> >   -    int numfds = 0;
> >   -
> >   -    for (lr = ap_listeners; lr; lr = lr->next) {
> >   -        numfds++;
> >   -    }
> >   -
> >   -    ap_setup_poll(listen_poll, numfds, pchild);
> >   -
> >   -    for (lr = ap_listeners; lr; lr = lr->next) {
> >   -	ap_add_poll_socket(*listen_poll, lr->sd, APR_POLLIN);
> >   -    }
> >   -    return 0;
> >   -}
> 
> Same problem: the above code is very different from ap_setup_listeners().

Yeah, I wasn't paying enough attention to spmt_os2.  I'll look into fixing
the MPM to work with ap_setup_listeners now.  If I can't do it, I'll back
out that change.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/modules/mpm/spmt_os2 spmt_os2.c

Posted by Greg Stein <gs...@lyra.org>.
This checkin breaks the original prefork MPM and the OS/2 MPM. See below.


On Mon, Jul 10, 2000 at 09:37:25PM -0000, rbb@locus.apache.org wrote:
>...
>   --- listen.c	2000/06/17 16:29:48	1.25
>   +++ listen.c	2000/07/10 21:37:13	1.26
>...
>   +#ifndef WIN32
>   +int ap_setup_listeners(server_rec *s)
>   +{
>   +    ap_listen_rec *lr;
>   +    int num_listeners = 0;
>   +    if (ap_listen_open(s->process, s->port)) {
>   +       return 0;
>   +    }
>   +    for (lr = ap_listeners; lr; lr = lr->next) {
>   +        num_listeners++;
>   +    }
>   +    return num_listeners;
>   +}
>   +#endif
>...
>   --- prefork.c	2000/07/10 18:21:22	1.114
>   +++ prefork.c	2000/07/10 21:37:21	1.115
>   @@ -1283,29 +1283,6 @@
>        }
>    }
>    
>   -static int setup_listeners(server_rec *s)
>   -{
>   -    ap_listen_rec *lr;
>   -    int sockdes;
>   -
>   -    if (ap_listen_open(s->process, s->port)) {
>   -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
>   -		    "no listening sockets available, shutting down");
>   -	return -1;
>   -    }
>   -
>   -    listenmaxfd = -1;
>   -    FD_ZERO(&listenfds);
>   -    for (lr = ap_listeners; lr; lr = lr->next) {
>   -        ap_get_os_sock(&sockdes, lr->sd);
>   -	FD_SET(sockdes, &listenfds);
>   -	if (sockdes > listenmaxfd) {
>   -	    listenmaxfd = sockdes;
>   -	}
>   -    }
>   -    return 0;
>   -}

The above function is very different from the new ap_setup_listeners()

>...
>   @@ -1337,7 +1314,7 @@
>     
>        ap_log_pid(pconf, ap_pid_fname);
>    
>   -    if (setup_listeners(s)) {
>   +    if (ap_setup_listeners(s)) {
>    	/* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
>    	return 1;
>        }

ap_setup_listeners() has a different return value. The above check is not
appropriate.

>...
>   --- spmt_os2.c	2000/07/10 18:21:24	1.50
>   +++ spmt_os2.c	2000/07/10 21:37:23	1.51
>   @@ -741,27 +741,6 @@
>        return 0;
>    }
>    
>   -
>   -
>   -static int setup_listeners(ap_pool_t *pchild, ap_pollfd_t **listen_poll)
>   -{
>   -    ap_listen_rec *lr;
>   -    int numfds = 0;
>   -
>   -    for (lr = ap_listeners; lr; lr = lr->next) {
>   -        numfds++;
>   -    }
>   -
>   -    ap_setup_poll(listen_poll, numfds, pchild);
>   -
>   -    for (lr = ap_listeners; lr; lr = lr->next) {
>   -	ap_add_poll_socket(*listen_poll, lr->sd, APR_POLLIN);
>   -    }
>   -    return 0;
>   -}

Same problem: the above code is very different from ap_setup_listeners().

>...
>   @@ -796,7 +775,7 @@
>        THREAD_GLOBAL(pchild) = pchild;
>        ap_create_pool(&ptrans, pchild);
>    
>   -    if (setup_listeners(pchild, &listen_poll)) {
>   +    if (ap_setup_listeners(pchild, &listen_poll)) {
>    	clean_child_exit(1);
>        }

And again: different return values.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/