Init modules in apache2
Posted
by user306963
on Stack Overflow
See other posts from Stack Overflow
or by user306963
Published on 2010-04-30T08:08:26Z
Indexed on
2010/05/06
7:08 UTC
Read the original article
Hit count: 374
Hello, I used to write apache modules in apache 1.3, but these days I am willing to pass to apache2. The module that I am writing at the moment has is own binary data, not a database, for performance purposes. I need to load this data in shared memory, so every child can access it without making his own copy, and it would be practical to load/create the binary data at startup, as I was used to do with apache 1.3. Problem is that I don't find an init event in apache2, in 1.3 in the module struct, immediatly after STANDARD_MODULE_STUFF you find a place for a /** module initializer */, in which you can put a function that will be executed early. Body of the function I used to write is something like:
if ( getppid == 1 )
{
// Load global data here
// this is the parent process
void* data = loadGlobalData( someFilePath );
setGlobalData( config, data );
}
else
{
// this is the init of a child process
// do nothing
}
I am looking for a place in apache2 in where I can put a similar function.
Can you help?
Thanks Benvenuto
© Stack Overflow or respective owner