You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/07/17 06:54:12 UTC

[PATCH] child_init

Here it is.  Called once, right at the top of child_main, after the setuid
call.  I'm presenting it mainly 'cause I want to force discussion ;)

Is after the setuid call correct?

Our API up until now does not formally define the execution environment
for the modules... that is to say, the module has no idea if it's in a
multi-process model, a multi-thread model, a hybrid of those two, or in a
hybrid user and kernel space thread model (or whatever else).  But in
each of these cases there is one or more heavy weight processes, and
this method is intended to be called once at init time for each heavy
weight process.

In theory we could add a thread_init function as well.  I can't think of
applications for it yet though... doesn't mean there aren't any ;)

Dean

Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.60
diff -u -r1.60 http_config.c
--- http_config.c	1997/07/15 21:39:52	1.60
+++ http_config.c	1997/07/17 04:45:21
@@ -1216,6 +1216,15 @@
 	    (*m->init) (s, p);
 }
 
+void 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);
+}
+
 /********************************************************************
  * Configuration directives are restricted in terms of where they may
  * appear in the main configuration files and/or .htaccess files according
Index: http_config.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.h,v
retrieving revision 1.35
diff -u -r1.35 http_config.h
--- http_config.h	1997/07/15 21:39:52	1.35
+++ http_config.h	1997/07/17 04:45:21
@@ -217,6 +217,9 @@
     int (*fixer_upper)(request_rec *);
     int (*logger)(request_rec *);
     int (*header_parser)(request_rec *);
+
+    /* called once in each child right after the fork */
+    int (*child_init)(server_rec *, pool *);
 } module;
 
 /* Initializer for the first few module slots, which are only
@@ -262,6 +265,7 @@
 
 server_rec *read_config (pool *conf_pool, pool *temp_pool, char *config_name);
 void init_modules(pool *p, server_rec *s);
+void child_init_modules(pool *p, server_rec *s);
 void setup_prelinked_modules();
 void show_directives();
 void show_modules();
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.96
diff -u -r1.96 http_core.c
--- http_core.c	1997/07/16 00:41:21	1.96
+++ http_core.c	1997/07/17 04:45:22
@@ -1448,5 +1448,6 @@
    do_nothing,			/* type_checker */
    NULL,			/* pre-run fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.179
diff -u -r1.179 http_main.c
--- http_main.c	1997/07/15 21:39:54	1.179
+++ http_main.c	1997/07/17 04:45:23
@@ -2098,9 +2098,6 @@
     child_num = child_num_arg;
     requests_this_child = 0;
 
-    reopen_scoreboard(pconf);
-    (void)update_child_status(child_num, SERVER_READY, (request_rec*)NULL);
-
 #ifdef MPE
     /* Only try to switch if we're running as MANAGER.SYS */
     if (geteuid() == 1 && user_id > 1) {
@@ -2118,6 +2115,11 @@
         GETUSERMODE();
     }
 #endif
+
+    child_init_modules(pconf, server_conf);
+
+    reopen_scoreboard(pconf);
+    (void)update_child_status(child_num, SERVER_READY, (request_rec*)NULL);
 
     /*
      * Setup the jump buffers so that we can return here after
Index: mod_access.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_access.c,v
retrieving revision 1.17
diff -u -r1.17 mod_access.c
--- mod_access.c	1997/07/13 19:01:14	1.17
+++ mod_access.c	1997/07/17 04:45:23
@@ -279,5 +279,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_actions.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_actions.c,v
retrieving revision 1.12
diff -u -r1.12 mod_actions.c
--- mod_actions.c	1997/05/08 11:27:29	1.12
+++ mod_actions.c	1997/07/17 04:45:23
@@ -215,5 +215,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_alias.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_alias.c,v
retrieving revision 1.18
diff -u -r1.18 mod_alias.c
--- mod_alias.c	1997/07/13 19:01:14	1.18
+++ mod_alias.c	1997/07/17 04:45:23
@@ -384,5 +384,6 @@
    NULL,			/* type_checker */
    fixup_redir,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_asis.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_asis.c,v
