httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgau...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/standard mod_dir.c mod_include.c mod_negotiation.c
Date Wed, 26 Jul 2000 01:56:04 GMT
dgaudet     00/07/25 18:56:04

  Modified:    src      CHANGES
               src/lib/apr/include apr_pools.h
               src/lib/apr/lib apr_pools.c
               src/lib/apr/tables apr_tables.c
               src/modules/standard mod_dir.c mod_include.c
                        mod_negotiation.c
  Log:
  - fix POOL_DEBUG ... restored the ap_pool_joins that dreid removed.
  - removed the apr_abort foo since every caller was passing it NULL anyway;
    and this is debugging code, so i don't have any qualms about using
    stderr or abort().
  
  Revision  Changes    Path
  1.179     +3 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.178
  retrieving revision 1.179
  diff -u -r1.178 -r1.179
  --- CHANGES	2000/07/25 01:06:25	1.178
  +++ CHANGES	2000/07/26 01:55:59	1.179
  @@ -1,4 +1,7 @@
   Changes with Apache 2.0a5
  +
  +  *) Fix POOL_DEBUG (at least for prefork mpm). [Dean Gaudet]
  +
     *) Added the APR_EOL_STR macro for platform dependent differences in 
        logfiles and other raw text (such as all APR files).  Fixes logfiles
        not terminated with cr/lf sequences in Win32.  [William Rowe]
  
  
  
  1.27      +44 -6     apache-2.0/src/lib/apr/include/apr_pools.h
  
  Index: apr_pools.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_pools.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- apr_pools.h	2000/07/23 16:49:19	1.26
  +++ apr_pools.h	2000/07/26 01:56:00	1.27
  @@ -108,15 +108,53 @@
       struct process_chain *next;
   };
   
  -/* used to guarantee to the ap_pool_t debugging code that the sub ap_pool_t 
  - * will not be destroyed before the parent pool
  +/* pools have nested lifetimes -- sub_pools are destroyed when the
  + * parent pool is cleared.  We allow certain liberties with operations
  + * on things such as tables (and on other structures in a more general
  + * sense) where we allow the caller to insert values into a table which
  + * were not allocated from the table's pool.  The table's data will
  + * remain valid as long as all the pools from which its values are
  + * allocated remain valid.
  + *
  + * For example, if B is a sub pool of A, and you build a table T in
  + * pool B, then it's safe to insert data allocated in A or B into T
  + * (because B lives at most as long as A does, and T is destroyed when
  + * B is cleared/destroyed).  On the other hand, if S is a table in
  + * pool A, it is safe to insert data allocated in A into S, but it
  + * is *not safe* to insert data allocated from B into S... because
  + * B can be cleared/destroyed before A is (which would leave dangling
  + * pointers in T's data structures).
  + *
  + * In general we say that it is safe to insert data into a table T
  + * if the data is allocated in any ancestor of T's pool.  This is the
  + * basis on which the POOL_DEBUG code works -- it tests these ancestor
  + * relationships for all data inserted into tables.  POOL_DEBUG also
  + * provides tools (ap_find_pool, and ap_pool_is_ancestor) for other
  + * folks to implement similar restrictions for their own data
  + * structures.
  + *
  + * However, sometimes this ancestor requirement is inconvenient --
  + * sometimes we're forced to create a sub pool (such as through
  + * ap_sub_req_lookup_uri), and the sub pool is guaranteed to have
  + * the same lifetime as the parent pool.  This is a guarantee implemented
  + * by the *caller*, not by the pool code.  That is, the caller guarantees
  + * they won't destroy the sub pool individually prior to destroying the
  + * parent pool.
  + *
  + * In this case the caller must call ap_pool_join() to indicate this
  + * guarantee to the POOL_DEBUG code.  There are a few examples spread
  + * through the standard modules.
    */
   #ifndef POOL_DEBUG
  -APR_EXPORT(ap_pool_t *) ap_find_pool(const void *ts);
  +#ifdef ap_pool_join
  +#undef ap_pool_join
  +#endif
  +#define ap_pool_join(a,b)
   #else
  -APR_EXPORT(int) ap_pool_join(ap_pool_t *p, ap_pool_t *sub, int (*apr_abort)(int retcode));
  -APR_EXPORT(ap_pool_t *) ap_find_pool(const void *ts, int (*apr_abort)(int retcode));
  -#endif /* POOL_DEBUG */
  +APR_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub);
  +APR_EXPORT(ap_pool_t *) ap_find_pool(const void *ts);
  +APR_EXPORT(int) ap_pool_is_ancestor(ap_pool_t *a, ap_pool_t *b);
  +#endif
   
   #ifdef ULTRIX_BRAIN_DEATH
   #define ap_fdopen(d,m) fdopen((d), (char *)(m))
  
  
  
  1.65      +13 -11    apache-2.0/src/lib/apr/lib/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- apr_pools.c	2000/07/21 19:50:42	1.64
  +++ apr_pools.c	2000/07/26 01:56:00	1.65
  @@ -762,8 +762,7 @@
   /* Find the pool that ts belongs to, return NULL if it doesn't
    * belong to any pool.
    */
  -APR_EXPORT(ap_pool_t *) ap_find_pool(const void *ts,
  -                                     int (*apr_abort)(int retcode))
  +APR_EXPORT(ap_pool_t *) ap_find_pool(const void *ts)
   {
       const char *s = ts;
       union block_hdr **pb;
  @@ -776,16 +775,18 @@
       /* consider stuff on the stack to also be in the NULL pool...
        * XXX: there's cases where we don't want to assume this
        */
  -    APR_ABORT((stack_direction == -1 && 
  -              is_ptr_in_range(s, &ts, known_stack_point)) || 
  -              (stack_direction == 1 &&    
  -              is_ptr_in_range(s, known_stack_point, &ts)), 1, apr_abort,
  -              "Ouch!  find_pool() called on pointer in a free block\n");
  +    if ((stack_direction == -1 && is_ptr_in_range(s, &ts, known_stack_point))
  +	|| (stack_direction == 1 && is_ptr_in_range(s, known_stack_point, &ts))) {
  +	abort();
  +	return NULL;
  +    }
       /* search the global_block_list */
       for (pb = &global_block_list; *pb; pb = &b->h.global_next) {
   	b = *pb;
   	if (is_ptr_in_range(s, b, b->h.endp)) {
   	    if (b->h.owning_pool == FREE_POOL) {
  +		fprintf(stderr,
  +		    "Ouch!  find_pool() called on pointer in a free block\n");
   		abort();
   		exit(1);
   	    }
  @@ -829,14 +830,15 @@
    * instead.  This is a guarantee by the caller that sub will not
    * be destroyed before p is.
    */
  -APR_EXPORT(int) ap_pool_join(ap_pool_t *p, ap_pool_t *sub, 
  -                             int (*apr_abort)(int retcode))
  +APR_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub)
   {
       union block_hdr *b;
   
       /* We could handle more general cases... but this is it for now. */
  -    APR_ABORT(sub->parent != p, 1, apr_abort,
  -              "pool_join: p is not a parent of sub\n");
  +    if (sub->parent != p) {
  +	fprintf(stderr, "pool_join: p is not parent of sub\n");
  +	abort();
  +    }
       while (p->joined) {
   	p = p->joined;
       }
  
  
  
  1.2       +6 -6      apache-2.0/src/lib/apr/tables/apr_tables.c
  
  Index: apr_tables.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/tables/apr_tables.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apr_tables.c	2000/07/24 23:28:08	1.1
  +++ apr_tables.c	2000/07/26 01:56:02	1.2
  @@ -390,11 +390,11 @@
   
   #ifdef POOL_DEBUG
       {
  -	if (!ap_pool_is_ancestor(ap_find_pool(key, NULL), t->a.cont)) {
  +	if (!ap_pool_is_ancestor(ap_find_pool(key), t->a.cont)) {
   	    fprintf(stderr, "table_set: key not in ancestor pool of t\n");
   	    abort();
   	}
  -	if (!ap_pool_is_ancestor(ap_find_pool(val, NULL), t->a.cont)) {
  +	if (!ap_pool_is_ancestor(ap_find_pool(val), t->a.cont)) {
   	    fprintf(stderr, "table_set: val not in ancestor pool of t\n");
   	    abort();
   	}
  @@ -479,11 +479,11 @@
   
   #ifdef POOL_DEBUG
       {
  -	if (!ap_pool_is_ancestor(ap_find_pool(key, NULL), t->a.cont)) {
  +	if (!ap_pool_is_ancestor(ap_find_pool(key), t->a.cont)) {
   	    fprintf(stderr, "table_set: key not in ancestor pool of t\n");
   	    abort();
   	}
  -	if (!ap_pool_is_ancestor(ap_find_pool(val, NULL), t->a.cont)) {
  +	if (!ap_pool_is_ancestor(ap_find_pool(val), t->a.cont)) {
   	    fprintf(stderr, "table_set: key not in ancestor pool of t\n");
   	    abort();
   	}
  @@ -519,11 +519,11 @@
   
   #ifdef POOL_DEBUG
       {
  -	if (!ap_pool_is_ancestor(ap_find_pool(key, NULL), t->a.cont)) {
  +	if (!ap_pool_is_ancestor(ap_find_pool(key), t->a.cont)) {
   	    fprintf(stderr, "table_set: key not in ancestor pool of t\n");
   	    abort();
   	}
  -	if (!ap_pool_is_ancestor(ap_find_pool(val, NULL), t->a.cont)) {
  +	if (!ap_pool_is_ancestor(ap_find_pool(val), t->a.cont)) {
   	    fprintf(stderr, "table_set: key not in ancestor pool of t\n");
   	    abort();
   	}
  
  
  
  1.17      +1 -0      apache-2.0/src/modules/standard/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_dir.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_dir.c	2000/07/21 19:50:53	1.16
  +++ mod_dir.c	2000/07/26 01:56:02	1.17
  @@ -181,6 +181,7 @@
           if (ap_is_HTTP_REDIRECT(rr->status) ||
               (rr->status == HTTP_NOT_ACCEPTABLE && num_names == 1)) {
   
  +            ap_pool_join(r->pool, rr->pool);
               error_notfound = rr->status;
               r->notes = ap_overlay_tables(r->pool, r->notes, rr->notes);
               r->headers_out = ap_overlay_tables(r->pool, r->headers_out,
  
  
  
  1.47      +1 -0      apache-2.0/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- mod_include.c	2000/07/21 19:50:54	1.46
  +++ mod_include.c	2000/07/26 01:56:02	1.47
  @@ -2451,6 +2451,7 @@
   	 * destroyed, that's dealt with in handle_include().
   	 */
   	r->subprocess_env = parent->subprocess_env;
  +	ap_pool_join(parent->pool, r->pool);
   	r->finfo.mtime = parent->finfo.mtime;
       }
       else {
  
  
  
  1.36      +1 -0      apache-2.0/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- mod_negotiation.c	2000/07/21 19:50:54	1.35
  +++ mod_negotiation.c	2000/07/26 01:56:02	1.36
  @@ -2648,6 +2648,7 @@
        * some values in this request will be allocated in r->pool, and others in
        * sub_req->pool.
        */
  +    ap_pool_join(r->pool, sub_req->pool);
       r->mtime = 0; /* reset etag info for subrequest */
       r->filename = sub_req->filename;
       r->handler = sub_req->handler;
  
  
  

Mime
View raw message