httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Lewis <...@joe-lewis.com>
Subject Re: process initialisation in prefork-MPM
Date Mon, 27 Jul 2009 18:59:58 GMT
If only you had read the signature of the e-mail you just responded to 
regarding top-posting, your question would have appeared below the 
thread indicating that it does belong in this thread.

ricardo13 wrote:
> HI,
>
> One question.
> How do I declare global variables ??
>
> Thank you
> Ricardo
>
>
>
> Sorin Manolache wrote:
>   
>> On 2008-12-22, Andrej van der Zee <andrejvanderzee@gmail.com> wrote:
>>     
>>> Hi,
>>>
>>>  I need to initialise some structures for each process (in prefork MPM)
>>>  when it is created, and need to be able to access these structures in
>>>  ap_hook_post_read_request and ap_hook_log_transaction handlers. I
>>>  would like to initialise the structures before the first HTTP request
>>>  is being served by the process. How should I do this?
>>>       
>> You hook child_init (ap_hook_child_init) and store your data in global
>> variables that are accessed by post_read_request and log_transaction.
>>
>> S
>>
>> -- 
>> A: Because it reverses the logical flow of conversation.
>> Q: Why is top-posting frowned upon?
>> A: Top-posting.
>> Q: What is the most annoying thing in e-mail?
>>
>>
>>     
>
>   

Here we go. Global variables. In the prefork MPM, you are going to have 
to use shared memory segments. When you start, the first time you run 
your post config, create a shared memory segment. Then, on the other 
post configs (from inside of each process), attach to the shared memory 
handle, and set a "local" variable to your shared memory structure.

Joe
-- 
Joe Lewis
Chief Nerd 	SILVERHAWK <http://www.silverhawk.net/> 	(801) 660-1900

------------------------------------------------------------------------
/Honolulu - it's got everything. Sand for the children, sun for the 
wife, sharks for the wife's mother.
--Ken Dodd/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message