From c2478b26692363a4495c3d72e72977bbf90120fe Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 22 Oct 2012 13:35:53 +0200 Subject: [PATCH] linux: update comm field in uv_set_process_title() Makes the new process name visible in both `ps` and `ps a`, with the caveat that `ps` will only print the first 16 characters. Before this commit, `ps` kept reporting the old process name. --- src/unix/linux/linux-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unix/linux/linux-core.c b/src/unix/linux/linux-core.c index bf6efd85..e26656e1 100644 --- a/src/unix/linux/linux-core.c +++ b/src/unix/linux/linux-core.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -167,6 +168,10 @@ uv_err_t uv_set_process_title(const char* title) { if (process_title.len) strncpy(process_title.str, title, process_title.len - 1); +#if defined(PR_SET_NAME) + prctl(PR_SET_NAME, title); +#endif + return uv_ok_; }