replace: Support setproctitle().
authorJelmer Vernooij <jelmer@samba.org>
Mon, 24 Sep 2012 07:20:46 +0000 (09:20 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 24 Sep 2012 21:06:07 +0000 (23:06 +0200)
This uses the setproctitle() from libc, libsetproctitle or libbsd.
If none is available it provides a dummy implementation.

lib/replace/README
lib/replace/replace.c
lib/replace/replace.h
lib/replace/wscript
source4/scripting/python/samba/netcmd/domain.py
source4/smbd/process_onefork.c

index 5399971afec8d176ad01eb914f94a0d30a966820..e960dc877eae8ee18e7e2851a8a9af79c78cbbb7 100644 (file)
@@ -73,6 +73,7 @@ readlink
 symlink
 realpath
 poll
+setproctitle
 
 Types:
 bool
index ebfe04d5d34cdd735598d85764c1165733b536ea..a0aa788658ed1e01b8dbdd90ec3d6fc8223309b3 100644 (file)
@@ -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
index c7f9c711757bb2d0fffab3f027cc99d78ba942b8..bbea0fc77481057e7c08b16e06f6fa874752bead 100644 (file)
 #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 */
index d5b2631cfd75b052e1a40639779e4ef6ed5e71c0..f1f1cefe6533d6b1ebd9329ccc0b69a988bedb8c 100644 (file)
@@ -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;
index 7d2421b24670e5a5ffd8adad1b00bf0712ca85dc..2e8d7c965dfc4057d3c3e1c7d61ad0e3f1984f90 100644 (file)
@@ -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)
 
index 251e5074c84a6dda67bd4a76387e05b21436e87a..b5e93d93be27df982021d9535454a8008455a249 100644 (file)
 #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);
 
 /*