summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2011-10-06 14:38:20 +0200
committerMichael Adam <obnox@samba.org>2011-10-12 22:45:53 +0200
commitda85f5a43ea427ce49f9eb5abc1aef3c3491b059 (patch)
tree7f7bd857f65b66753fc0b9d5b2d8074786c18b61 /source3
parent3ff8733792ad9723fdd83532f6d882c073803056 (diff)
downloadsamba-da85f5a43ea427ce49f9eb5abc1aef3c3491b059.tar.gz
samba-da85f5a43ea427ce49f9eb5abc1aef3c3491b059.tar.bz2
samba-da85f5a43ea427ce49f9eb5abc1aef3c3491b059.zip
s3: factor out messaging_send_to_children()
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/include/messages.h1
-rw-r--r--source3/smbd/proto.h2
-rw-r--r--source3/smbd/server.c25
3 files changed, 20 insertions, 8 deletions
diff --git a/source3/include/messages.h b/source3/include/messages.h
index 5ea27f3df1..083cd56256 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -133,6 +133,7 @@ void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type,
NTSTATUS messaging_send(struct messaging_context *msg_ctx,
struct server_id server,
uint32_t msg_type, const DATA_BLOB *data);
+
NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
const uint8 *buf, size_t len);
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index cf7c90450a..40281804cc 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -975,6 +975,8 @@ bool reload_services(struct messaging_context *msg_ctx, int smb_sock,
void exit_server(const char *const explanation);
void exit_server_cleanly(const char *const explanation);
void exit_server_fault(void);
+NTSTATUS messaging_send_to_children(struct messaging_context *msg_ctx,
+ uint32_t msg_type, DATA_BLOB* data);
/* The following definitions come from smbd/service.c */
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 668cafdb7b..7771c85784 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -173,6 +173,22 @@ static void msg_inject_fault(struct messaging_context *msg,
}
#endif /* DEVELOPER */
+NTSTATUS messaging_send_to_children(struct messaging_context *msg_ctx,
+ uint32_t msg_type, DATA_BLOB* data)
+{
+ NTSTATUS status;
+ struct child_pid *child;
+
+ for (child = children; child != NULL; child = child->next) {
+ status = messaging_send(msg_ctx, pid_to_procid(child->pid),
+ msg_type, data);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+ return NT_STATUS_OK;
+}
+
/*
* Parent smbd process sets its own debug level first and then
* sends a message to all the smbd children to adjust their debug
@@ -185,16 +201,9 @@ static void smbd_msg_debug(struct messaging_context *msg_ctx,
struct server_id server_id,
DATA_BLOB *data)
{
- struct child_pid *child;
-
debug_message(msg_ctx, private_data, MSG_DEBUG, server_id, data);
- for (child = children; child != NULL; child = child->next) {
- messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
- MSG_DEBUG,
- data->data,
- strlen((char *) data->data) + 1);
- }
+ messaging_send_to_children(msg_ctx, MSG_DEBUG, data);
}
static void add_child_pid(pid_t pid)