messaging3: Add messaging_cleanup
authorVolker Lendecke <vl@samba.org>
Thu, 17 Jul 2014 11:01:00 +0000 (11:01 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 11 Aug 2014 21:57:12 +0000 (23:57 +0200)
Rename smbcontrol's dgm-cleanup to msg-cleanup. We haven't published
this UI yet :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/messages.h
source3/lib/messages.c
source3/utils/smbcontrol.c

index 669d7f138132a508a8f7be57f0bc70e182ed227e..32c636f3fa43fcf81207792777c6624997104ac3 100644 (file)
@@ -151,6 +151,8 @@ struct tevent_req *messaging_read_send(TALLOC_CTX *mem_ctx,
 int messaging_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                        struct messaging_rec **presult);
 
+int messaging_cleanup(struct messaging_context *msg_ctx, pid_t pid);
+
 bool messaging_parent_dgm_cleanup_init(struct messaging_context *msg);
 
 #include "librpc/gen_ndr/ndr_messaging.h"
index 5cb3fdeaa88d8c54ac6cfea7164ea37cd6d40466..78a867adf455568911af540e44fa4cd8d32bb875 100644 (file)
@@ -928,6 +928,19 @@ static void mess_parent_dgm_cleanup_done(struct tevent_req *req)
        tevent_req_set_callback(req, mess_parent_dgm_cleanup_done, msg);
 }
 
+int messaging_cleanup(struct messaging_context *msg_ctx, pid_t pid)
+{
+       int ret;
+
+       if (pid == 0) {
+               ret = messaging_dgm_wipe(msg_ctx);
+       } else {
+               ret = messaging_dgm_cleanup(msg_ctx, pid);
+       }
+
+       return ret;
+}
+
 struct messaging_backend *messaging_local_backend(
        struct messaging_context *msg_ctx)
 {
index edd2edcb63fa1e9d8aaeafd8745f384bb03ff043..7c516c446c1a431836d975ce7d91bec9cee8c8a0 100644 (file)
@@ -968,18 +968,14 @@ static bool do_num_children(struct tevent_context *ev_ctx,
        return num_replies;
 }
 
-static bool do_dgm_cleanup(struct tevent_context *ev_ctx,
+static bool do_msg_cleanup(struct tevent_context *ev_ctx,
                           struct messaging_context *msg_ctx,
                           const struct server_id pid,
                           const int argc, const char **argv)
 {
        int ret;
 
-       if (pid.pid != 0) {
-               ret = messaging_dgm_cleanup(msg_ctx, pid.pid);
-       } else {
-               ret = messaging_dgm_wipe(msg_ctx);
-       }
+       ret = messaging_cleanup(msg_ctx, pid.pid);
 
        printf("cleanup(%u) returned %s\n", (unsigned)pid.pid,
               ret ? strerror(ret) : "ok");
@@ -1397,7 +1393,7 @@ static const struct {
        { "notify-cleanup", do_notify_cleanup },
        { "num-children", do_num_children,
          "Print number of smbd child processes" },
-       { "dgm-cleanup", do_dgm_cleanup },
+       { "msg-cleanup", do_msg_cleanup },
        { "noop", do_noop, "Do nothing" },
        { NULL }
 };