add variable var.PID for use in config file

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@698 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Xuefer 2005-09-12 12:21:34 +00:00
parent 38b8743af3
commit 3006dd11c5
2 changed files with 6 additions and 0 deletions

View File

@ -57,6 +57,7 @@ Example
# variables, computed when config is read.
var.mymodule = "foo"
server.modules += ( "mod_" + var.mymodule )
var.PID is initized to the pid of lighttpd before config is parsed
# include, relative to dirname of main config file
include "mime.types.conf"

View File

@ -900,6 +900,7 @@ static void context_free(config_t *context) {
int config_read(server *srv, const char *fn) {
config_t context;
data_config *dc;
data_integer *dpid;
int ret;
char *pos;
data_array *modules;
@ -929,6 +930,10 @@ int config_read(server *srv, const char *fn) {
/* default context */
srv->config = dc->value;
dpid = data_integer_init();
dpid->value = getpid();
buffer_copy_string(dpid->key, "var.PID");
array_insert_unique(srv->config, (data_unset *)dpid);
ret = config_parse_file(srv, &context, fn);