You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Fabiano Sidler <fa...@gmail.com> on 2007/03/03 01:04:58 UTC

Several questions about writing modules

Hi folks!

Although the Apache webserver has a somewhat comprehensive API, there
are still questions I can't answer:

What about pointers in the module_config struct? (How) does the httpd
guarantee the proper deallocation of referenced memory? Do I have to
register a dealloc function with each of my module_config structs?

Which is the lifetime of the pool passed to post_config functions as
the pconf parameter? Is this the same pool passed as pconf to
pre_config functions? Is it feasible for storing persistent
configuration data, or can I use it instead of creating an own pool
for each module_config struct?

Is there an array or a (linked) list available of all module_config
structs in use? Or do I have to create one in my
create_{dir,srv}_config functions?

Thanks in advance for your answers!
Greetings,
Fabiano

Re: Several questions about writing modules

Posted by Fabiano Sidler <fa...@gmail.com>.
Thank you for your immediate answers!

2007/3/3, Nick Kew <ni...@webthing.com>:
> > What about pointers in the module_config struct? (How) does the httpd
> > guarantee the proper deallocation of referenced memory? Do I have to
> > register a dealloc function with each of my module_config structs?
>
> Nope.

But how does the httpd guarantee that memory referenced to by members
of the module_config structs is properly deallocated? All httpd knows
about a module_config struct is its size, but not its members which
is, in my view, required to safely free the memory pointed to by these
member pointers before in turn to free the pointers themselfes? I
don't get the clue...

> For the brief answers to the above, see
> http://www.apachetutor.org/dev/pools

Oh thanks, I missed that one!

> For the full answer, see the book referenced in my .sig.

I really like your book!
But apparently, for now I still need some more compact yet complete reference.

Thank you for answering,
Greetings,
Fabiano

Re: Several questions about writing modules

Posted by Nick Kew <ni...@webthing.com>.
On Sat, 3 Mar 2007 01:04:58 +0100
"Fabiano Sidler" <fa...@gmail.com> wrote:

> Hi folks!
> 
> Although the Apache webserver has a somewhat comprehensive API, there
> are still questions I can't answer:
> 
> What about pointers in the module_config struct? (How) does the httpd
> guarantee the proper deallocation of referenced memory? Do I have to
> register a dealloc function with each of my module_config structs?

Nope.

> Which is the lifetime of the pool passed to post_config functions as
> the pconf parameter? Is this the same pool passed as pconf to
> pre_config functions? Is it feasible for storing persistent
> configuration data, or can I use it instead of creating an own pool
> for each module_config struct?

For the brief answers to the above, see
http://www.apachetutor.org/dev/pools

For the full answer, see the book referenced in my .sig.

> Is there an array or a (linked) list available of all module_config
> structs in use? Or do I have to create one in my
> create_{dir,srv}_config functions?

Yes there is, but you shouldn't use it directly.  The API provides
accessors for own- and public module data.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/