diff options
author | Lennart Poettering <lennart@poettering.net> | 2006-08-31 18:32:27 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2006-08-31 18:32:27 +0000 |
commit | 9d709a294b81066a0942a7a642df1b3d4940ad26 (patch) | |
tree | 0bb37c5bd2622dba6b3fdeeeb92b1edaac6b1963 /avahi-daemon/setproctitle.c | |
parent | 2a3d0eaa15047ec792cddc1e7e821f525d718648 (diff) |
avahi_set_proc_title(): change the process name with prctl() if available
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1300 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-daemon/setproctitle.c')
-rw-r--r-- | avahi-daemon/setproctitle.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/avahi-daemon/setproctitle.c b/avahi-daemon/setproctitle.c index f8d3ddb..09b7f65 100644 --- a/avahi-daemon/setproctitle.c +++ b/avahi-daemon/setproctitle.c @@ -29,6 +29,10 @@ #include <stdarg.h> #include <unistd.h> +#ifdef HAVE_SYS_PRCTL_H +#include <sys/prctl.h> +#endif + #include <avahi-common/malloc.h> #include "setproctitle.h" @@ -73,7 +77,7 @@ void avahi_init_proc_title(int argc, char **argv) { #endif } -void avahi_set_proc_title(const char *fmt,...) { +void avahi_set_proc_title(const char *name, const char *fmt,...) { #ifdef HAVE_SETPROCTITLE char t[256]; @@ -99,4 +103,11 @@ void avahi_set_proc_title(const char *fmt,...) { memset(argv_buffer[0] + l, 0, argv_size - l); argv_buffer[1] = NULL; #endif + +#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME) + + if (name) + prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0); + +#endif } |