retrieving revision 1.14
diff -u -r1.14 mod_asis.c
--- mod_asis.c	1997/07/15 22:36:51	1.14
+++ mod_asis.c	1997/07/17 04:45:23
@@ -126,5 +126,6 @@
    NULL,			/* type_checker */
    NULL,			/* pre-run fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_auth.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_auth.c,v
retrieving revision 1.18
diff -u -r1.18 mod_auth.c
--- mod_auth.c	1997/07/15 22:36:51	1.18
+++ mod_auth.c	1997/07/17 04:45:23
@@ -296,5 +296,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_auth_anon.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_auth_anon.c,v
retrieving revision 1.16
diff -u -r1.16 mod_auth_anon.c
--- mod_auth_anon.c	1997/06/17 00:09:13	1.16
+++ mod_auth_anon.c	1997/07/17 04:45:23
@@ -295,5 +295,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_auth_db.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_auth_db.c,v
retrieving revision 1.12
diff -u -r1.12 mod_auth_db.c
--- mod_auth_db.c	1997/04/24 10:16:55	1.12
+++ mod_auth_db.c	1997/07/17 04:45:23
@@ -299,5 +299,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_auth_dbm.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_auth_dbm.c,v
retrieving revision 1.16
diff -u -r1.16 mod_auth_dbm.c
--- mod_auth_dbm.c	1997/06/30 01:28:29	1.16
+++ mod_auth_dbm.c	1997/07/17 04:45:24
@@ -292,5 +292,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_auth_msql.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_auth_msql.c,v
retrieving revision 1.20
diff -u -r1.20 mod_auth_msql.c
--- mod_auth_msql.c	1997/03/07 14:15:38	1.20
+++ mod_auth_msql.c	1997/07/17 04:45:24
@@ -992,5 +992,6 @@
    NULL,			/* type_checker */
    NULL,			/* pre-run fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_autoindex.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_autoindex.c,v
retrieving revision 1.38
diff -u -r1.38 mod_autoindex.c
--- mod_autoindex.c	1997/07/15 22:36:52	1.38
+++ mod_autoindex.c	1997/07/17 04:45:24
@@ -947,5 +947,6 @@
    NULL,                        /* type_checker */
    NULL,                        /* fixups */
    NULL,                        /* logger */
-   NULL                         /* header parser */
+   NULL,                        /* header parser */
+   NULL				/* child_init */
 };
Index: mod_browser.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_browser.c,v
retrieving revision 1.9
diff -u -r1.9 mod_browser.c
--- mod_browser.c	1997/04/24 23:35:21	1.9
+++ mod_browser.c	1997/07/17 04:45:24
@@ -185,5 +185,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   parse_headers_browser_module	/* header parser */
+   parse_headers_browser_module,/* header parser */
+   NULL				/* child_init */
 };
Index: mod_cern_meta.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_cern_meta.c,v
retrieving revision 1.12
diff -u -r1.12 mod_cern_meta.c
--- mod_cern_meta.c	1997/06/25 08:15:21	1.12
+++ mod_cern_meta.c	1997/07/17 04:45:24
@@ -321,5 +321,6 @@
    NULL,			/* type_checker */
    add_cern_meta_data,		/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
retrieving revision 1.48
diff -u -r1.48 mod_cgi.c
--- mod_cgi.c	1997/07/14 11:28:56	1.48
+++ mod_cgi.c	1997/07/17 04:45:24
@@ -582,5 +582,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_digest.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_digest.c,v
retrieving revision 1.14
diff -u -r1.14 mod_digest.c
--- mod_digest.c	1997/03/07 14:15:39	1.14
+++ mod_digest.c	1997/07/17 04:45:25
@@ -359,5 +359,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_dir.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_dir.c,v
retrieving revision 1.36
diff -u -r1.36 mod_dir.c
--- mod_dir.c	1997/07/15 07:33:29	1.36
+++ mod_dir.c	1997/07/17 04:45:25
@@ -209,5 +209,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_dld.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_dld.c,v
retrieving revision 1.7
diff -u -r1.7 mod_dld.c
--- mod_dld.c	1997/03/07 14:15:40	1.7
+++ mod_dld.c	1997/07/17 04:45:25
@@ -186,5 +186,6 @@
    NULL,			/* check access */
    NULL,			/* type_checker */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_env.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_env.c,v
retrieving revision 1.10
diff -u -r1.10 mod_env.c
--- mod_env.c	1997/03/07 14:15:40	1.10
+++ mod_env.c	1997/07/17 04:45:25
@@ -257,5 +257,6 @@
    NULL,			/* type_checker */
    fixup_env_module,		/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_expires.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_expires.c,v
retrieving revision 1.9
diff -u -r1.9 mod_expires.c
--- mod_expires.c	1997/06/28 21:45:09	1.9
+++ mod_expires.c	1997/07/17 04:45:25
@@ -481,5 +481,6 @@
    NULL,			/* type_checker */
    add_expires,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_headers.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_headers.c,v
retrieving revision 1.4
diff -u -r1.4 mod_headers.c
--- mod_headers.c	1997/03/07 14:15:40	1.4
+++ mod_headers.c	1997/07/17 04:45:25
@@ -249,5 +249,6 @@
    NULL,			/* type_checker */
    fixup_headers,		/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_imap.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_imap.c,v
retrieving revision 1.22
diff -u -r1.22 mod_imap.c
--- mod_imap.c	1997/06/29 17:34:35	1.22
+++ mod_imap.c	1997/07/17 04:45:25
@@ -833,5 +833,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_include.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_include.c,v
retrieving revision 1.41
diff -u -r1.41 mod_include.c
--- mod_include.c	1997/07/16 23:08:18	1.41
+++ mod_include.c	1997/07/17 04:45:26
@@ -2053,5 +2053,6 @@
     NULL,                        /* type_checker */
     NULL,                        /* fixups */
     NULL,                        /* logger */
-    NULL                         /* header parser */
+    NULL,                        /* header parser */
+    NULL			 /* child_init */
 };
