nginx lua 获取当前所有进程号
来源:互联网 发布:tcp编程用什么语言 编辑:程序博客网 时间:2024/06/05 04:10
lua local pids = ngx.worker.pids() --return table
ngx_http_lua_worker.c
voidngx_http_lua_inject_worker_api(lua_State *L){ lua_createtable(L, 0 /* narr */, 2 /* nrec */); /* ngx.worker. */ lua_pushcfunction(L, ngx_http_lua_ngx_worker_exiting); lua_setfield(L, -2, "exiting"); lua_pushcfunction(L, ngx_http_lua_ngx_worker_pids); lua_setfield(L, -2, "pids"); lua_setfield(L, -2, "worker");}static intngx_http_lua_ngx_worker_num(){ int i, num = 0; for(i = 0; i < NGX_MAX_PROCESSES ; i++){ if(ngx_processes[i].pid != -1 && ngx_processes[i].pid != 0 ){ num++; } } return num;}static intngx_http_lua_ngx_worker_pids(lua_State *L){ lua_createtable(L, 0, ngx_http_lua_ngx_worker_num()+1); /* ngx.worker.pids() */ int i, num = 1; lua_pushinteger(L, (lua_Integer) num++); lua_pushinteger(L, (lua_Integer) getppid()); //master pid lua_settable(L, -3); for(i = 0; i < NGX_MAX_PROCESSES; ++i){ if(ngx_processes[i].pid != -1 && ngx_processes[i].pid != 0){ lua_pushinteger(L, (lua_Integer)num++); lua_pushinteger(L, (lua_Integer)ngx_processes[i].pid); lua_settable(L, -3); } } lua_pushinteger(L, (lua_Integer) num); lua_pushinteger(L, (lua_Integer) ngx_pid); //current pid lua_settable(L, -3); return 1;}
阅读全文
0 0
- nginx lua 获取当前所有进程号
- 获取系统当前所有进程
- PHP获取当前进程所有变量
- 获取当前所有进程的完整路径
- 通过VBS访问WMI,获取当前所有进程信息
- Lua获取当前时间
- Lua获取当前时间
- Lua 获取当前时间
- Lua获取当前时间
- Lua获取当前时间
- lua获取当前时间
- 枚举当前所有进程
- 在windows里通过进程控制块获取所有当前所有进程-其实非常简单
- c#获取当前登录用户的所有进程,而不是所有用户的进程
- Java获取当前进程ID以及所有Java进程的进程ID
- 通过注册表获取当前所有串口号
- 枚举当前所有进程并获取当前登陆qq的号码
- 获取当前进程名称
- 机器学习基础知识-神经网络与深度学习学习笔记(二)
- iOS NSData与long long的互转
- CSS选择器总结
- Python中的id函数到底是什么?
- SSM-Mybatis的SQL(增删改查)语句
- nginx lua 获取当前所有进程号
- Numpy学习笔记——便捷函数
- Android中configure: error: C compiler cannot create executables解决方法
- STM32启动过程--启动文件--分析
- E
- [DP] POJ1661
- Codeforces 846 A Curriculum Vitae(dp)
- Ubuntu下通过mentohust使用校园网
- 百度开源项目推荐