httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <sor...@gmail.com>
Subject Re: How to init an mmaped file?
Date Tue, 26 Oct 2010 18:49:32 GMT
On Tue, Oct 26, 2010 at 20:36, Mike Meyer
<mwm-keyword-apache.b9a3c0@mired.org> wrote:
> On Tue, 26 Oct 2010 10:03:11 +0100
> Nick Kew <niq@apache.org> wrote:
>
>> On 26 Oct 2010, at 03:52, Mike Meyer wrote:
>> > Anyone got some hints on how I ought to set this up? Maybe there's a
>> > writeup somewhere I missed on config processing  Possibly there's some
>> > facility that I ought to be looking at to replace the mmaped file?
>>
>> One possible suggestion.  post_config and child_init get passed
>> the first server_rec.  The server_rec in any later hook is the
>> virtual host.  Could your problem be setting data in one server
>> then trying to retrieve it from another?
>
> That indeed appears to be the case (Sorin got this also, pointing out
> that it comes from using a virtual server).
>
> Since I want this to work properly with multiple virtual servers mapping
> different files, I'd like this to work. To me, the obvious place to
> put this would be the config merge hook, except that doesn't get
> passed a copy of the server rec, and the pool it gets passed is
> apparently different (or possibly reset) between invocations, so the
> trick of using pool_userdata to skip doing this during the config
> check doesn't work.
>
> I don't see a hook that's obviously convenient for this. Maybe there's
> one with a non-obvious name? Barring that, it would seem that I have
> to have both my post_config hook and child_init hook walk through the
> servers checking their config to see if my module is enabled, and
> setting them up appropriately.

I did something similar. As you say, I had to walk through the servers
in both hooks. I can lookup up the code tomorrow if you want.

I do not know the pool_userdata trick. What I did was to
apr_pool_cleanup_register a callback on the config pool that undid
what the post_config callback did. The config pool is cleaned up
between the two invocations of the post_config callback.

Sorin

Mime
View raw message