]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4/samba: use process_set_title()
authorRalph Boehme <slow@samba.org>
Fri, 2 Dec 2022 14:39:25 +0000 (15:39 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 14 Dec 2022 01:38:29 +0000 (01:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/samba/process_prefork.c
source4/samba/process_standard.c

index f2927efbb06d1f925c6295c1f50eeaf3012b0297..35145c7403d0bfa82d00a5d5641f73cc2ccb2d15 100644 (file)
@@ -293,12 +293,8 @@ static void prefork_fork_master(
        }
 
        pid = getpid();
-       setproctitle("task[%s] pre-fork master", service_name);
-       /*
-        * We must fit within 15 chars of text or we will truncate, so
-        * we put the constant part last
-        */
-       prctl_set_comment("%s[master]", service_name);
+
+       process_set_title("%s[master]", "task[%s] pre-fork master", service_name);
 
        /*
         * this will free all the listening sockets and all state that
@@ -753,16 +749,12 @@ static void prefork_fork_worker(struct task_server *task,
                free(w);
 
                TALLOC_FREE(ev);
-               setproctitle("task[%s] pre-forked worker(%d)",
-                            service_name,
-                            pd->instances);
-               /*
-                * We must fit within 15 chars of text or we will truncate, so
-                * we put child number last
-                */
-               prctl_set_comment("%s(%d)",
+
+               process_set_title("%s(%d)",
+                                 "task[%s] pre-forked worker(%d)",
                                  service_name,
                                  pd->instances);
+
                prefork_reload_after_fork();
                if (service_details->post_fork != NULL) {
                        service_details->post_fork(task, pd);
index 396054dbc9d6381be844dc46709cd2e7e02c5885..33b11a61df49ae2c14407e5bb98c42a0f448bda1 100644 (file)
@@ -341,13 +341,8 @@ static void standard_accept_connection(
        proc_ctx->forked_on_accept = true;
 
        pid = getpid();
-       setproctitle("task[%s] standard worker", proc_ctx->name);
 
-       /*
-        * We must fit within 15 chars of text or we will truncate, so
-        * we put the constant part last
-        */
-       prctl_set_comment("%s[work]", proc_ctx->name);
+       process_set_title("%s[work]", "task[%s] standard worker", proc_ctx->name);
 
        /* This is now the child code. We need a completely new event_context to work with */
 
@@ -509,12 +504,7 @@ static void standard_new_task(struct tevent_context *ev,
                smb_panic("Failed to add SIGTERM handler after fork");
        }
 
-       setproctitle("task[%s]", service_name);
-       /*
-        * We must fit within 15 chars of text or we will truncate, so
-        * we put the constant part last
-        */
-       prctl_set_comment("%s[task]", service_name);
+       process_set_title("%s[task]", "task[%s]", service_name);
 
        force_check_log_size();