httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <di...@elect6.jrc.it>
Subject fundamentally wrong forking prior to garbage collection in proxy/
Date Wed, 26 Nov 1997 15:59:18 GMT

Forking off the garbage collecting child in the proxy.

Anything fundamentally wrong with this quick and dirty hack, it
does seem to work and my my employer happy. But it seems to
crude to me.

Dw.

diff -c3 -r apache_1.2.4/src/modules/proxy/proxy_cache.c
apache_1.2.4-work/src/modules/proxy/proxy_cache.c
*** apache_1.2.4/src/modules/proxy/proxy_cache.c        Fri Aug 15
19:08:55 1997
--- apache_1.2.4-work/src/modules/proxy/proxy_cache.c   Wed Nov 26
16:48:07 1997
***************
*** 88,94 ****
  static int sub_garbage_coll(request_rec *r,array_header *files,
                            const char *cachedir,const char *cachesubdir);
  
! void proxy_garbage_coll(request_rec *r)
      {
      const char *cachedir;
      void *sconf = r->server->module_config;
--- 88,112 ----
  static int sub_garbage_coll(request_rec *r,array_header *files,
                            const char *cachedir,const char *cachesubdir);
  
! void _proxy_garbage_coll(request_rec *r);
! 
! void proxy_garbage_coll(request_rec *r) {
! 
!     pid_t chld = fork();
!  
!     /* parent return.. */
!     if ( chld > 0 )
!       return;
!     
!     _proxy_garbage_coll(r);
! 
!     if (chld == 0) /* only true children exit */
!       exit(0);
! 
!     return; /* but return if we did not fork OK */
! 
! }
! 
! void _proxy_garbage_coll(request_rec *r)
      {
      const char *cachedir;
      void *sconf = r->server->module_config;
***************
*** 101,106 ****
--- 119,129 ----
      int i, timefd;
      static time_t lastcheck=BAD_DATE;  /* static data!!! */
  
+     pid_t chld = fork();
+ 
+     if (chld > 0) 
+       return;
+    
      cachedir = conf->root;
      cachesize = conf->space;
      every = conf->gcinterval;


http://cils.ceo.org                         http://enrm.ceo.org
dirkx@technologist.com                     Dirk.vanGulik@jrc.it
+39 332 78 0014       +39 332 78 9549       fax +39 332 78 9185
ISEI/ESBA;                     The Center For Earth Observation
Joint Research Centre of the European Communities, Ispra, Italy


Mime
View raw message