]> git.pld-linux.org Git - packages/samba.git/blame - samba-bug-9816.patch
- ldb 1.5.6
[packages/samba.git] / samba-bug-9816.patch
CommitLineData
cc54fa40
AM
1From 4a8707f25a8825c90987ed25906d5dfd5288aaf9 Mon Sep 17 00:00:00 2001
2From: Sam Liddicott <sam@liddicott.com>
3Date: Fri, 19 Apr 2013 11:04:55 +0100
4Subject: [PATCH] Support setproctitle on linux with prctl(PR_SET_NAME
5
6Only the first 16 characters of the title are used on Linux systems
7so the most relevant data should be presented at the start of the
8title
9
10Signed-off-by: Sam Liddicott <sam@liddicott.com>
11---
12 lib/replace/replace.c | 19 +++++++++++++++++++
13 1 file changed, 19 insertions(+)
14
15diff --git a/lib/replace/replace.c b/lib/replace/replace.c
16index 37edb31..00abad8 100644
17--- a/lib/replace/replace.c
18+++ b/lib/replace/replace.c
19@@ -33,6 +33,11 @@
20 #include "system/locale.h"
21 #include "system/wait.h"
22
23+/* Linux replacement for setproctitle */
24+#if ! defined(HAVE_SETPROCTITLE) && defined(HAVE_SYS_PRCTL_H) && defined(HAVE_PRCTL)
25+#include <sys/prctl.h>
26+#endif
27+
28 #ifdef _WIN32
29 #define mkdir(d,m) _mkdir(d)
30 #endif
31@@ -898,5 +903,19 @@ int rep_usleep(useconds_t sec)
32 #ifndef HAVE_SETPROCTITLE
33 void rep_setproctitle(const char *fmt, ...)
34 {
35+#if defined (HAVE_PRCTL) && defined(PR_SET_NAME)
36+ char *title = NULL;
37+ va_list args;
38+
39+ if (fmt) {
40+ va_start(args, fmt);
41+ vasprintf(&title, fmt, args);
42+ prctl(PR_SET_NAME, (unsigned long)title, 0, 0, 0);
43+ free(title);
44+ va_end(args);
45+ } else {
46+ prctl(PR_SET_NAME, 0, 0, 0, 0);
47+ }
48+#endif
49 }
50 #endif
51--
521.7.10.4
53
54--- a/lib/replace/wscript~ 2014-09-08 11:26:14.000000000 +0200
55+++ b/lib/replace/wscript 2014-10-28 22:05:54.003836383 +0100
711565cb
AM
56@@ -311,8 +311,7 @@ def configure(conf):
57 strlcpy_in_bsd = True
cc54fa40
AM
58 if not conf.CHECK_FUNCS('getpeereid'):
59 conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
baa92be6
AM
60- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'):
61- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
cc54fa40 62+ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h')
711565cb
AM
63 if not conf.CHECK_FUNCS('setproctitle_init'):
64 conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h')
cc54fa40 65
baa92be6 66
This page took 0.072798 seconds and 4 git commands to generate.