httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sorin Manolache" <sor...@gmail.com>
Subject module initialisation
Date Wed, 09 Jul 2008 21:19:03 GMT
Hello,

I am writing a DSO apache module that needs some
initialisation---shared memory segment creation and a pipe---before
performing its work.

I have hooked post_config and I have put the initialisation there.

static int *seg = NULL;
static int p[2];

post_config_hook() {
  if (seg == NULL) {
    seg = blabla;
  }
  if (p[0] == 0) {
    pipe(p);
  }
}

When I do an "/etc/init.d/apache2 reload", the post_config hook is
executed again (as expected), but seg is NULL again and I create yet
another shared memory segment.

Can someone tell me please why are all my variables reinitialised
after a reload?

I really checked /proc/PID_of_apache2/fd and after each reload I have
two more file descriptors opened (corresponding to the two endpoints
of the pipe p).

What's the solution to my problem, namely module initialisation that
is persistent across apache reloads?

Thank you very much,
Sorin

Mime
View raw message