----- Original Message -----
From: "Dumindu Perera" <[EMAIL PROTECTED]>
To: <modules-dev@httpd.apache.org>; "Danie Qian" <[EMAIL PROTECTED]>
Sent: Thursday, March 22, 2007 1:18 PM
Subject: Re: load data at server startup - is ap_hook_post_config() the
right place?
Hi Daniel,
the server_rec doesnt have a pool field. which field can I use to store
the
data?
AFAIK, server config is not the same as server_rec.
You create server configuration as in the following:
<code>
typedef struct {
/*
what ever data you need in server config
.
.
*/
} my_cfg;
static void *my_server_config_create(apr_pool_t *p, server_rec *s) {
my_cfg *cfg = (my_cfg *)apr_palloc(p, sizeof(my_cfg));
/*
Set your configuration in cfg struct
.
.
*/
return (void *)cfg;
}
module AP_MODULE_DECLARE_DATA my_module = {
STANDARD20_MODULE_STUFF,
NULL, /*per-dir create,*/
NULL, /*per-dir merge,*/
my_server_config_create, /*per-sever create*/
NULL, /*per-sever merge*/
cmds,
reg_hooks
};
</code>
now you can retrieve your server configuration as follows, when you have a
pointer to a request, 'r':
<code>
my_cfg *svr_cfg = (my_cfg *)ap_get_module_config(r->server->module_config,
&my_module);
</code>
Regards,
Dumindu.
Thanks for replying. Does every child process has one copy of the server
config or is there only one copy in the whole server memory space? I dont
want every child to have a copy as the config data is quite big in my case.
Best Regards,
Daniel