dgaudet     98/02/20 17:42:41

  Modified:    src/include conf.h http_core.h
               src/main http_core.c util_script.c
  Log:
  RLIMIT_AS is part of Single Unix... and presumably posix as well.  So it
  makes sense to support it everywhere rather than just on Linux.  So treat
  it like RLIMIT_VMEM and RLIMIT_DATA.
  
  Revision  Changes    Path
  1.182     +0 -7      apache-1.3/src/include/conf.h
  
  Index: conf.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/conf.h,v
  retrieving revision 1.181
  retrieving revision 1.182
  diff -u -r1.181 -r1.182
  --- conf.h    1998/02/18 20:52:55     1.181
  +++ conf.h    1998/02/21 01:42:36     1.182
  @@ -372,13 +372,6 @@
   typedef int rlim_t;
   #endif
   
  -/* Linux 2.0 and above implement the new posix RLIMIT_AS rather than the
  - * older BSD semantics (some would actually call this a bug, like me -djg).
  - */
  -#ifndef RLIMIT_VMEM
  -#define RLIMIT_VMEM RLIMIT_AS
  -#endif
  -
   /* flock is faster ... but hasn't been tested on 1.x systems */
   #define USE_FLOCK_SERIALIZED_ACCEPT
   
  
  
  
  1.36      +1 -1      apache-1.3/src/include/http_core.h
  
  Index: http_core.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/http_core.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- http_core.h       1998/02/02 19:46:55     1.35
  +++ http_core.h       1998/02/21 01:42:36     1.36
  @@ -202,7 +202,7 @@
   #ifdef RLIMIT_CPU
       struct rlimit *limit_cpu;
   #endif
  -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM)
  +#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
       struct rlimit *limit_mem;
   #endif
   #ifdef RLIMIT_NPROC
  
  
  
  1.162     +10 -8     apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -u -r1.161 -r1.162
  --- http_core.c       1998/02/20 10:51:34     1.161
  +++ http_core.c       1998/02/21 01:42:39     1.162
  @@ -127,7 +127,7 @@
   #ifdef RLIMIT_CPU
       conf->limit_cpu = NULL;
   #endif
  -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
  +#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
       conf->limit_mem = NULL;
   #endif
   #ifdef RLIMIT_NPROC
  @@ -207,7 +207,7 @@
   #ifdef RLIMIT_CPU
       if (new->limit_cpu) conf->limit_cpu = new->limit_cpu;
   #endif
  -#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
  +#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
       if (new->limit_mem) conf->limit_mem = new->limit_mem;
   #endif
   #ifdef RLIMIT_NPROC    
  @@ -1560,7 +1560,7 @@
   }
   
   
  -#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || 
defined(RLIMIT_NPROC)
  +#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || 
defined(RLIMIT_NPROC) || defined(RLIMIT_AS)
   static void set_rlimit(cmd_parms *cmd, struct rlimit **plimit, const char 
*arg,
                          const char * arg2, int type)
   {
  @@ -1612,7 +1612,7 @@
   }
   #endif
   
  -#if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined 
(RLIMIT_VMEM)) || !defined (RLIMIT_NPROC)
  +#if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined 
(RLIMIT_VMEM) || defined(RLIMIT_AS)) || !defined (RLIMIT_NPROC)
   static const char *no_set_limit (cmd_parms *cmd, core_dir_config *conf,
                                 char *arg, char *arg2)
   {
  @@ -1630,12 +1630,14 @@
   }
   #endif
   
  -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM)
  +#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
   const char *set_limit_mem (cmd_parms *cmd, core_dir_config *conf, char *arg, 
char * arg2)
   {
  -#ifdef RLIMIT_DATA
  +#if defined(RLIMIT_AS)
  +    set_rlimit(cmd,&conf->limit_mem,arg,arg2,RLIMIT_AS);
  +#elif defined(RLIMIT_DATA)
       set_rlimit(cmd,&conf->limit_mem,arg,arg2,RLIMIT_DATA);
  -#else
  +#else defined(RLIMIT_VMEM)
       set_rlimit(cmd,&conf->limit_mem,arg,arg2,RLIMIT_VMEM);
   #endif
       return NULL;
  @@ -1898,7 +1900,7 @@
   #endif
         OR_ALL, TAKE12, "soft/hard limits for max CPU usage in seconds" },
   { "RLimitMEM",
  -#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM)
  +#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined (RLIMIT_AS)
    set_limit_mem, (void*)XtOffsetOf(core_dir_config, limit_mem),
   #else
    no_set_limit, NULL,
  
  
  
  1.95      +10 -6     apache-1.3/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util_script.c,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- util_script.c     1998/02/01 22:05:38     1.94
  +++ util_script.c     1998/02/21 01:42:40     1.95
  @@ -589,7 +589,7 @@
   {
       int pid = 0;
   #if defined(RLIMIT_CPU)  || defined(RLIMIT_NPROC) || \
  -    defined(RLIMIT_DATA) || defined(RLIMIT_VMEM)
  +    defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
   
       core_dir_config *conf =
       (core_dir_config *) get_module_config(r->per_dir_config, &core_module);
  @@ -614,17 +614,21 @@
            aplog_error(APLOG_MARK, APLOG_ERR, r->server,
                        "setrlimit: failed to set process limit");
   #endif
  -#ifdef RLIMIT_DATA
  +#if defined(RLIMIT_AS)
  +    if (conf->limit_mem != NULL)
  +     if ((setrlimit(RLIMIT_AS, conf->limit_mem)) != 0)
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "setrlimit(RLIMIT_AS): failed to set memory usage 
limit");
  +#elif defined(RLIMIT_DATA)
       if (conf->limit_mem != NULL)
        if ((setrlimit(RLIMIT_DATA, conf->limit_mem)) != 0)
            aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  -                     "setrlimit: failed to set memory usage limit");
  -#endif
  -#ifdef RLIMIT_VMEM
  +                     "setrlimit(RLIMIT_DATA): failed to set memory usage 
limit");
  +#elif defined(RLIMIT_VMEM)
       if (conf->limit_mem != NULL)
        if ((setrlimit(RLIMIT_VMEM, conf->limit_mem)) != 0)
            aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  -                     "setrlimit: failed to set memory usage limit");
  +                     "setrlimit(RLIMIT_VMEM): failed to set memory usage 
limit");
   #endif
   
   #ifdef __EMX__
  
  
  

Reply via email to