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.
This commit is contained in:
parent
9a6f496985
commit
c2478b2669
@ -30,6 +30,7 @@
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@ -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_;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user