kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit ca437a6cef9cd4b41e83409df0ef1db53e0ea707
parent 150bb8822f28c8a98022d70a64b3dcc5f3d05da3
Author: Joris Vink <joris@coders.se>
Date:   Tue,  4 Jun 2013 16:58:13 +0200

set process title

Diffstat:
src/kore.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/kore.c b/src/kore.c @@ -19,6 +19,7 @@ #include <sys/socket.h> #include <sys/queue.h> #include <sys/epoll.h> +#include <sys/prctl.h> #include <sys/wait.h> #include <netinet/in.h> @@ -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");