You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Dean Gaudet <dg...@hyperreal.com> on 1997/06/27 03:47:54 UTC

cvs commit: apache/src CHANGES PORTING alloc.c conf.h http_config.c http_config.h http_main.c httpd.h util.c

dgaudet     97/06/26 18:47:53

  Modified:    src       Tag: APACHE_1_2_X  CHANGES PORTING alloc.c conf.h
                        http_config.c http_config.h  http_main.c httpd.h
                        util.c
  Log:
  Add the slack fd code, and the reordering of log/socket opening.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.286.2.2 +18 -1     apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.1
  retrieving revision 1.286.2.2
  diff -C3 -r1.286.2.1 -r1.286.2.2
  *** CHANGES	1997/06/24 00:11:10	1.286.2.1
  --- CHANGES	1997/06/27 01:47:43	1.286.2.2
  ***************
  *** 1,5 ****
    Changes with Apache 1.2.1
  !   
      *) pregsub had an off-by-1 in its error checking code. [Alexei Kosut]
    
    Changes with Apache 1.2
  --- 1,22 ----
    Changes with Apache 1.2.1
  ! 
  !   *) Attempt to work around problems with third party libraries that do not
  !      handle high numbered descriptors (examples include bind, and
  !      solaris libc).  On all systems apache attempts to keep all permanent
  !      descriptors above 15 (called the low slack line).  Solaris users
  !      can also benefit from adding -DHIGH_SLACK_LINE=256 to EXTRA_CFLAGS
  !      which keeps all non-FILE * descriptors above 255.  On all systems
  !      this should make supporting large numbers of vhosts with many open
  !      log files more feasible.  If this causes trouble please report it,
  !      you can disable this workaround by adding -DNO_SLACK to EXTRA_CFLAGS.
  !      [Dean Gaudet] various PRs
  ! 
  !   *) Related to the last entry, network sockets are now opened before
  !      log files are opened.  The only known case where this can cause
  !      problems is under Solaris with many virtualhosts and many Listen
  !      directives.  But using -DHIGH_SLACK_LINE=256 described above will
  !      work around this problem.  [Dean Gaudet]
  ! 
      *) pregsub had an off-by-1 in its error checking code. [Alexei Kosut]
    
    Changes with Apache 1.2
  
  
  
  1.4.2.1   +3 -0      apache/src/PORTING
  
  Index: PORTING
  ===================================================================
  RCS file: /export/home/cvs/apache/src/PORTING,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -C3 -r1.4 -r1.4.2.1
  *** PORTING	1997/02/25 21:04:42	1.4
  --- PORTING	1997/06/27 01:47:44	1.4.2.1
  ***************
  *** 227,232 ****
  --- 227,235 ----
          NO_LINGCLOSE:
           Do not use Apache's soft, "lingering" close feature to
           terminate connections.
  +       NO_SLACK:
  +        Do not use the "slack" fd feature which requires a working fcntl
  +        F_DUPFD.
    --
    
      MISC #DEFINES:
  
  
  
  1.28.2.1  +6 -3      apache/src/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.c,v
  retrieving revision 1.28
  retrieving revision 1.28.2.1
  diff -C3 -r1.28 -r1.28.2.1
  *** alloc.c	1997/05/27 04:14:20	1.28
  --- alloc.c	1997/06/27 01:47:44	1.28.2.1
  ***************
  *** 58,65 ****
     * rst --- 4/95 --- 6/95
     */
    
  ! #include "conf.h"
  ! #include "alloc.h"
    
    #include <stdarg.h>
    
  --- 58,64 ----
     * rst --- 4/95 --- 6/95
     */
    
  ! #include "httpd.h"
    
    #include <stdarg.h>
    
  ***************
  *** 801,807 ****
      block_alarms();
      fd = open(name, flg, mode);
      save_errno = errno;
  !   if (fd >= 0) note_cleanups_for_fd (a, fd);
      unblock_alarms();
      errno = save_errno;
      return fd;
  --- 800,809 ----
      block_alarms();
      fd = open(name, flg, mode);
      save_errno = errno;
  !   if (fd >= 0) {
  !     fd = ap_slack (fd, AP_SLACK_HIGH);
  !     note_cleanups_for_fd (a, fd);
  !   }
      unblock_alarms();
      errno = save_errno;
      return fd;
  ***************
  *** 846,851 ****
  --- 848,854 ----
        desc = open(name, baseFlag | O_APPEND | O_CREAT,
    		S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
        if (desc >= 0) {
  +       desc = ap_slack(desc, AP_SLACK_LOW);
          fd = fdopen(desc, mode);
        }
      } else {
  
  
  
  1.99.2.1  +1 -0      apache/src/conf.h
  
  Index: conf.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/conf.h,v
  retrieving revision 1.99
  retrieving revision 1.99.2.1
  diff -C3 -r1.99 -r1.99.2.1
  *** conf.h	1997/06/04 07:03:11	1.99
  --- conf.h	1997/06/27 01:47:45	1.99.2.1
  ***************
  *** 73,78 ****
  --- 73,79 ----
    extern void GETPRIVMODE();
    extern void GETUSERMODE();
    extern char *inet_ntoa();
  + #define NO_SLACK
    
    #elif defined(SUNOS4)
    #define HAVE_GMTOFF
  
  
  
  1.49.2.1  +9 -3      apache/src/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.c,v
  retrieving revision 1.49
  retrieving revision 1.49.2.1
  diff -C3 -r1.49 -r1.49.2.1
  *** http_config.c	1997/05/15 23:39:20	1.49
  --- http_config.c	1997/06/27 01:47:45	1.49.2.1
  ***************
  *** 1077,1083 ****
    server_rec *read_config(pool *p, pool *ptemp, char *confname)
    {
        server_rec *s = init_server_config(p);
  -     module *m;
        
        init_config_globals(p);
        
  --- 1077,1082 ----
  ***************
  *** 1089,1100 ****
        
        fixup_virtual_hosts (p, s);
        
        for (m = top_module; m; m = m->next)
            if (m->init)
    	    (*m->init) (s, p);
  -     
  -     return s;
    }
    
    /********************************************************************
     * Configuration directives are restricted in terms of where they may
  --- 1088,1106 ----
        
        fixup_virtual_hosts (p, s);
        
  +     return s;
  + }
  +     
  + 
  + void init_modules(pool *p, server_rec *s)
  + {
  +     module *m;
  + 
        for (m = top_module; m; m = m->next)
            if (m->init)
    	    (*m->init) (s, p);
    }
  + 
    
    /********************************************************************
     * Configuration directives are restricted in terms of where they may
  
  
  
  1.29.2.1  +1 -0      apache/src/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.h,v
  retrieving revision 1.29
  retrieving revision 1.29.2.1
  diff -C3 -r1.29 -r1.29.2.1
  *** http_config.h	1997/05/27 04:41:49	1.29
  --- http_config.h	1997/06/27 01:47:45	1.29.2.1
  ***************
  *** 261,266 ****
  --- 261,267 ----
    /* For http_main.c... */
    
    server_rec *read_config (pool *conf_pool, pool *temp_pool, char *config_name);
  + void init_modules(pool *p, server_rec *s);
    void setup_prelinked_modules();
    void show_directives();
    void show_modules();
  
  
  
  1.149.2.1 +19 -14    apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.149
  retrieving revision 1.149.2.1
  diff -C3 -r1.149 -r1.149.2.1
  *** http_main.c	1997/05/29 04:50:27	1.149
  --- http_main.c	1997/06/27 01:47:46	1.149.2.1
  ***************
  *** 1981,1986 ****
  --- 1981,1988 ----
            exit(1);
        }
    
  +     s = ap_slack(s, AP_SLACK_HIGH);
  + 
        note_cleanups_for_fd(pconf, s); /* arrange to close on exec or restart */
        
    #ifndef MPE
  ***************
  *** 2135,2154 ****
    	ptrans = make_sub_pool (pconf);
    
    	server_conf = read_config (pconf, ptrans, server_confname); 
  - 	open_logs (server_conf, pconf);
  - 	set_group_privs ();
  - 	accept_mutex_init (pconf);
  - 	if (!is_graceful) {
  - 	    reinit_scoreboard(pconf);
  - 	}
  - #ifdef SCOREBOARD_FILE
  - 	else {
  - 	    scoreboard_fname = server_root_relative (pconf, scoreboard_fname);
  - 	    note_cleanups_for_fd (pconf, scoreboard_fd);
  - 	}
  - #endif
  - 
  - 	default_server_hostnames (server_conf);
    
    	if (listeners == NULL) {
    	    if (!is_graceful) {
  --- 2137,2142 ----
  ***************
  *** 2183,2188 ****
  --- 2171,2192 ----
    	    sd = -1;
    	}
    
  + 	init_modules (pconf, server_conf);
  + 	open_logs (server_conf, pconf);
  + 	set_group_privs ();
  + 	accept_mutex_init (pconf);
  + 	if (!is_graceful) {
  + 	    reinit_scoreboard(pconf);
  + 	}
  + #ifdef SCOREBOARD_FILE
  + 	else {
  + 	    scoreboard_fname = server_root_relative (pconf, scoreboard_fname);
  + 	    note_cleanups_for_fd (pconf, scoreboard_fd);
  + 	}
  + #endif
  + 
  + 	default_server_hostnames (server_conf);
  + 
    	set_signals ();
    	log_pid (pconf, pid_fname);
    
  ***************
  *** 2391,2396 ****
  --- 2395,2401 ----
    
        suexec_enabled = init_suexec();
        server_conf = read_config (pconf, ptrans, server_confname);
  +     init_modules (pconf, server_conf);
        
        if(standalone) {
            clear_pool (pconf);	/* standalone_main rereads... */
  
  
  
  1.111.2.1 +29 -0     apache/src/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/httpd.h,v
  retrieving revision 1.111
  retrieving revision 1.111.2.1
  diff -C3 -r1.111 -r1.111.2.1
  *** httpd.h	1997/06/05 22:53:27	1.111
  --- httpd.h	1997/06/27 01:47:47	1.111.2.1
  ***************
  *** 268,273 ****
  --- 268,274 ----
    #define DECLINED -1		/* Module declines to handle */
    #define OK 0			/* Module has handled this stage. */
    
  + 
    /* ----------------------- HTTP Status Codes  ------------------------- */
    
    #define RESPONSE_CODES 38
  ***************
  *** 711,713 ****
  --- 712,742 ----
    unsigned long get_virthost_addr (const char *hostname, unsigned short *port);
    
    extern time_t restart_time;
  + 
  + /*
  +  * Apache tries to keep all of its long term filehandles (such as log files,
  +  * and sockets) above this number.  This is to workaround problems in many
  +  * third party libraries that are compiled with a small FD_SETSIZE.  There
  +  * should be no reason to lower this, because it's only advisory.  If a file
  +  * can't be allocated above this number then it will remain in the "slack"
  +  * area.
  +  *
  +  * Only the low slack line is used by default.  If HIGH_SLACK_LINE is defined
  +  * then an attempt is also made to keep all non-FILE * files above the high
  +  * slack line.  This is to work around a Solaris C library limitation, where it
  +  * uses an unsigned char to store the file descriptor.
  +  */
  + #ifndef LOW_SLACK_LINE
  + #define LOW_SLACK_LINE	15
  + #endif
  + /* #define HIGH_SLACK_LINE	255 */
  + 
  + /*
  +  * The ap_slack() function takes a fd, and tries to move it above the indicated
  +  * line.  It returns an fd which may or may not have moved above the line, and
  +  * never fails.  If the high line was requested and it fails it will also try
  +  * the low line.
  +  */
  + int ap_slack (int fd, int line);
  + #define AP_SLACK_LOW	1
  + #define AP_SLACK_HIGH	2
  
  
  
  1.52.2.2  +27 -0     apache/src/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/util.c,v
  retrieving revision 1.52.2.1
  retrieving revision 1.52.2.2
  diff -C3 -r1.52.2.1 -r1.52.2.2
  *** util.c	1997/06/24 00:11:10	1.52.2.1
  --- util.c	1997/06/27 01:47:47	1.52.2.2
  ***************
  *** 1326,1328 ****
  --- 1326,1355 ----
        return (p);
    }
    #endif
  + 
  + 
  + int ap_slack (int fd, int line)
  + {
  + #if !defined(F_DUPFD) || defined(NO_SLACK)
  +     return fd;
  + #else
  +     int new_fd;
  + 
  + #ifdef HIGH_SLACK_LINE
  +     if (line == AP_SLACK_HIGH) {
  + 	new_fd = fcntl (fd, F_DUPFD, HIGH_SLACK_LINE);
  + 	if (new_fd != -1) {
  + 	    close (fd);
  + 	    return new_fd;
  + 	}
  +     }
  + #endif
  +     /* otherwise just assume line == AP_SLACK_LOW */
  +     new_fd = fcntl (fd, F_DUPFD, LOW_SLACK_LINE);
  +     if (new_fd == -1) {
  +       return fd;
  +     }
  +     close (fd);
  +     return new_fd;
  + #endif
  + }