summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-09-24 09:20:46 +0200
committerJelmer Vernooij <jelmer@samba.org>2012-09-24 23:06:07 +0200
commitfd8d4ec34785e71de3f8458222d196d454d0e723 (patch)
tree4d2976bb833a3f7e46e43a26ba9841029ebfcbf2
parent6641d76562db10e6289c5e819b1296d8f6df37bf (diff)
downloadsamba-fd8d4ec34785e71de3f8458222d196d454d0e723.tar.gz
samba-fd8d4ec34785e71de3f8458222d196d454d0e723.tar.bz2
samba-fd8d4ec34785e71de3f8458222d196d454d0e723.zip
replace: Support setproctitle().
This uses the setproctitle() from libc, libsetproctitle or libbsd. If none is available it provides a dummy implementation.
-rw-r--r--lib/replace/README1
-rw-r--r--lib/replace/replace.c7
-rw-r--r--lib/replace/replace.h9
-rw-r--r--lib/replace/wscript2
-rw-r--r--source4/scripting/python/samba/netcmd/domain.py4
-rw-r--r--source4/smbd/process_onefork.c13
6 files changed, 21 insertions, 15 deletions
diff --git a/lib/replace/README b/lib/replace/README
index 5399971afe..e960dc877e 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -73,6 +73,7 @@ readlink
symlink
realpath
poll
+setproctitle
Types:
bool
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index ebfe04d5d3..a0aa788658 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -894,3 +894,10 @@ int rep_usleep(useconds_t sec)
return 0;
}
#endif /* HAVE_USLEEP */
+
+#ifndef HAVE_SETPROCTITLE
+void rep_setproctitle(const char *fmt, ...)
+{
+ return 0;
+}
+#endif
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index c7f9c71175..bbea0fc774 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -128,6 +128,10 @@
#include <sys/types.h>
#endif
+#ifdef HAVE_SETPROCTITLE_H
+#include <setproctitle.h>
+#endif
+
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
@@ -845,4 +849,9 @@ typedef long useconds_t;
int usleep(useconds_t);
#endif
+#ifndef HAVE_SETPROCTITLE
+#define setproctitle rep_setproctitle
+void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
+#endif
+
#endif /* _LIBREPLACE_REPLACE_H */
diff --git a/lib/replace/wscript b/lib/replace/wscript
index d5b2631cfd..f1f1cefe65 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -193,6 +193,8 @@ struct foo bar = { .y = 'X', .x = 1 };
checklibc=True)
if not conf.CHECK_FUNCS('getpeereid'):
conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h')
+ if not conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h'):
+ conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h')
conf.CHECK_CODE('''
struct ucred cred;
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index 7d2421b246..2e8d7c965d 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -395,8 +395,8 @@ class cmd_domain_provision(Command):
serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
backend_type=ldap_backend_type,
ldapadminpass=ldapadminpass, ol_mmr_urls=ol_mmr_urls,
- useeadb=eadb, next_rid=next_rid, lp=lp, use_ntvfs=(use_ntvfs),
- use_rfc2307=(use_rfc2307))
+ useeadb=eadb, next_rid=next_rid, lp=lp, use_ntvfs=use_ntvfs,
+ use_rfc2307=use_rfc2307)
except ProvisioningError, e:
raise CommandError("Provision failed", e)
diff --git a/source4/smbd/process_onefork.c b/source4/smbd/process_onefork.c
index 251e5074c8..b5e93d93be 100644
--- a/source4/smbd/process_onefork.c
+++ b/source4/smbd/process_onefork.c
@@ -32,19 +32,6 @@
#include "param/param.h"
#include "ldb_wrap.h"
-#ifdef HAVE_SETPROCTITLE
-#ifdef HAVE_SETPROCTITLE_H
-#include <setproctitle.h>
-#endif
-#else
-#define setproctitle none_setproctitle
-static int none_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
-static int none_setproctitle(const char *fmt, ...)
-{
- return 0;
-}
-#endif
-
NTSTATUS process_model_onefork_init(void);
/*