httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <di...@webweaving.org>
Subject Simple cut at exit's
Date Fri, 12 Mar 1999 10:09:35 GMT
I.e. simple first cut at exit codes for init and exit. Actually, looking
at it again; it is a bigger change than I thoughd; it requires even an
API  version increment, perhaps not something to rush into. On the
other hand; it does allow things like mod_mime_magic and mod_rewrite
to really pull the plug when there is a showstopper failure during
init. Which is kind of useful. Any Comments ?

Dw.

Index: src/include/http_config.h
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/include/http_config.h,v
retrieving revision 1.100
diff -u -c -3 -r1.100 http_config.h
*** http_config.h	1999/01/06 19:14:51	1.100
--- http_config.h	1999/03/12 00:42:55
***************
*** 213,225 ****
       * and create_dir_config are called.
       */
  #ifdef ULTRIX_BRAIN_DEATH
!     void (*init) ();
      void *(*create_dir_config) ();
      void *(*merge_dir_config) ();
      void *(*create_server_config) ();
      void *(*merge_server_config) ();
  #else
!     void (*init) (server_rec *, pool *);
      void *(*create_dir_config) (pool *p, char *dir);
      void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf);
      void *(*create_server_config) (pool *p, server_rec *s);
--- 213,225 ----
       * and create_dir_config are called.
       */
  #ifdef ULTRIX_BRAIN_DEATH
!     int (*init) ();
      void *(*create_dir_config) ();
      void *(*merge_dir_config) ();
      void *(*create_server_config) ();
      void *(*merge_server_config) ();
  #else
!     int (*init) (server_rec *, pool *);
      void *(*create_dir_config) (pool *p, char *dir);
      void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf);
      void *(*create_server_config) (pool *p, server_rec *s);
***************
*** 266,276 ****
       * init method above.
       */
  #ifdef ULTRIX_BRAIN_DEATH
!     void (*child_init) ();
!     void (*child_exit) ();
  #else
!     void (*child_init) (server_rec *, pool *);
!     void (*child_exit) (server_rec *, pool *);
  #endif
      int (*post_read_request) (request_rec *);
  } module;
--- 266,276 ----
       * init method above.
       */
  #ifdef ULTRIX_BRAIN_DEATH
!     int (*child_init) ();
!     int (*child_exit) ();
  #else
!     int (*child_init) (server_rec *, pool *);
!     int (*child_exit) (server_rec *, pool *);
  #endif
      int (*post_read_request) (request_rec *);
  } module;
***************
*** 350,357 ****
  
  server_rec *ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name);
  void ap_init_modules(pool *p, server_rec *s);
! void ap_child_init_modules(pool *p, server_rec *s);
! void ap_child_exit_modules(pool *p, server_rec *s);
  void ap_setup_prelinked_modules(void);
  void ap_show_directives(void);
  void ap_show_modules(void);
--- 350,357 ----
  
  server_rec *ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name);
  void ap_init_modules(pool *p, server_rec *s);
! int ap_child_init_modules(pool *p, server_rec *s);
! int ap_child_exit_modules(pool *p, server_rec *s);
  void ap_setup_prelinked_modules(void);
  void ap_show_directives(void);
  void ap_show_modules(void);
Index: src/main/http_config.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/main/http_config.c,v
retrieving revision 1.142
diff -u -c -3 -r1.142 http_config.c
*** http_config.c	1999/02/22 17:07:39	1.142
--- http_config.c	1999/03/12 00:43:35
***************
*** 1505,1528 ****
      module *m;
  
      for (m = top_module; m; m = m->next)
! 	if (m->init)
! 	    (*m->init) (s, p);
      build_method_shortcuts();
      init_handlers(p);
  }
  
! void ap_child_init_modules(pool *p, server_rec *s)
  {
      module *m;
  
!     for (m = top_module; m; m = m->next)
! 	if (m->child_init)
! 	    (*m->child_init) (s, p);
  }
  
! void ap_child_exit_modules(pool *p, server_rec *s)
  {
      module *m;
  
  #ifdef SIGHUP
      signal(SIGHUP, SIG_IGN);
--- 1505,1544 ----
      module *m;
  
      for (m = top_module; m; m = m->next)
! 	if (m->init) {
! 	    int r = (*m->init) (s, p);
! 	    if (r != OK || r != DECLINED) {
! 		/* much the same as AddModule et.al. failures. We can
! 		 * do little more that printing something on stderr.
! 		 */
! 		fprintf(stderr,"Failed to initialize %s\n", m->name);
! 		exit(r);
! 	    }
! 	};
! 	    		
      build_method_shortcuts();
      init_handlers(p);
  }
  
! int ap_child_init_modules(pool *p, server_rec *s)
  {
      module *m;
+     int res = DECLINED;
  
!     for (m = top_module; m && ( res == OK || res == DECLINED ); m = m->next)
! 	if (m->child_init) {
! 	    int r =(*m->child_init) (s, p);
! 	    if (r != DECLINED) 
! 		res = r;
! 	    };
! 
!     return res;
  }
  
