comparison src/http/modules/perl/ngx_http_perl_module.c @ 1257:927b06411194

set worker's perl $$
author Igor Sysoev <igor@sysoev.ru>
date Fri, 15 Jun 2007 12:20:23 +0000
parents aa653367028e
children 5076d97b9cf0
comparison
equal deleted inserted replaced
1256:b363902309c2 1257:927b06411194
65 65
66 #if (NGX_HAVE_PERL_MULTIPLICITY) 66 #if (NGX_HAVE_PERL_MULTIPLICITY)
67 static void ngx_http_perl_cleanup_perl(void *data); 67 static void ngx_http_perl_cleanup_perl(void *data);
68 #endif 68 #endif
69 69
70 static ngx_int_t ngx_http_perl_init_worker(ngx_cycle_t *cycle);
70 static void ngx_http_perl_exit(ngx_cycle_t *cycle); 71 static void ngx_http_perl_exit(ngx_cycle_t *cycle);
71 72
72 73
73 static ngx_command_t ngx_http_perl_commands[] = { 74 static ngx_command_t ngx_http_perl_commands[] = {
74 75
124 &ngx_http_perl_module_ctx, /* module context */ 125 &ngx_http_perl_module_ctx, /* module context */
125 ngx_http_perl_commands, /* module directives */ 126 ngx_http_perl_commands, /* module directives */
126 NGX_HTTP_MODULE, /* module type */ 127 NGX_HTTP_MODULE, /* module type */
127 NULL, /* init master */ 128 NULL, /* init master */
128 NULL, /* init module */ 129 NULL, /* init module */
129 NULL, /* init process */ 130 ngx_http_perl_init_worker, /* init process */
130 NULL, /* init thread */ 131 NULL, /* init thread */
131 NULL, /* exit thread */ 132 NULL, /* exit thread */
132 NULL, /* exit process */ 133 NULL, /* exit process */
133 ngx_http_perl_exit, /* exit master */ 134 ngx_http_perl_exit, /* exit master */
134 NGX_MODULE_V1_PADDING 135 NGX_MODULE_V1_PADDING
1002 1003
1003 return NGX_CONF_OK; 1004 return NGX_CONF_OK;
1004 } 1005 }
1005 1006
1006 1007
1008 static ngx_int_t
1009 ngx_http_perl_init_worker(ngx_cycle_t *cycle)
1010 {
1011 /* set worker's $$ */
1012
1013 sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid);
1014
1015 return NGX_OK;
1016 }
1017
1007 static void 1018 static void
1008 ngx_http_perl_exit(ngx_cycle_t *cycle) 1019 ngx_http_perl_exit(ngx_cycle_t *cycle)
1009 { 1020 {
1010 PERL_SYS_TERM(); 1021 PERL_SYS_TERM();
1011 } 1022 }