httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@hyperreal.com>
Subject cvs commit: apache/src alloc.c alloc.h http_main.c
Date Sun, 21 Jul 1996 14:49:04 GMT
ben         96/07/21 07:49:04

  Modified:    src       alloc.c alloc.h http_main.c
  Log:
  Fix old-style restarts (broken by graceful restarts). Also move graceful
  restarts to SIGUSR1 instead of SIGINT.
  
  Revision  Changes    Path
  1.7       +5 -0      apache/src/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** alloc.c	1996/06/17 20:43:45	1.6
  --- alloc.c	1996/07/21 14:49:01	1.7
  ***************
  *** 729,734 ****
  --- 729,739 ----
      register_cleanup (p, (void *)fd, fd_cleanup, fd_cleanup);
    }
    
  + void kill_cleanups_for_fd(pool *p,int fd)
  +     {
  +     kill_cleanup(p,(void *)fd,fd_cleanup);
  +     }
  + 
    int popenf(struct pool *a, char *name, int flg, int mode)
    {
      int fd;
  
  
  
  1.6       +1 -0      apache/src/alloc.h
  
  Index: alloc.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -C3 -r1.5 -r1.6
  *** alloc.h	1996/06/09 01:14:35	1.5
  --- alloc.h	1996/07/21 14:49:01	1.6
  ***************
  *** 205,210 ****
  --- 205,211 ----
    
    void note_cleanups_for_file (pool *, FILE *);
    void note_cleanups_for_fd (pool *, int);
  + void kill_cleanups_for_fd (pool *p, int fd);
    
    /* routines to note closes... file descriptors are constrained enough
     * on some systems that we want to support this.
  
  
  
  1.54      +12 -7     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -C3 -r1.53 -r1.54
  *** http_main.c	1996/07/18 18:44:45	1.53
  --- http_main.c	1996/07/21 14:49:01	1.54
  ***************
  *** 1154,1160 ****
    #ifdef NO_USE_SIGACTION
        signal(SIGTERM,(void (*)())sig_term);
        signal(SIGHUP,(void (*)())restart);
  !     signal(SIGINT,(void (*)())graceful_restart);
    #else
        memset(&sa,0,sizeof sa);
        sa.sa_handler=(void (*)())sig_term;
  --- 1154,1160 ----
    #ifdef NO_USE_SIGACTION
        signal(SIGTERM,(void (*)())sig_term);
        signal(SIGHUP,(void (*)())restart);
  !     signal(SIGUSR1,(void (*)())graceful_restart);
    #else
        memset(&sa,0,sizeof sa);
        sa.sa_handler=(void (*)())sig_term;
  ***************
  *** 1164,1171 ****
        if(sigaction(SIGHUP,&sa,NULL) < 0)
    	log_unixerr("sigaction(SIGHUP)", NULL, NULL, server_conf);
        sa.sa_handler=(void (*)())graceful_restart;
  !     if(sigaction(SIGINT,&sa,NULL) < 0)
  ! 	log_unixerr("sigaction(SIGINT)", NULL, NULL, server_conf);
    #endif
    }
    
  --- 1164,1171 ----
        if(sigaction(SIGHUP,&sa,NULL) < 0)
    	log_unixerr("sigaction(SIGHUP)", NULL, NULL, server_conf);
        sa.sa_handler=(void (*)())graceful_restart;
  !     if(sigaction(SIGUSR1,&sa,NULL) < 0)
  ! 	log_unixerr("sigaction(SIGUSR1)", NULL, NULL, server_conf);
    #endif
    }
    
  ***************
  *** 1381,1386 ****
  --- 1381,1387 ----
    		exit(0);
    		}
    	    /*fprintf(stderr,"%d check(2a) %d %d\n",getpid(),scoreboard_image->global.exit_generation,generation);*/
  + 	    sync_scoreboard_image();
    	    if(scoreboard_image->global.exit_generation >= generation)
    		exit(0);
    
  ***************
  *** 1490,1496 ****
            exit(1);
        }
    
  !     /*    note_cleanups_for_fd (pconf, s); don't arrange to close on exec or restart */
        
        if((setsockopt(s, SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one)))
           == -1) {
  --- 1491,1497 ----
            exit(1);
        }
    
  !     note_cleanups_for_fd (pconf, s); /* arrange to close on exec or restart */
        
        if((setsockopt(s, SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one)))
           == -1) {
  ***************
  *** 1542,1548 ****
    
    static listen_rec *old_listeners;
    
  ! static void copy_listeners()
        {
        listen_rec *lr;
    
  --- 1543,1549 ----
    
    static listen_rec *old_listeners;
    
  ! static void copy_listeners(pool *p)
        {
        listen_rec *lr;
    
  ***************
  *** 1551,1556 ****
  --- 1552,1558 ----
    	{
    	listen_rec *nr=malloc(sizeof *nr);
    	*nr=*lr;
  + 	kill_cleanups_for_fd(p,nr->fd);
    	nr->next=old_listeners;
    	assert(!nr->used);
    	old_listeners=nr;
  ***************
  *** 1621,1633 ****
        }
        
        if(is_graceful)
  ! 	log_error("SIGINT received.  Doing graceful restart",server_conf);
        else if (sd != -1 || listenmaxfd != -1) {
    	reclaim_child_processes(); /* Not when just starting up */
    	log_error ("SIGHUP received.  Attempting to restart", server_conf);
        }
        
  !     copy_listeners();
        saved_sd=sd;
        restart_time = time(NULL);
        clear_pool (pconf);
  --- 1623,1638 ----
        }
        
        if(is_graceful)
  ! 	{
  ! 	log_error("SIGUSR1 received.  Doing graceful restart",server_conf);
  ! 	kill_cleanups_for_fd(pconf,sd);
  ! 	}
        else if (sd != -1 || listenmaxfd != -1) {
    	reclaim_child_processes(); /* Not when just starting up */
    	log_error ("SIGHUP received.  Attempting to restart", server_conf);
        }
        
  !     copy_listeners(pconf);
        saved_sd=sd;
        restart_time = time(NULL);
        clear_pool (pconf);
  
  
  

Mime
View raw message