! int ap_child_exit_modules(pool *p, server_rec *s)
  {
      module *m;
+     int res = DECLINED;
  
  #ifdef SIGHUP
      signal(SIGHUP, SIG_IGN);
***************
*** 1531,1540 ****
      signal(SIGUSR1, SIG_IGN);
  #endif
  
!     for (m = top_module; m; m = m->next)
! 	if (m->child_exit)
! 	    (*m->child_exit) (s, p);
  
  }
  
  /********************************************************************
--- 1547,1560 ----
      signal(SIGUSR1, SIG_IGN);
  #endif
  
!     for (m = top_module; m && ( res == OK || res == DECLINED ); m = m->next)
! 	if (m->child_exit) {
! 	    int r =(*m->child_exit) (s, p);
! 	    if (r != DECLINED) 
! 		res = r;
! 	    };
  
+     return res;
  }
  
  /********************************************************************
Index: src/main/http_main.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.424
diff -u -c -3 -r1.424 http_main.c
*** http_main.c	1999/02/22 16:50:25	1.424
--- http_main.c	1999/03/12 00:44:13
***************
*** 456,462 ****
  static void clean_child_exit(int code)
  {
      if (pchild) {
! 	ap_child_exit_modules(pchild, server_conf);
  	ap_destroy_pool(pchild);
      }
      chdir_for_gprof();
--- 456,464 ----
  static void clean_child_exit(int code)
  {
      if (pchild) {
! 	int r = ap_child_exit_modules(pchild, server_conf);
! 	if ((r != OK) && ( r != DECLINED) && (code))
! 	    code = r;
  	ap_destroy_pool(pchild);
      }
      chdir_for_gprof();
***************
*** 3516,3521 ****
--- 3518,3524 ----
      struct sockaddr sa_server;
      struct sockaddr sa_client;
      listen_rec *lr;
+     int res;
  
      /* All of initialization is a critical section, we don't care if we're
       * told to HUP or USR1 before we're done initializing.  For example,
***************
*** 3570,3576 ****
      }
  #endif
  
!     ap_child_init_modules(pchild, server_conf);
  
      /* done with the initialization critical section */
      ap_unblock_alarms();
--- 3573,3581 ----
      }
  #endif
  
!     res = ap_child_init_modules(pchild, server_conf);
!     if(res != OK && res != DECLINED)
! 	clean_child_exit(res);
  
      /* done with the initialization critical section */
      ap_unblock_alarms();
***************
*** 5162,5167 ****
--- 5167,5173 ----
      HANDLE hObjects[2];
      int count_select_errors = 0;
      pool *pchild;
+     int code, res;
  
      pchild = ap_make_sub_pool(pconf);
  
***************
*** 5227,5232 ****
--- 5233,5247 ----
  	cleanup_scoreboard();
  	exit(0);
      }
+     res = ap_child_init_modules(pchild, server_conf);
+     if(res != OK && res != DECLINED) {
+ 	signal_parent(0);	/* tell parent to die */
+ 
+ 	ap_destroy_pool(pchild);
+ 	cleanup_scoreboard();
+ 	exit(code);
+     }
+ 
      set_signals();
  
      /*
***************
*** 5243,5250 ****
       * - Exit
       */
  
-     ap_child_init_modules(pconf, server_conf);
- 
      allowed_globals.jobsemaphore = create_semaphore(0);
      allowed_globals.jobmutex = ap_create_mutex(NULL);
  
--- 5258,5263 ----
***************
*** 5410,5423 ****
  #endif
      destroy_semaphore(allowed_globals.jobsemaphore);
      ap_destroy_mutex(allowed_globals.jobmutex);
  
-     ap_child_exit_modules(pconf, server_conf);
      ap_destroy_pool(pchild);
  
      cleanup_scoreboard();
  
      APD2("process PID %d exited", my_pid);
!     clean_parent_exit(0);
  }				/* standalone_main */
  
  /*
--- 5423,5439 ----
  #endif
      destroy_semaphore(allowed_globals.jobsemaphore);
      ap_destroy_mutex(allowed_globals.jobmutex);
+ 
+     res = ap_child_exit_modules(pconf, server_conf);
+     if (res != OK && res != DECLINED && code == 0)
+ 	code = res;
  
      ap_destroy_pool(pchild);
  
      cleanup_scoreboard();
  
      APD2("process PID %d exited", my_pid);
!     clean_parent_exit(code);
  }				/* standalone_main */
  
  /*
Index: src/modules/example/mod_example.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/example/mod_example.c,v
retrieving revision 1.33
diff -u -c -3 -r1.33 mod_example.c
*** mod_example.c	1999/01/01 19:05:00	1.33
--- mod_example.c	1999/03/12 00:45:00
***************
*** 629,635 ****
  /*
   * All our module-initialiser does is add its trace to the log.
   */
