winbindd: use setproctitle
authorRalph Boehme <slow@samba.org>
Wed, 20 Dec 2017 16:42:45 +0000 (17:42 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 10 Jan 2018 00:01:23 +0000 (01:01 +0100)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/winbindd/winbindd.c
source3/winbindd/winbindd_cm.c
source3/winbindd/winbindd_dual.c

index fc7c1691873f76195531bcd4f004a7e45ed6ef8a..bd38bf7df634578a3684abc19252e51b772bcfab 100644 (file)
@@ -508,6 +508,8 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
        /* install default SIGCHLD handler: validation code uses fork/waitpid */
        CatchSignal(SIGCHLD, SIG_DFL);
 
+       setproctitle("validate cache child");
+
        ret = (uint8_t)winbindd_validate_cache_nobackup();
        DEBUG(10, ("winbindd_msg_validata_cache: got return value %d\n", ret));
        messaging_send_buf(msg_ctx, server_id, MSG_WINBIND_VALIDATE_CACHE, &ret,
@@ -1491,6 +1493,8 @@ int main(int argc, const char **argv)
        NTSTATUS status;
        bool ok;
 
+       setproctitle_init(argc, discard_const(argv), environ);
+
        /*
         * Do this before any other talloc operation
         */
index 16836bd05b52a79c5b5bc589deaf2aa09ab8d7af..4d3a372dd2521b8dcb0976b0cc83af48dcb765bf 100644 (file)
@@ -256,6 +256,8 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
        }
        SAFE_FREE(lfile);
 
+       setproctitle("dc-connect child");
+
        mem_ctx = talloc_init("fork_child_dc_connect");
        if (!mem_ctx) {
                DEBUG(0,("talloc_init failed.\n"));
index 3b25e53e786fc38724db0b9bee086f1a0b46cf6a..a05644d2c341b4f8421e93c076a07282364eeda4 100644 (file)
@@ -1491,6 +1491,12 @@ static bool fork_domain_child(struct winbindd_child *child)
                _exit(0);
        }
 
+       if (child_domain != NULL) {
+               setproctitle("domain child [%s]", child_domain->name);
+       } else if (child == idmap_child()) {
+               setproctitle("idmap child");
+       }
+
        /* Handle online/offline messages. */
        messaging_register(server_messaging_context(), NULL,
                           MSG_WINBIND_OFFLINE, child_msg_offline);