From ca437a6cef9cd4b41e83409df0ef1db53e0ea707 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Tue, 4 Jun 2013 16:58:13 +0200 Subject: [PATCH] set process title --- src/kore.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/kore.c b/src/kore.c index 16c7f8b..334a65e 100644 --- a/src/kore.c +++ b/src/kore.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -122,6 +123,7 @@ main(int argc, char *argv[]) kore_write_mypid(); kore_worker_init(); + prctl(PR_SET_NAME, "[main]"); sig_recv = 0; signal(SIGQUIT, kore_signal); @@ -528,11 +530,15 @@ kore_worker_setcpu(struct kore_worker *kw) static void kore_worker_entry(struct kore_worker *kw) { + char buf[16]; struct epoll_event *events; struct connection *c, *cnext; struct kore_worker *k, *next; int n, i, *fd, quit; + snprintf(buf, sizeof(buf), "[worker %d]", kw->id); + prctl(PR_SET_NAME, buf); + if (setgroups(1, &pw->pw_gid) || setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) || setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid)) fatal("unable to drop privileges");