Skip to content

Commit 99527d2

Browse files
chronolawagentzh
authored andcommitted
docs: add sample code for ngx.process's get_master_pid() function.
Signed-off-by: Yichun Zhang (agentzh) <[email protected]>
1 parent 8087915 commit 99527d2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ API Implemented
161161
* [ngx.shared.DICT.free_space](https://github.com/openresty/lua-nginx-module#ngxshareddictfree_space)
162162
* [ngx.shared.DICT.capacity](https://github.com/openresty/lua-nginx-module#ngxshareddictcapacity)
163163

164+
[Back to TOC](#table-of-contents)
165+
164166
## resty.core.var
165167

166168
* [ngx.var.VARIABLE](https://github.com/openresty/lua-nginx-module#ngxvarvariable)

lib/ngx/process.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ The API is still in flux and may change in the future without notice.
3232
Synopsis
3333
========
3434

35-
Enables privileged agent process and get process type
36-
-----------------------------------------------------
35+
Enables privileged agent process, gets process type, and then gets the master process PID:
3736

3837
```nginx
3938
# http config
@@ -61,6 +60,7 @@ server {
6160
content_by_lua_block {
6261
local process = require "ngx.process"
6362
ngx.say("process type: ", process.type())
63+
ngx.say("master process pid: ", process.get_master_pid() or "-")
6464
}
6565
}
6666
}
@@ -80,6 +80,7 @@ The example location above produces the following response body:
8080

8181
```
8282
process type: worker
83+
master process pid: 8261
8384
```
8485

8586
[Back to TOC](#table-of-contents)

0 commit comments

Comments
 (0)