Index: mod_info.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_info.c,v
retrieving revision 1.18
diff -u -r1.18 mod_info.c
--- mod_info.c	1997/07/12 19:52:15	1.18
+++ mod_info.c	1997/07/17 04:45:26
@@ -452,5 +452,6 @@
 	NULL,				/* type_checker */
 	NULL,				/* fixups */
 	NULL,				/* logger */
-	NULL				/* header parser */
+	NULL,				/* header parser */
+	NULL				/* child_init */
 };
Index: mod_log_agent.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_agent.c,v
retrieving revision 1.13
diff -u -r1.13 mod_log_agent.c
--- mod_log_agent.c	1997/06/16 15:38:55	1.13
+++ mod_log_agent.c	1997/07/17 04:45:26
@@ -198,5 +198,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    agent_log_transaction,	/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_config.c,v
retrieving revision 1.30
diff -u -r1.30 mod_log_config.c
--- mod_log_config.c	1997/06/16 15:38:55	1.30
+++ mod_log_config.c	1997/07/17 04:45:27
@@ -789,5 +789,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    multi_log_transaction,	/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_log_referer.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_referer.c,v
retrieving revision 1.13
diff -u -r1.13 mod_log_referer.c
--- mod_log_referer.c	1997/06/16 15:38:55	1.13
+++ mod_log_referer.c	1997/07/17 04:45:27
@@ -236,5 +236,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    referer_log_transaction,	/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_mime.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_mime.c,v
retrieving revision 1.18
diff -u -r1.18 mod_mime.c
--- mod_mime.c	1997/07/13 19:01:15	1.18
+++ mod_mime.c	1997/07/17 04:45:27
@@ -320,5 +320,6 @@
    find_ct,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_mime_magic.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_mime_magic.c,v
retrieving revision 1.5
diff -u -r1.5 mod_mime_magic.c
--- mod_mime_magic.c	1997/07/16 00:58:00	1.5
+++ mod_mime_magic.c	1997/07/17 04:45:28
@@ -2548,5 +2548,6 @@
     NULL,            /* check access */
     magic_find_ct,   /* type_checker */
     NULL,            /* fixups */
-    NULL             /* logger */
+    NULL,            /* logger */
+    NULL	     /* child_init */
 };
Index: mod_negotiation.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
retrieving revision 1.47
diff -u -r1.47 mod_negotiation.c
--- mod_negotiation.c	1997/07/12 12:33:13	1.47
+++ mod_negotiation.c	1997/07/17 04:45:29
@@ -2041,5 +2041,6 @@
    handle_multi,		/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
retrieving revision 1.32
diff -u -r1.32 mod_rewrite.c
--- mod_rewrite.c	1997/07/13 09:04:51	1.32
+++ mod_rewrite.c	1997/07/17 04:45:30
@@ -217,7 +217,8 @@
 
    hook_fixup,                  /* [#7] pre-run fixups */
    NULL,                        /* [#9] log a transaction */
-   NULL                         /* [#3] header parser */
+   NULL,                        /* [#3] header parser */
+   NULL				/* child_init */
 };
 
     /* the cache */
Index: mod_status.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_status.c,v
retrieving revision 1.51
diff -u -r1.51 mod_status.c
--- mod_status.c	1997/07/07 14:34:28	1.51
+++ mod_status.c	1997/07/17 04:45:30
@@ -669,5 +669,6 @@
    NULL,			/* type_checker */
    NULL,			/* fixups */
    NULL,			/* logger */
-   NULL				/* header parser */
+   NULL,			/* header parser */
+   NULL				/* child_init */
 };
Index: mod_userdir.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_userdir.c,v
retrieving revision 1.17
diff -u -r1.17 mod_userdir.c
--- mod_userdir.c	1997/06/30 20:38:53	1.17
+++ mod_userdir.c	1997/07/17 04:45:30
@@ -337,5 +337,6 @@
    NULL,                        /* type_checker */
    NULL,                        /* fixups */
    NULL,                        /* logger */
-   NULL                         /* header parser */
+   NULL,                        /* header parser */
+   NULL				/* child_init */
 };
Index: mod_usertrack.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_usertrack.c,v
retrieving revision 1.12
diff -u -r1.12 mod_usertrack.c
--- mod_usertrack.c	1997/07/08 21:18:50	1.12
+++ mod_usertrack.c	1997/07/17 04:45:30
@@ -338,5 +338,6 @@
    NULL,		   /* type_checker */
    spot_cookie,		   /* fixups */
    NULL,                   /* logger */
-   NULL			   /* header parser */
+   NULL,		   /* header parser */
+   NULL			   /* child_init */
 };
Index: modules/proxy/mod_proxy.c
===================================================================
RCS file: /export/home/cvs/apache/src/modules/proxy/mod_proxy.c,v
retrieving revision 1.14
diff -u -r1.14 mod_proxy.c
--- mod_proxy.c	1997/06/28 23:39:54	1.14
+++ mod_proxy.c	1997/07/17 04:45:31
@@ -556,6 +556,7 @@
    NULL,                        /* type_checker */
    proxy_fixup,                 /* pre-run fixups */
    NULL,                        /* logger */
-   NULL                         /* header parser */
+   NULL,                        /* header parser */
+   NULL				/* child_init */
 };