! static void example_init(server_rec *s, pool *p)
  {
  
      char *note;
--- 629,635 ----
  /*
   * All our module-initialiser does is add its trace to the log.
   */
! static int example_init(server_rec *s, pool *p)
  {
  
      char *note;
***************
*** 646,651 ****
--- 646,653 ----
      sname = (sname != NULL) ? sname : "";
      note = ap_pstrcat(p, "example_init(", sname, ")", NULL);
      trace_add(s, NULL, NULL, note);
+ 
+     return(OK);
  }
  
  /* 
***************
*** 660,666 ****
  /*
   * All our process-initialiser does is add its trace to the log.
   */
! static void example_child_init(server_rec *s, pool *p)
  {
  
      char *note;
--- 662,668 ----
  /*
   * All our process-initialiser does is add its trace to the log.
   */
! static int example_child_init(server_rec *s, pool *p)
  {
  
      char *note;
***************
*** 677,682 ****
--- 679,686 ----
      sname = (sname != NULL) ? sname : "";
      note = ap_pstrcat(p, "example_child_init(", sname, ")", NULL);
      trace_add(s, NULL, NULL, note);
+    
+     return OK;
  }
  
  /* 
***************
*** 691,697 ****
  /*
   * All our process-death routine does is add its trace to the log.
   */
! static void example_child_exit(server_rec *s, pool *p)
  {
  
      char *note;
--- 695,701 ----
  /*
   * All our process-death routine does is add its trace to the log.
   */
! static int example_child_exit(server_rec *s, pool *p)
  {
  
      char *note;
***************
*** 704,709 ****
--- 708,715 ----
      sname = (sname != NULL) ? sname : "";
      note = ap_pstrcat(p, "example_child_exit(", sname, ")", NULL);
      trace_add(s, NULL, NULL, note);
+ 
+     return OK;
  }
  
  /*
Index: src/modules/experimental/mod_mmap_static.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/experimental/mod_mmap_static.c,v
retrieving revision 1.9
diff -u -c -3 -r1.9 mod_mmap_static.c
*** mod_mmap_static.c	1999/01/01 19:05:01	1.9
--- mod_mmap_static.c	1999/03/12 00:45:02
***************
*** 241,247 ****
      return c;
  }
  
! static void mmap_init(server_rec *s, pool *p)
  {
      a_server_config *sconf;
      array_header *inodes;
--- 241,247 ----
      return c;
  }
  
! static int mmap_init(server_rec *s, pool *p)
  {
      a_server_config *sconf;
      array_header *inodes;
***************
*** 267,272 ****
--- 267,273 ----
      for (s = s->next; s; s = s->next) {
  	ap_set_module_config(s->module_config, &mmap_static_module, sconf);
      }
+     return(OK);
  }
  
  /* If it's one of ours, fill in r->finfo now to avoid extra stat()... this is a
Index: src/modules/proxy/mod_proxy.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
retrieving revision 1.64
diff -u -c -3 -r1.64 mod_proxy.c
*** mod_proxy.c	1999/01/01 19:05:02	1.64
--- mod_proxy.c	1999/03/12 00:45:09
***************
*** 233,241 ****
      return OK;		/* otherwise; we've done the best we can */
  }
  
! static void proxy_init(server_rec *r, pool *p)
  {
      ap_proxy_garbage_init(r, p);
  }
  
  
--- 233,242 ----
      return OK;		/* otherwise; we've done the best we can */
  }
  
! static int proxy_init(server_rec *r, pool *p)
  {
      ap_proxy_garbage_init(r, p);
+     return(OK);
  }
 
Index: src/modules/standard/mod_log_agent.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_log_agent.c,v
retrieving revision 1.32
diff -u -c -3 -r1.32 mod_log_agent.c
*** mod_log_agent.c	1999/01/01 19:05:10	1.32
--- mod_log_agent.c	1999/03/12 00:46:17
***************
*** 72,77 ****
--- 72,78 ----
  
  typedef struct {
      char *fname;
+     int fatal;
      int agent_fd;
  } agent_log_state;
  
***************
*** 82,87 ****
--- 83,89 ----
  
      cls->fname = "";
      cls->agent_fd = -1;
+     cls->fatal = 0;
  
      return (void *) cls;
  }
***************
*** 95,108 ****
      return NULL;
  }
  
  static const command_rec agent_log_cmds[] =
  {
      {"AgentLog", set_agent_log, NULL, RSRC_CONF, TAKE1,
       "the filename of the agent log"},
      {NULL}
  };
  
! static void open_agent_log(server_rec *s, pool *p)
  {
      agent_log_state *cls = ap_get_module_config(s->module_config,
                                               &agent_log_module);
--- 97,121 ----
      return NULL;
  }
  
+ static const char *set_fatal_log(cmd_parms *parms, void *dummy, int flag)
+ {
+     agent_log_state *cls = ap_get_module_config(parms->server->module_config,
+                                              &agent_log_module);
+ 
+     cls->fatal = flag;
+     return NULL;
+ }
+ 
  static const command_rec agent_log_cmds[] =
  {
      {"AgentLog", set_agent_log, NULL, RSRC_CONF, TAKE1,
       "the filename of the agent log"},
+     {"AgentLogEssential", set_fatal_log, NULL, RSRC_CONF, FLAG,
+      "Open/Create error on agent log will abort the server (default=yes)"},
      {NULL}
  };
  
! static int open_agent_log(server_rec *s, pool *p)
  {
      agent_log_state *cls = ap_get_module_config(s->module_config,
                                               &agent_log_module);
***************
*** 110,116 ****
      char *fname = ap_server_root_relative(p, cls->fname);
  
      if (cls->agent_fd > 0)
!         return;                 /* virtual log shared w/main server */
  
      if (*cls->fname == '|') {
          piped_log *pl;
--- 123,129 ----
      char *fname = ap_server_root_relative(p, cls->fname);
  
      if (cls->agent_fd > 0)
!         return(0);                 /* virtual log shared w/main server */
  
      if (*cls->fname == '|') {
          piped_log *pl;
***************
*** 119,125 ****
          if (pl == NULL) {
  	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  			 "couldn't spawn agent log pipe");
!             exit(1);
          }
          cls->agent_fd = ap_piped_log_write_fd(pl);
      }
--- 132,139 ----
          if (pl == NULL) {
  	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  			 "couldn't spawn agent log pipe");
!             if (cls->fatal) 
! 		return(1);
          }
          cls->agent_fd = ap_piped_log_write_fd(pl);
      }
***************
*** 127,141 ****
          if ((cls->agent_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
              ap_log_error(APLOG_MARK, APLOG_ERR, s,
                           "could not open agent log file %s.", fname);
!             exit(1);
          }
      }
  }
  
! static void init_agent_log(server_rec *s, pool *p)
  {
      for (; s; s = s->next)
!         open_agent_log(s, p);
  }
  
  static int agent_log_transaction(request_rec *orig)
--- 141,160 ----
          if ((cls->agent_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
              ap_log_error(APLOG_MARK, APLOG_ERR, s,
                           "could not open agent log file %s.", fname);
!             if (cls->fatal) 
!             	return(1);
          }
      }
+     return(0);
  }
  
