httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aron Szabo" <aron...@gmail.com>
Subject Re: Apache2 Shared Memory problem
Date Mon, 12 Feb 2007 21:19:10 GMT
Hello!

static int module_translate_name(request_rec * r) {
	module_config *s_cfg = ap_get_module_config(r->server->module_config,
&fp_module);
	apr_datum_t db_domain_t;
	apr_datum_t db_path_t;

	apr_dbm_open_ex(&s_cfg->file,"DB","/tmp/vhosts.db",APR_DBM_RWCREATE,666,r->pool);

	db_domain_t.dptr = r->hostname;
	db_domain_t.dsize = strlen(r->hostname);
	apr_dbm_fetch(s_cfg->file, db_domain_t,&db_path_t);


	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server, "DB! %s PID:
%ld",db_path_t.dptr,(long int)getpid());

	if(db_path_t.dptr) {
		r->filename = apr_pstrcat(r->pool, db_path_t.dptr, r->uri, NULL);
	} else {
                                     apr_dbm_close(s_cfg->file);
		return DECLINED;
	}
                   apr_dbm_close(s_cfg->file);
	return OK;
}

Now my problem is that opening the berkeley db file fails when i want
to translate this.

If i open the database per child then it works ok but if i have a
structure like this:

www.1234.com => /var/www

if i access the url after apache restart it works the child fetches
the data from the database. But if i change the database with an
external program than the child does not fetch the data from the
database again and uses the old data.

is there a way to do this ?

Yours,
Aron


On 2/11/07, Nick Kew <nick@webthing.com> wrote:
> On Sun, 11 Feb 2007 15:23:52 +0000
> Nick Kew <nick@webthing.com> wrote:
>
> > On Sun, 11 Feb 2007 15:51:37 +0100
> > Michael Wallner <mike@iworks.at> wrote:
> >
> > > Looking at apr/memory/unix/apr_pools.c, APRs allocator is anything
> > > but a generic infrastructure for implementing my own allocator.
> >
> > If it was, then I daresay memory pools
>
> ... should've read "shared memory pools", of course!
>
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.org/
>

Mime
View raw message