s3-daemons: Set the comment field of the daemons.
authorAndreas Schneider <asn@samba.org>
Mon, 25 Feb 2013 09:41:18 +0000 (10:41 +0100)
committerDavid Disseldorp <ddiss@suse.de>
Tue, 5 Mar 2013 22:29:48 +0000 (23:29 +0100)
PR_SET_NAME sets the comm field of a process. This way we can give
processes a name and they are easier to identify.

$ ps afx -o pid,comm
29447 smbd
29452  \_ epmd
29453  \_ lsasd-master
29455  |   \_ lsasd-child
29457  |   \_ lsasd-child
29459  |   \_ lsasd-child
29461  |   \_ lsasd-child
29463  |   \_ lsasd-child
29454  \_ spoolssd-master
29456      \_ lpqd
29458      \_ spoolssd-child
29460      \_ spoolssd-child
29462      \_ spoolssd-child
29465      \_ spoolssd-child
29466      \_ spoolssd-child
29467      \_ spoolssd-child
29468      \_ spoolssd-child
29469      \_ spoolssd-child
29470      \_ spoolssd-child
29471      \_ spoolssd-child

Reviewed-by: David Disseldorp <ddiss@samba.org>
source3/printing/queue_process.c
source3/printing/spoolssd.c
source3/rpc_server/epmd.c
source3/rpc_server/lsasd.c

index 1ca186e29f61dfec9343cf7c75c124884c5e8b5a..bc6c33f9a8fcddc0cdd8ec912c6c75ee1f798f32 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "smbd/globals.h"
 #include "include/messages.h"
+#include "lib/util/util_process.h"
 #include "printing.h"
 #include "printing/pcap.h"
 #include "printing/queue_process.h"
@@ -286,6 +287,8 @@ pid_t start_background_queue(struct tevent_context *ev,
                        smb_panic("reinit_after_fork() failed");
                }
 
+               prctl_set_comment("lpqd");
+
                bq_reopen_logs(logfile);
                bq_setup_sig_term_handler();
                bq_setup_sig_hup_handler(ev, msg_ctx);
index db303a1b0bd20ccd0da126d719492fa7602f45c5..464d12bf99188632dd0c26abd975451b36b70c68 100644 (file)
@@ -20,6 +20,8 @@
 #include "serverid.h"
 #include "smbd/smbd.h"
 
+#include "lib/util/util_process.h"
+
 #include "messages.h"
 #include "include/printing.h"
 #include "printing/nt_printing_migrate_internal.h"
@@ -293,6 +295,8 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
                smb_panic("reinit_after_fork() failed");
        }
 
+       prctl_set_comment("spoolssd-child");
+
        spoolss_child_id = child_id;
        spoolss_reopen_logs(child_id);
 
@@ -670,6 +674,8 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
                smb_panic("reinit_after_fork() failed");
        }
 
+       prctl_set_comment("spoolssd-master");
+
        /* save the parent process id so the children can use it later */
        parent_id = messaging_server_id(msg_ctx);
 
index 0e7b4302133be7f88bfe9068a970959de67cfe1e..8d77c4afca23540c051c673dbe0bf09160d94f84 100644 (file)
@@ -25,6 +25,8 @@
 #include "ntdomain.h"
 #include "messages.h"
 
+#include "lib/util/util_process.h"
+
 #include "librpc/rpc/dcerpc_ep.h"
 #include "../librpc/gen_ndr/srv_epmapper.h"
 #include "rpc_server/rpc_server.h"
@@ -168,6 +170,8 @@ void start_epmd(struct tevent_context *ev_ctx,
                smb_panic("reinit_after_fork() failed");
        }
 
+       prctl_set_comment("epmd");
+
        epmd_reopen_logs();
 
        epmd_setup_sig_term_handler(ev_ctx);
index 72ad785cd50ec323a83fdbf77853397251bb4846..9815ad9c1a898c42dc6e801ea6a6c79ac9c9d8da 100644 (file)
@@ -24,6 +24,8 @@
 #include "messages.h"
 #include "ntdomain.h"
 
+#include "lib/util/util_process.h"
+
 #include "lib/id_cache.h"
 
 #include "../lib/tsocket/tsocket.h"
@@ -253,6 +255,8 @@ static bool lsasd_child_init(struct tevent_context *ev_ctx,
                smb_panic("reinit_after_fork() failed");
        }
 
+       prctl_set_comment("lsasd-child");
+
        lsasd_child_id = child_id;
        lsasd_reopen_logs(child_id);
 
@@ -894,6 +898,8 @@ void start_lsasd(struct tevent_context *ev_ctx,
                smb_panic("reinit_after_fork() failed");
        }
 
+       prctl_set_comment("lsasd-master");
+
        /* save the parent process id so the children can use it later */
        parent_id = messaging_server_id(msg_ctx);