未验证 提交 da8d2fe4 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #5091 from taosdata/feature/sangshuduo/TD-2891-get-cmdline-by-pid-on-mac

[TD-2891] <feature>: get process cmdline by pid on mac.
......@@ -18,6 +18,9 @@
#include "tconfig.h"
#include "tglobal.h"
#include "tulog.h"
#include <errno.h>
#include <libproc.h>
static void taosGetSystemTimezone() {
// get and set default timezone
......@@ -103,8 +106,18 @@ int taosSystem(const char *cmd) {
void taosSetCoreDump() {}
char cmdline[1024];
char *taosGetCmdlineByPID(int pid) {
return "[not supported yet]";
errno = 0;
if (proc_pidpath(pid, cmdline, sizeof(cmdline)) <= 0) {
fprintf(stderr, "PID is %d, %s", pid, strerror(errno));
return strerror(errno);
}
return cmdline;
}
bool taosGetSystemUid(char *uid) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册