! static int init_agent_log(server_rec *s, pool *p)
  {
      for (; s; s = s->next)
!         if (open_agent_log(s, p))
! 		return(SERVER_ERROR);
! 
!     return(OK);
  }
  
  static int agent_log_transaction(request_rec *orig)
Index: src/modules/standard/mod_log_config.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v
retrieving revision 1.76
diff -u -c -3 -r1.76 mod_log_config.c
*** mod_log_config.c	1999/03/04 19:28:40	1.76
--- mod_log_config.c	1999/03/12 00:46:21
***************
*** 970,994 ****
      {NULL}
  };
  
! static config_log_state *open_config_log(server_rec *s, pool *p,
                                           config_log_state *cls,
                                           array_header *default_format)
  {
      if (cls->log_fd > 0) {
!         return cls;             /* virtual config shared w/main server */
      }
  
      if (cls->fname == NULL) {
!         return cls;             /* Leave it NULL to decline.  */
      }
  
      if (*cls->fname == '|') {
          piped_log *pl;
  
          pl = ap_open_piped_log(p, cls->fname + 1);
!         if (pl == NULL) {
!             exit(1);
!         }
          cls->log_fd = ap_piped_log_write_fd(pl);
      }
      else {
--- 970,994 ----
      {NULL}
  };
  
! static int open_config_log(server_rec *s, pool *p,
                                           config_log_state *cls,
                                           array_header *default_format)
  {
      if (cls->log_fd > 0) {
!         return 0;             /* virtual config shared w/main server */
      }
  
      if (cls->fname == NULL) {
!         return 0;             /* Nothing to do.  */
      }
  
      if (*cls->fname == '|') {
          piped_log *pl;
  
          pl = ap_open_piped_log(p, cls->fname + 1);
!         if (pl == NULL) 
!             return(1);
! 
          cls->log_fd = ap_piped_log_write_fd(pl);
      }
      else {
***************
*** 996,1012 ****
          if ((cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
              ap_log_error(APLOG_MARK, APLOG_ERR, s,
                           "could not open transfer log file %s.", fname);
!             exit(1);
          }
      }
  #ifdef BUFFERED_LOGS
      cls->outcnt = 0;
  #endif
  
!     return cls;
  }
  
! static config_log_state *open_multi_logs(server_rec *s, pool *p)
  {
      int i;
      multi_log_state *mls = ap_get_module_config(s->module_config,
--- 996,1012 ----
          if ((cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
              ap_log_error(APLOG_MARK, APLOG_ERR, s,
                           "could not open transfer log file %s.", fname);
!             return(1);
          }
      }
  #ifdef BUFFERED_LOGS
      cls->outcnt = 0;
  #endif
  
!     return 0;
  }
  
! static int open_multi_logs(server_rec *s, pool *p)
  {
      int i;
      multi_log_state *mls = ap_get_module_config(s->module_config,
***************
*** 1038,1044 ****
  		}
  	    }
  
!             cls = open_config_log(s, p, cls, mls->default_format);
          }
      }
      else if (mls->server_config_logs) {
--- 1038,1045 ----
  		}
  	    }
  
!             if(open_config_log(s, p, cls, mls->default_format))
! 		return(1);
          }
      }
      else if (mls->server_config_logs) {
***************
*** 1053,1082 ****
  		}
  	    }
  
!             cls = open_config_log(s, p, cls, mls->default_format);
          }
      }
  
!     return NULL;
  }
  
! static void init_config_log(server_rec *s, pool *p)
  {
      /* First, do "physical" server, which gets default log fd and format
       * for the virtual servers, if they don't override...
       */
  
!     open_multi_logs(s, p);
  
      /* Then, virtual servers */
  
!     for (s = s->next; s; s = s->next) {
!         open_multi_logs(s, p);
!     }
  }
  
  #ifdef BUFFERED_LOGS
! static void flush_all_logs(server_rec *s, pool *p)
  {
      multi_log_state *mls;
      array_header *log_list;
--- 1054,1087 ----
  		}
  	    }
  
!             if(open_config_log(s, p, cls, mls->default_format))
! 		return(1);
          }
      }
  
!     return 0;
  }
  
! static int init_config_log(server_rec *s, pool *p)
  {
      /* First, do "physical" server, which gets default log fd and format
       * for the virtual servers, if they don't override...
       */
  
!     if (open_multi_logs(s, p))
! 	return(SERVER_ERROR);
  
      /* Then, virtual servers */
  
!     for (s = s->next; s; s = s->next) 
!         if(open_multi_logs(s, p))
! 		return(SERVER_ERROR);
! 
!     return(OK);
  }
  
  #ifdef BUFFERED_LOGS
! static int flush_all_logs(server_rec *s, pool *p)
  {
      multi_log_state *mls;
      array_header *log_list;
***************
*** 1099,1104 ****
--- 1104,1110 ----
              }
          }
      }
+    return OK;
  }
  #endif
  
Index: src/modules/standard/mod_log_referer.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_log_referer.c,v
retrieving revision 1.35
diff -u -c -3 -r1.35 mod_log_referer.c
*** mod_log_referer.c	1999/01/01 19:05:11	1.35
--- mod_log_referer.c	1999/03/12 00:46:22
***************
*** 118,124 ****
      {NULL}
  };
  
! static void open_referer_log(server_rec *s, pool *p)
  {
      referer_log_state *cls = ap_get_module_config(s->module_config,
                                                 &referer_log_module);
--- 118,124 ----
      {NULL}
  };
  
