The Samba-Bugzilla – Attachment 8790 Details for
Bug 9816
support setproctitle on linux via prset(PR_SET_NAME
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to provide setproctitle support in lib/replace.c for linux
0001-Support-setproctitle-on-linux-with-prctl-PR_SET_NAME.patch (text/plain), 1.46 KB, created by
Samjam
on 2013-04-19 10:10:15 UTC
(
hide
)
Description:
patch to provide setproctitle support in lib/replace.c for linux
Filename:
MIME Type:
Creator:
Samjam
Created:
2013-04-19 10:10:15 UTC
Size:
1.46 KB
patch
obsolete
>From 4a8707f25a8825c90987ed25906d5dfd5288aaf9 Mon Sep 17 00:00:00 2001 >From: Sam Liddicott <sam@liddicott.com> >Date: Fri, 19 Apr 2013 11:04:55 +0100 >Subject: [PATCH] Support setproctitle on linux with prctl(PR_SET_NAME > >Only the first 16 characters of the title are used on Linux systems >so the most relevant data should be presented at the start of the >title > >Signed-off-by: Sam Liddicott <sam@liddicott.com> >--- > lib/replace/replace.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > >diff --git a/lib/replace/replace.c b/lib/replace/replace.c >index 37edb31..00abad8 100644 >--- a/lib/replace/replace.c >+++ b/lib/replace/replace.c >@@ -33,6 +33,11 @@ > #include "system/locale.h" > #include "system/wait.h" > >+/* Linux replacement for setproctitle */ >+#if ! defined(HAVE_SETPROCTITLE) && defined(HAVE_SYS_PRCTL_H) && defined(HAVE_PRCTL) >+#include <sys/prctl.h> >+#endif >+ > #ifdef _WIN32 > #define mkdir(d,m) _mkdir(d) > #endif >@@ -898,5 +903,19 @@ int rep_usleep(useconds_t sec) > #ifndef HAVE_SETPROCTITLE > void rep_setproctitle(const char *fmt, ...) > { >+#if defined (HAVE_PRCTL) && defined(PR_SET_NAME) >+ char *title = NULL; >+ va_list args; >+ >+ if (fmt) { >+ va_start(args, fmt); >+ vasprintf(&title, fmt, args); >+ prctl(PR_SET_NAME, (unsigned long)title, 0, 0, 0); >+ free(title); >+ va_end(args); >+ } else { >+ prctl(PR_SET_NAME, 0, 0, 0, 0); >+ } >+#endif > } > #endif >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 9816
: 8790