[SCM] Samba Shared Repository - branch master updated
Christof Schmitt
cs at samba.org
Mon Jan 6 15:21:03 MST 2014
The branch, master has been updated
via e8eb47f docs: Add num-children to smbcontrol manpage
via 84d8b2b smbd: Make "num_children" available by smbcontrol
from 168db8b waf: Fix the FreeBSD build with libinotify
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e8eb47f6ee2b2dc128140e068ade0d22edc98518
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 2 10:49:26 2014 -0700
docs: Add num-children to smbcontrol manpage
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Christof Schmitt <cs at samba.org>
Autobuild-Date(master): Mon Jan 6 23:20:24 CET 2014 on sn-devel-104
commit 84d8b2b01324433f7d0861042c53ffcb57dc3ccf
Author: Volker Lendecke <vl at samba.org>
Date: Mon May 6 11:23:03 2013 +0200
smbd: Make "num_children" available by smbcontrol
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Christof Schmit <cs at samba.org>
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages/smbcontrol.1.xml | 7 +++++
source3/librpc/idl/messaging.idl | 4 +++
source3/smbd/process.c | 2 +
source3/smbd/server.c | 16 +++++++++++
source3/utils/smbcontrol.c | 49 ++++++++++++++++++++++++++++++++++++
5 files changed, 78 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages/smbcontrol.1.xml b/docs-xml/manpages/smbcontrol.1.xml
index 4c36d63..e8fef42 100644
--- a/docs-xml/manpages/smbcontrol.1.xml
+++ b/docs-xml/manpages/smbcontrol.1.xml
@@ -304,6 +304,13 @@
</variablelist>
</varlistentry>
+ <varlistentry>
+ <term>num-children</term>
+ <listitem><para>Query the number of smbd child processes. This
+ message can only be sent
+ to <constant>smbd</constant>.</para></listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl
index 583eaf0..9405d53 100644
--- a/source3/librpc/idl/messaging.idl
+++ b/source3/librpc/idl/messaging.idl
@@ -92,6 +92,10 @@ interface messaging
/* shutdown connection for given client */
MSG_SMB_KILL_CLIENT_IP = 0x0316,
+ /* Tell number of child processes */
+ MSG_SMB_TELL_NUM_CHILDREN = 0x0317,
+ MSG_SMB_NUM_CHILDREN = 0x0318,
+
/* winbind messages */
MSG_WINBIND_FINISHED = 0x0401,
MSG_WINBIND_FORGET_STATE = 0x0402,
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 8bd1c2e..1f4cfe7 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3562,6 +3562,8 @@ void smbd_process(struct tevent_context *ev_ctx,
MSG_SMB_KILL_CLIENT_IP,
msg_kill_client_ip);
+ messaging_deregister(sconn->msg_ctx, MSG_SMB_TELL_NUM_CHILDREN, NULL);
+
/*
* Use the default MSG_DEBUG handler to avoid rebroadcasting
* MSGs to all child processes
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 99b0a10..feb47da 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -396,6 +396,20 @@ static void add_child_pid(struct smbd_parent_context *parent,
parent->num_children += 1;
}
+static void smb_tell_num_children(struct messaging_context *ctx, void *data,
+ uint32_t msg_type, struct server_id srv_id,
+ DATA_BLOB *msg_data)
+{
+ uint8_t buf[sizeof(uint32_t)];
+
+ if (am_parent) {
+ SIVAL(buf, 0, am_parent->num_children);
+ messaging_send_buf(ctx, srv_id, MSG_SMB_NUM_CHILDREN,
+ buf, sizeof(buf));
+ }
+}
+
+
/*
at most every smbd:cleanuptime seconds (default 20), we scan the BRL
and locking database for entries to cleanup. As a side effect this
@@ -890,6 +904,8 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
smb_parent_force_tdis);
messaging_register(msg_ctx, NULL, MSG_SMB_KILL_CLIENT_IP,
smb_parent_kill_client_by_ip);
+ messaging_register(msg_ctx, NULL, MSG_SMB_TELL_NUM_CHILDREN,
+ smb_tell_num_children);
messaging_register(msg_ctx, NULL,
ID_CACHE_DELETE, smbd_parent_id_cache_delete);
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index ea1f609..579aa10 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -921,6 +921,53 @@ static bool do_dmalloc_changed(struct tevent_context *ev_ctx,
NULL, 0);
}
+static void print_uint32_cb(struct messaging_context *msg, void *private_data,
+ uint32_t msg_type, struct server_id pid,
+ DATA_BLOB *data)
+{
+ uint32_t num_children;
+
+ if (data->length != sizeof(uint32_t)) {
+ printf("Invalid response: %d bytes long\n",
+ (int)data->length);
+ goto done;
+ }
+ num_children = IVAL(data->data, 0);
+ printf("%u children\n", (unsigned)num_children);
+done:
+ num_replies++;
+}
+
+static bool do_num_children(struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx,
+ const struct server_id pid,
+ const int argc, const char **argv)
+{
+ if (argc != 1) {
+ fprintf(stderr, "Usage: smbcontrol <dest> num-children\n");
+ return False;
+ }
+
+ messaging_register(msg_ctx, NULL, MSG_SMB_NUM_CHILDREN,
+ print_uint32_cb);
+
+ /* Send a message and register our interest in a reply */
+
+ if (!send_message(msg_ctx, pid, MSG_SMB_TELL_NUM_CHILDREN, NULL, 0))
+ return false;
+
+ wait_replies(ev_ctx, msg_ctx, procid_to_pid(&pid) == 0);
+
+ /* No replies were received within the timeout period */
+
+ if (num_replies == 0)
+ printf("No replies received\n");
+
+ messaging_deregister(msg_ctx, MSG_SMB_TELL_NUM_CHILDREN, NULL);
+
+ return num_replies;
+}
+
/* Shutdown a server process */
static bool do_shutdown(struct tevent_context *ev_ctx,
@@ -1329,6 +1376,8 @@ static const struct {
"Validate winbind's credential cache" },
{ "dump-domain-list", do_winbind_dump_domain_list, "Dump winbind domain list"},
{ "notify-cleanup", do_notify_cleanup },
+ { "num-children", do_num_children,
+ "Print number of smbd child processes" },
{ "noop", do_noop, "Do nothing" },
{ NULL }
};
--
Samba Shared Repository
More information about the samba-cvs
mailing list