! static int open_referer_log(server_rec *s, pool *p)
  {
      referer_log_state *cls = ap_get_module_config(s->module_config,
                                                 &referer_log_module);
***************
*** 126,132 ****
      char *fname = ap_server_root_relative(p, cls->fname);
  
      if (cls->referer_fd > 0)
!         return;                 /* virtual log shared w/main server */
  
      if (*cls->fname == '|') {
          piped_log *pl;
--- 126,132 ----
      char *fname = ap_server_root_relative(p, cls->fname);
  
      if (cls->referer_fd > 0)
!         return(0);                 /* virtual log shared w/main server */
  
      if (*cls->fname == '|') {
          piped_log *pl;
***************
*** 135,141 ****
  	if (pl == NULL) {
  	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  			 "couldn't spawn referer log pipe");
!             exit(1);
          }
  
          cls->referer_fd = ap_piped_log_write_fd(pl);
--- 135,141 ----
  	if (pl == NULL) {
  	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  			 "couldn't spawn referer log pipe");
!             return(1);
          }
  
          cls->referer_fd = ap_piped_log_write_fd(pl);
***************
*** 144,158 ****
          if ((cls->referer_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
  	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  			 "could not open referer log file %s.", fname);        
! 	    exit(1);
  	}
      }
  }
  
! static void init_referer_log(server_rec *s, pool *p)
  {
      for (; s; s = s->next)
!         open_referer_log(s, p);
  }
  
  static int referer_log_transaction(request_rec *orig)
--- 144,161 ----
          if ((cls->referer_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
  	    ap_log_error(APLOG_MARK, APLOG_ERR, s,
  			 "could not open referer log file %s.", fname);        
! 	    return(1);
  	}
      }
+     return(0);
  }
  
! static int init_referer_log(server_rec *s, pool *p)
  {
      for (; s; s = s->next)
!         if(open_referer_log(s, p))
! 		return(SERVER_ERROR);
!     return(OK);
  }
  
  static int referer_log_transaction(request_rec *orig)
Index: src/modules/standard/mod_mime.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
retrieving revision 1.48
diff -u -c -3 -r1.48 mod_mime.c
*** mod_mime.c	1999/01/01 19:05:11	1.48
--- mod_mime.c	1999/03/12 00:46:24
***************
*** 243,249 ****
  
  static table *hash_buckets[MIME_HASHSIZE];
  
! static void init_mime(server_rec *s, pool *p)
  {
      configfile_t *f;
      char l[MAX_STRING_LEN];
--- 243,249 ----
  
  static table *hash_buckets[MIME_HASHSIZE];
  
! static int init_mime(server_rec *s, pool *p)
  {
      configfile_t *f;
      char l[MAX_STRING_LEN];
***************
*** 258,264 ****
      if (!(f = ap_pcfg_openfile(p, types_confname))) {
          ap_log_error(APLOG_MARK, APLOG_ERR, s,
  		     "could not open mime types log file %s.", types_confname);
!         exit(1);
      }
  
      for (x = 0; x < MIME_HASHSIZE; x++)
--- 258,264 ----
      if (!(f = ap_pcfg_openfile(p, types_confname))) {
          ap_log_error(APLOG_MARK, APLOG_ERR, s,
  		     "could not open mime types log file %s.", types_confname);
!         return(1);
      }
  
      for (x = 0; x < MIME_HASHSIZE; x++)
***************
*** 278,283 ****
--- 278,284 ----
          }
      }
      ap_cfg_closefile(f);
+     return(OK);
  }
  
  static int find_ct(request_rec *r)
Index: src/modules/standard/mod_mime_magic.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_mime_magic.c,v
retrieving revision 1.38
diff -u -c -3 -r1.38 mod_mime_magic.c
*** mod_mime_magic.c	1999/01/01 19:05:11	1.38
--- mod_mime_magic.c	1999/03/12 00:46:33
***************
*** 2352,2358 ****
   * initialize the module
   */
  
! static void magic_init(server_rec *main_server, pool *p)
  {
      int result;
      magic_server_config_rec *conf;
--- 2352,2358 ----
   * initialize the module
   */
  
! static int magic_init(server_rec *main_server, pool *p)
  {
      int result;
      magic_server_config_rec *conf;
***************
*** 2372,2378 ****
  	else if (conf->magicfile) {
  	    result = apprentice(s, p);
  	    if (result == -1)
! 		return;
  #if MIME_MAGIC_DEBUG
  	    prevm = 0;
  	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
--- 2372,2378 ----
  	else if (conf->magicfile) {
  	    result = apprentice(s, p);
  	    if (result == -1)
! 		return(1);
  #if MIME_MAGIC_DEBUG
  	    prevm = 0;
  	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, s,
***************
*** 2397,2402 ****
--- 2397,2403 ----
  #endif
  	}
      }
+     return(OK);
  }
  
  /*
Index: src/modules/standard/mod_rewrite.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.136
diff -u -c -3 -r1.136 mod_rewrite.c
*** mod_rewrite.c	1999/03/07 18:03:34	1.136
--- mod_rewrite.c	1999/03/12 00:47:04
***************
*** 943,955 ****
  **
  */
  
! static void init_module(server_rec *s, pool *p)
  {
      /* check if proxy module is available */
      proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL);
  
      /* create the rewriting lockfile in the parent */
!     rewritelock_create(s, p);
      ap_register_cleanup(p, (void *)s, rewritelock_remove, ap_null_cleanup);
  
      /* step through the servers and
--- 943,956 ----
  **
  */
  
! static int init_module(server_rec *s, pool *p)
  {
      /* check if proxy module is available */
      proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL);
  
      /* create the rewriting lockfile in the parent */
!     if(rewritelock_create(s, p))
! 	return(SERVER_ERROR);
      ap_register_cleanup(p, (void *)s, rewritelock_remove, ap_null_cleanup);
  
      /* step through the servers and
***************
*** 957,965 ****
       * - open the RewriteMap prg:xxx programs
       */
      for (; s; s = s->next) {
!         open_rewritelog(s, p);
!         run_rewritemap_programs(s, p);
      }
  }
  
  
