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 http_core.c
Date Sat, 27 Jul 1996 13:25:06 GMT
ben         96/07/27 06:25:06

  Modified:    src       http_core.c
  Log:
  Makes setrlimit stuff burn less memory, and also tidies it up some more.
  
  Revision  Changes    Path
  1.22      +23 -19    apache/src/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_core.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -C3 -r1.21 -r1.22
  *** http_core.c	1996/07/27 13:08:29	1.21
  --- http_core.c	1996/07/27 13:25:05	1.22
  ***************
  *** 95,118 ****
        conf->do_rfc1413 = DEFAULT_RFC1413 | 2;  /* set bit 1 to indicate default */
    
    #ifdef RLIMIT_CPU
  !     conf->limit_cpu = (struct rlimit *) pcalloc (a, sizeof (struct rlimit));
  !     if ((getrlimit(RLIMIT_CPU, conf->limit_cpu)) != 0)
  ! 	conf->limit_cpu = NULL;
    #endif
  ! #ifdef RLIMIT_DATA
  !     conf->limit_mem = (struct rlimit *) pcalloc (a, sizeof (struct rlimit));
  !     if ((getrlimit(RLIMIT_DATA, conf->limit_mem)) != 0)
  ! 	conf->limit_mem = NULL;
  ! #endif
  ! #ifdef RLIMIT_VMEM
  !     conf->limit_mem = (struct rlimit *) pcalloc (a, sizeof (struct rlimit));
  !     if ((getrlimit(RLIMIT_VMEM, conf->limit_mem)) != 0)
  ! 	conf->limit_mem = NULL;
    #endif
    #ifdef RLIMIT_NPROC
  !     conf->limit_nproc = (struct rlimit *) pcalloc (a, sizeof (struct rlimit));
  !     if ((getrlimit(RLIMIT_NPROC, conf->limit_nproc)) != 0)
  ! 	conf->limit_nproc = NULL;
    #endif
    
        conf->sec = make_array (a, 2, sizeof(void *));
  --- 95,107 ----
        conf->do_rfc1413 = DEFAULT_RFC1413 | 2;  /* set bit 1 to indicate default */
    
    #ifdef RLIMIT_CPU
  !     conf->limit_cpu = NULL;
    #endif
  ! #if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
  !     conf->limit_mem = NULL;
    #endif
    #ifdef RLIMIT_NPROC
  !     conf->limit_nproc = NULL;
    #endif
    
        conf->sec = make_array (a, 2, sizeof(void *));
  ***************
  *** 839,851 ****
        return NULL;
    }
    
  ! static void set_rlimit(cmd_parms *cmd, struct rlimit *limit, char *arg)
    {
        char *str;
        /* If your platform doesn't define rlim_t then typedef it in conf.h */
        rlim_t cur = 0;
        rlim_t max = 0;
    
        if ((str = getword_conf(cmd->pool, &arg)))
    	if (!strcasecmp(str, "max"))
    	    cur = limit->rlim_max;
  --- 828,851 ----
        return NULL;
    }
    
  ! static void set_rlimit(cmd_parms *cmd, struct rlimit **plimit, char *arg,
  ! 		       int type)
    {
        char *str;
  +     struct rlimit *limit;
        /* If your platform doesn't define rlim_t then typedef it in conf.h */
        rlim_t cur = 0;
        rlim_t max = 0;
    
  +     *plimit=(struct rlimit *)pcalloc(cmd->pool,sizeof **plimit);
  +     limit=*plimit;
  +     if ((getrlimit(type, limit)) != 0)
  + 	{
  + 	*plimit = NULL;
  + 	log_unixerr("getrlimit",cmd->cmd->name,"failed",cmd->server);
  + 	return;
  + 	}
  + 
        if ((str = getword_conf(cmd->pool, &arg)))
    	if (!strcasecmp(str, "max"))
    	    cur = limit->rlim_max;
  ***************
  *** 884,890 ****
    #ifdef RLIMIT_CPU
    char *set_limit_cpu (cmd_parms *cmd, core_dir_config *conf, char *arg)
    {
  !     set_rlimit(cmd,conf->limit_cpu,arg);
        return NULL;
    }
    #endif
  --- 884,890 ----
    #ifdef RLIMIT_CPU
    char *set_limit_cpu (cmd_parms *cmd, core_dir_config *conf, char *arg)
    {
  !     set_rlimit(cmd,&conf->limit_cpu,arg,RLIMIT_CPU);
        return NULL;
    }
    #endif
  ***************
  *** 892,898 ****
    #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM)
    char *set_limit_mem (cmd_parms *cmd, core_dir_config *conf, char *arg)
    {
  !     set_rlimit(cmd,conf->limit_mem,arg);
        return NULL;
    }
    #endif
  --- 892,902 ----
    #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM)
    char *set_limit_mem (cmd_parms *cmd, core_dir_config *conf, char *arg)
    {
  ! #ifdef RLIMIT_DATA
  !     set_rlimit(cmd,&conf->limit_mem,arg,RLIMIT_DATA);
  ! #else
  !     set_rlimit(cmd,&conf->limit_mem,arg,RLIMIT_VMEM);
  ! #endif
        return NULL;
    }
    #endif
  ***************
  *** 900,906 ****
    #ifdef RLIMIT_NPROC
    char *set_limit_nproc (cmd_parms *cmd, core_dir_config *conf, char *arg)
    {
  !     set_rlimit(cmd,conf->limit_nproc,arg);
        return NULL;
    }
    #endif
  --- 904,910 ----
    #ifdef RLIMIT_NPROC
    char *set_limit_nproc (cmd_parms *cmd, core_dir_config *conf, char *arg)
    {
  !     set_rlimit(cmd,&conf->limit_nproc,arg,RLIMIT_NPROC);
        return NULL;
    }
    #endif
  
  
  

Mime
View raw message