Skip to content

Commit 51b7d64

Browse files
chronolawagentzh
authored andcommitted
feature: added pure C API function ngx_http_lua_ffi_master_pid() for the get_master_pid() Lua FFI API in ngx.process of lua-resty-core.
Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
1 parent 20ffd85 commit 51b7d64

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ngx_http_lua_worker.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ ngx_http_lua_ffi_worker_count(void)
135135
}
136136

137137

138+
int
139+
ngx_http_lua_ffi_master_pid(void)
140+
{
141+
#if (nginx_version >= 1013008)
142+
if (ngx_process == NGX_PROCESS_SINGLE) {
143+
return (int) ngx_pid;
144+
}
145+
146+
return (int) ngx_parent;
147+
#else
148+
return NGX_ERROR;
149+
#endif
150+
}
151+
152+
138153
int
139154
ngx_http_lua_ffi_get_process_type(void)
140155
{

0 commit comments

Comments
 (0)