--- 958,969 ----
       * - open the RewriteMap prg:xxx programs
       */
      for (; s; s = s->next) {
!         if(open_rewritelog(s, p))
! 		return(SERVER_ERROR);
!         if(run_rewritemap_programs(s, p))
! 		return(SERVER_ERROR);
      }
+     return(OK);
  }
  
  
***************
*** 970,982 ****
  **
  */
  
! static void init_child(server_rec *s, pool *p)
  {
       /* open the rewriting lockfile */
!      rewritelock_open(s, p);
  
       /* create the lookup cache */
       cachep = init_cache(p);
  }
  
  
--- 974,989 ----
  **
  */
  
! static int init_child(server_rec *s, pool *p)
  {
       /* open the rewriting lockfile */
!      if(rewritelock_open(s, p))
! 	return SERVER_ERROR;
  
       /* create the lookup cache */
       cachep = init_cache(p);
+ 
+      return OK;
  }
  
  
***************
*** 3074,3080 ****
  */
  
  
! static void open_rewritelog(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
      char *fname;
--- 3081,3088 ----
  */
  
  
! static int
! open_rewritelog(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
      char *fname;
***************
*** 3089,3101 ****
      conf = ap_get_module_config(s->module_config, &rewrite_module);
  
      if (conf->rewritelogfile == NULL) {
!         return;
      }
      if (*(conf->rewritelogfile) == '\0') {
!         return;
      }
      if (conf->rewritelogfp > 0) {
!         return; /* virtual log shared w/ main server */
      }
  
      fname = ap_server_root_relative(p, conf->rewritelogfile);
--- 3097,3109 ----
      conf = ap_get_module_config(s->module_config, &rewrite_module);
  
      if (conf->rewritelogfile == NULL) {
!         return(0);
      }
      if (*(conf->rewritelogfile) == '\0') {
!         return(0);
      }
      if (conf->rewritelogfp > 0) {
!         return(0); /* virtual log shared w/ main server */
      }
  
      fname = ap_server_root_relative(p, conf->rewritelogfile);
***************
*** 3105,3111 ****
              ap_log_error(APLOG_MARK, APLOG_ERR, s, 
                           "mod_rewrite: could not open reliable pipe "
                           "to RewriteLog filter %s", conf->rewritelogfile+1);
!             exit(1);
          }
          conf->rewritelogfp = ap_piped_log_write_fd(pl);
      }
--- 3113,3119 ----
              ap_log_error(APLOG_MARK, APLOG_ERR, s, 
                           "mod_rewrite: could not open reliable pipe "
                           "to RewriteLog filter %s", conf->rewritelogfile+1);
!             return(1);
          }
          conf->rewritelogfp = ap_piped_log_write_fd(pl);
      }
***************
*** 3116,3125 ****
  
                           "mod_rewrite: could not open RewriteLog "
                           "file %s", fname);
!             exit(1);
          }
      }
!     return;
  }
  
  static void rewritelog(request_rec *r, int level, const char *text, ...)
--- 3124,3133 ----
  
                           "mod_rewrite: could not open RewriteLog "
                           "file %s", fname);
!             return(1);
          }
      }
!     return(0);
  }
  
  static void rewritelog(request_rec *r, int level, const char *text, ...)
***************
*** 3244,3250 ****
  #define REWRITELOCK_MODE ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH )
  #endif
  
! static void rewritelock_create(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
  
--- 3252,3259 ----
  #define REWRITELOCK_MODE ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH )
  #endif
  
! static int
! rewritelock_create(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
  
***************
*** 3253,3259 ****
      /* only operate if a lockfile is used */
      if (conf->rewritelockfile == NULL
          || *(conf->rewritelockfile) == '\0') {
!         return;
      }
  
      /* fixup the path, especially for rewritelock_remove() */
--- 3262,3268 ----
      /* only operate if a lockfile is used */
      if (conf->rewritelockfile == NULL
          || *(conf->rewritelockfile) == '\0') {
!         return(0);
      }
  
      /* fixup the path, especially for rewritelock_remove() */
***************
*** 3267,3273 ****
          ap_log_error(APLOG_MARK, APLOG_ERR, s,
                       "mod_rewrite: Parent could not create RewriteLock "
                       "file %s", conf->rewritelockfile);
!         exit(1);
      }
  #if !defined(OS2) && !defined(WIN32)
      /* make sure the childs have access to this file */
--- 3276,3282 ----
          ap_log_error(APLOG_MARK, APLOG_ERR, s,
                       "mod_rewrite: Parent could not create RewriteLock "
                       "file %s", conf->rewritelockfile);
!         return(1);
      }
  #if !defined(OS2) && !defined(WIN32)
      /* make sure the childs have access to this file */
***************
*** 3275,3284 ****
          chown(conf->rewritelockfile, ap_user_id, -1 /* no gid change */);
  #endif
  
!     return;
  }
  
! static void rewritelock_open(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
  
--- 3284,3293 ----
          chown(conf->rewritelockfile, ap_user_id, -1 /* no gid change */);
  #endif
  
!     return(0);
  }
  
! static int rewritelock_open(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
  
***************
*** 3287,3293 ****
      /* only operate if a lockfile is used */
      if (conf->rewritelockfile == NULL
          || *(conf->rewritelockfile) == '\0') {
!         return;
      }
  
      /* open the lockfile (once per child) to get a unique fd */
--- 3296,3302 ----
      /* only operate if a lockfile is used */
      if (conf->rewritelockfile == NULL
          || *(conf->rewritelockfile) == '\0') {
!         return(0);
      }
  
      /* open the lockfile (once per child) to get a unique fd */
***************
*** 3297,3305 ****
          ap_log_error(APLOG_MARK, APLOG_ERR, s,
                       "mod_rewrite: Child could not open RewriteLock "
                       "file %s", conf->rewritelockfile);
!         exit(1);
      }
