Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-09-15 20:41:08 +0400
committerIgor Sysoev <igor@sysoev.ru>2008-09-15 20:41:08 +0400
commitea1c7c7f16074ba58be1492cfc82625d0408a250 (patch)
tree212e70386695f1105ba39a6ed9ce7b4383b4db6b /src
parentfae2c00d02d3631347a17deab2709968be1a05c7 (diff)
$pid
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_variables.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index f61482f4c..08343b8e8 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -78,6 +78,8 @@ static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
/*
* TODO:
@@ -227,6 +229,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
{ ngx_string("hostname"), NULL, ngx_http_variable_hostname,
0, 0, 0 },
+ { ngx_string("pid"), NULL, ngx_http_variable_pid,
+ 0, 0, 0 },
+
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
};
@@ -1353,6 +1358,27 @@ ngx_http_variable_hostname(ngx_http_request_t *r,
}
+static ngx_int_t
+ngx_http_variable_pid(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p;
+
+ p = ngx_pnalloc(r->pool, NGX_INT64_LEN);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ v->len = ngx_sprintf(p, "%P", ngx_pid) - p;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = p;
+
+ return NGX_OK;
+}
+
+
ngx_int_t
ngx_http_variables_add_core_vars(ngx_conf_t *cf)
{