!     return;
  }
  
  static void rewritelock_remove(void *data)
--- 3306,3314 ----
          ap_log_error(APLOG_MARK, APLOG_ERR, s,
                       "mod_rewrite: Child could not open RewriteLock "
                       "file %s", conf->rewritelockfile);
!         return(1);
      }
!     return(0);
  }
  
  static void rewritelock_remove(void *data)
***************
*** 3354,3360 ****
  ** +-------------------------------------------------------+
  */
  
! static void run_rewritemap_programs(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
      FILE *fpin;
--- 3363,3370 ----
  ** +-------------------------------------------------------+
  */
  
! static int
! run_rewritemap_programs(server_rec *s, pool *p)
  {
      rewrite_server_conf *conf;
      FILE *fpin;
***************
*** 3372,3378 ****
       *  don't even try to do anything.
       */
      if (conf->state == ENGINE_DISABLED) {
!         return;
      }
  
      rewritemaps = conf->rewritemaps;
--- 3382,3388 ----
       *  don't even try to do anything.
       */
      if (conf->state == ENGINE_DISABLED) {
!         return(0);
      }
  
      rewritemaps = conf->rewritemaps;
***************
*** 3397,3409 ****
              ap_log_error(APLOG_MARK, APLOG_ERR, s,
                           "mod_rewrite: could not fork child for "
                           "RewriteMap process");
!             exit(1);
          }
          map->fpin  = fileno(fpin);
          map->fpout = fileno(fpout);
          map->fperr = fileno(fperr);
      }
!     return;
  }
  
  /* child process code */
--- 3407,3419 ----
              ap_log_error(APLOG_MARK, APLOG_ERR, s,
                           "mod_rewrite: could not fork child for "
                           "RewriteMap process");
!             return(1);
          }
          map->fpin  = fileno(fpin);
          map->fpout = fileno(fpout);
          map->fperr = fileno(fperr);
      }
!     return(0);
  }
  
  /* child process code */
Index: src/modules/standard/mod_rewrite.h
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v
retrieving revision 1.61
diff -u -c -3 -r1.61 mod_rewrite.h
*** mod_rewrite.h	1999/03/07 18:03:37	1.61
--- mod_rewrite.h	1999/03/12 00:47:06
***************
*** 394,401 ****
                                             char *key, char *val);
  
      /* initialisation */
! static void init_module(server_rec *s, pool *p);
! static void init_child(server_rec *s, pool *p);
  
      /* runtime hooks */
  static int hook_uri2file   (request_rec *r);
--- 394,401 ----
                                             char *key, char *val);
  
      /* initialisation */
! static int init_module(server_rec *s, pool *p);
! static int init_child(server_rec *s, pool *p);
  
      /* runtime hooks */
  static int hook_uri2file   (request_rec *r);
***************
*** 441,460 ****
  static int   rewrite_rand(int l, int h);
  
      /* rewriting logfile support */
! static void  open_rewritelog(server_rec *s, pool *p);
  static void  rewritelog(request_rec *r, int level, const char *text, ...)
                          __attribute__((format(printf,3,4)));
  static char *current_logtime(request_rec *r);
  
      /* rewriting lockfile support */
! static void rewritelock_create(server_rec *s, pool *p);
! static void rewritelock_open(server_rec *s, pool *p);
  static void rewritelock_remove(void *data);
  static void rewritelock_alloc(request_rec *r);
  static void rewritelock_free(request_rec *r);
  
      /* program map support */
! static void  run_rewritemap_programs(server_rec *s, pool *p);
  static int   rewritemap_program_child(void *cmd, child_info *pinfo);
  
      /* env variable support */
--- 441,460 ----
  static int   rewrite_rand(int l, int h);
  
      /* rewriting logfile support */
! static int   open_rewritelog(server_rec *s, pool *p);
  static void  rewritelog(request_rec *r, int level, const char *text, ...)
                          __attribute__((format(printf,3,4)));
  static char *current_logtime(request_rec *r);
  
      /* rewriting lockfile support */
! static int rewritelock_create(server_rec *s, pool *p);
! static int rewritelock_open(server_rec *s, pool *p);
  static void rewritelock_remove(void *data);
  static void rewritelock_alloc(request_rec *r);
  static void rewritelock_free(request_rec *r);
  
      /* program map support */
! static int   run_rewritemap_programs(server_rec *s, pool *p);
  static int   rewritemap_program_child(void *cmd, child_info *pinfo);
  
      /* env variable support */
Index: src/modules/standard/mod_status.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_status.c,v
retrieving revision 1.106
diff -u -c -3 -r1.106 mod_status.c
*** mod_status.c	1999/02/02 22:09:48	1.106
--- mod_status.c	1999/03/12 00:47:16
***************
*** 727,733 ****
  }
  
  
! static void status_init(server_rec *s, pool *p)
  {
      status_flags[SERVER_DEAD] = '.';	/* We don't want to assume these are in */
      status_flags[SERVER_READY] = '_';	/* any particular order in scoreboard.h */
--- 727,733 ----
  }
  
  
! static int status_init(server_rec *s, pool *p)
  {
      status_flags[SERVER_DEAD] = '.';	/* We don't want to assume these are in */
      status_flags[SERVER_READY] = '_';	/* any particular order in scoreboard.h */
***************
*** 738,743 ****
--- 738,744 ----
      status_flags[SERVER_BUSY_LOG] = 'L';
      status_flags[SERVER_BUSY_DNS] = 'D';
      status_flags[SERVER_GRACEFUL] = 'G';
+     return(OK);
  }
  
  static const handler_rec status_handlers[] =
Index: src/modules/standard/mod_unique_id.c
===================================================================
RCS file: /x3/home/cvs/apache-1.3/src/modules/standard/mod_unique_id.c,v
retrieving revision 1.18
diff -u -c -3 -r1.18 mod_unique_id.c
*** mod_unique_id.c	1999/01/01 19:05:15	1.18
--- mod_unique_id.c	1999/03/12 00:47:18
***************
*** 155,161 ****
                        unique_id_rec_total_size,
                        unique_id_rec_size_uu;
  
! static void unique_id_global_init(server_rec *s, pool *p)
  {
  #ifndef MAXHOSTNAMELEN
  #define MAXHOSTNAMELEN 256
--- 155,161 ----
                        unique_id_rec_total_size,
                        unique_id_rec_size_uu;
  
! static int unique_id_global_init(server_rec *s, pool *p)
  {
  #ifndef MAXHOSTNAMELEN
  #define MAXHOSTNAMELEN 256
***************
*** 193,206 ****
      if (gethostname(str, sizeof(str) - 1) != 0) {
          ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
            "gethostname: mod_unique_id requires the hostname of the server");
!         exit(1);
      }
      str[sizeof(str) - 1] = '\0';
  
      if ((hent = gethostbyname(str)) == NULL) {
          ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
                      "mod_unique_id: unable to gethostbyname(\"%s\")", str);
!         exit(1);
      }
  
      global_in_addr = ((struct in_addr *) hent->h_addr_list[0])->s_addr;
--- 193,206 ----
      if (gethostname(str, sizeof(str) - 1) != 0) {
          ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
            "gethostname: mod_unique_id requires the hostname of the server");
!         return(SERVER_ERROR);
      }
      str[sizeof(str) - 1] = '\0';
  
      if ((hent = gethostbyname(str)) == NULL) {
          ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, s,
                      "mod_unique_id: unable to gethostbyname(\"%s\")", str);
!         return(SERVER_ERROR);
      }
  
      global_in_addr = ((struct in_addr *) hent->h_addr_list[0])->s_addr;
***************
*** 234,242 ****
          select(0, NULL, NULL, NULL, &tv);
      }
  #endif
  }
  
! static void unique_id_child_init(server_rec *s, pool *p)
  {
      pid_t pid;
  #ifndef NO_GETTIMEOFDAY
--- 234,243 ----
          select(0, NULL, NULL, NULL, &tv);
      }
  #endif
+     return(OK);
  }
  
! static int unique_id_child_init(server_rec *s, pool *p)
  {
      pid_t pid;
  #ifndef NO_GETTIMEOFDAY
***************
*** 264,269 ****
--- 265,271 ----
      if (cur_unique_id.pid != pid) {
          ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, s,
                      "oh no! pids are greater than 32-bits!  I'm broken!");
+         return SERVER_ERROR;
      }
  
      cur_unique_id.in_addr = global_in_addr;
***************
*** 294,299 ****
--- 296,303 ----
       */
      cur_unique_id.pid = htonl(cur_unique_id.pid);
      cur_unique_id.counter = htons(cur_unique_id.counter);
+ 
+     return OK;
  }
  
  /* NOTE: This is *NOT* the same encoding used by uuencode ... the last two
Index: htdocs/manual/mod/mod_log_agent.html
===================================================================
RCS file: /x3/home/cvs/apache-1.3/htdocs/manual/mod/mod_log_agent.html,v
retrieving revision 1.9
diff -u -c -3 -r1.9 mod_log_agent.html
*** mod_log_agent.html	1998/05/20 14:12:57	1.9
--- mod_log_agent.html	1999/03/12 00:40:03
***************
*** 21,26 ****
--- 21,27 ----
  
  <UL>
  <LI><A HREF="#agentlog">AgentLog</A>
+ <LI><A HREF="#agentlogessential">AgentLogEssential</A>
  </UL>
  <HR>
  
***************
*** 58,63 ****
--- 59,92 ----
  Note the a new program will not be started for a VirtualHost if it inherits
  the AgentLog from the main server.
  </DL>
+ <H2><A NAME="agentlogessential">AgentLogEssential</A></H2>
+ <!--%plaintext &lt;?INDEX {\tt AgentLogEssential} directive&gt; -->
+ <A
+  HREF="directive-dict.html#Syntax"
+  REL="Help"
+ ><STRONG>Syntax:</STRONG></A> AgentLogEssentail <EM>yes / no</EM><BR>
+ <A
+  HREF="directive-dict.html#Default"
+  REL="Help"
+ ><STRONG>Default:</STRONG></A> <CODE>AgentLogEssential Yes</CODE><BR>
+ <A
+  HREF="directive-dict.html#Context"
+  REL="Help"
+ ><STRONG>Context:</STRONG></A> server config, virtual host<BR>
+ <A
+  HREF="directive-dict.html#Status"
+  REL="Help"
+ ><STRONG>Status:</STRONG></A> Extension<BR>
+ <A
+  HREF="directive-dict.html#Module"
+  REL="Help"
+ ><STRONG>Module:</STRONG></A> mod_log_agent<P>
+ 
+ When the creation or opening of the <a href="#agentlog">AgentLog</a> fails
+ this directive determines wether the server will fail to (re)start, and exit
+ with an error; or simply continue.
+ <p>
+ 
  <STRONG>Security:</STRONG> if a program is used, then it will be
  run under the user who started httpd. This will be root if the server
  was started by root; be sure that the program is secure.<P>

Mime
View raw message