summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-15 15:41:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:07 -0500
commit6669aa051e6e2e3cb79cb4e4b97c2dcd4e31d02b (patch)
treedf32aeffcef5816f8ab08a8d0a79132961b7649c
parent84758bd1f8633d3efe30e293887596db6bfd5e5b (diff)
downloadsamba-6669aa051e6e2e3cb79cb4e4b97c2dcd4e31d02b.tar.gz
samba-6669aa051e6e2e3cb79cb4e4b97c2dcd4e31d02b.tar.bz2
samba-6669aa051e6e2e3cb79cb4e4b97c2dcd4e31d02b.zip
r22910: Make message_send_pid static to messages.c
(This used to be commit 27224922cf964cc70aad7cf529ab6c03fb277a89)
-rw-r--r--source3/lib/debug.c32
-rw-r--r--source3/lib/messages.c25
-rw-r--r--source3/lib/tallocmsg.c16
3 files changed, 38 insertions, 35 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 5ef07f806b..049ef5cfa4 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -471,13 +471,16 @@ BOOL debug_parse_levels(const char *params_str)
Receive a "set debug level" message.
****************************************************************************/
-static void debug_message(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+static void debug_message(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id src,
+ DATA_BLOB *data)
{
- const char *params_str = (const char *)buf;
+ const char *params_str = (const char *)data->data;
/* Check, it's a proper string! */
- if (params_str[len-1] != '\0') {
+ if (params_str[(data->length)-1] != '\0') {
DEBUG(1, ("Invalid debug message from pid %u to pid %u\n",
(unsigned int)procid_to_pid(&src),
(unsigned int)getpid()));
@@ -495,8 +498,11 @@ static void debug_message(int msg_type, struct server_id src,
Return current debug level.
****************************************************************************/
-static void debuglevel_message(int msg_type, struct server_id src,
- void *buf, size_t len, void *private_data)
+static void debuglevel_message(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id src,
+ DATA_BLOB *data)
{
char *message = debug_list_class_names_and_levels();
@@ -505,9 +511,10 @@ static void debuglevel_message(int msg_type, struct server_id src,
return;
}
- DEBUG(1,("INFO: Received REQ_DEBUGLEVEL message from PID %u\n",
- (unsigned int)procid_to_pid(&src)));
- message_send_pid(src, MSG_DEBUGLEVEL, message, strlen(message) + 1, True);
+ DEBUG(1,("INFO: Received REQ_DEBUGLEVEL message from PID %s\n",
+ procid_str_static(&src)));
+ messaging_send_buf(msg_ctx, src, MSG_DEBUGLEVEL,
+ (uint8 *)message, strlen(message) + 1);
SAFE_FREE(message);
}
@@ -531,10 +538,11 @@ void debug_init(void)
}
}
-void debug_register_msgs(void)
+void debug_register_msgs(struct messaging_context *msg_ctx)
{
- message_register(MSG_DEBUG, debug_message, NULL);
- message_register(MSG_REQ_DEBUGLEVEL, debuglevel_message, NULL);
+ messaging_register(msg_ctx, NULL, MSG_DEBUG, debug_message);
+ messaging_register(msg_ctx, NULL, MSG_REQ_DEBUGLEVEL,
+ debuglevel_message);
}
/***************************************************************************
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 63c136db61..55eed105b3 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -99,6 +99,10 @@ static void sig_usr1(void)
sys_select_signal(SIGUSR1);
}
+static NTSTATUS message_send_pid(struct server_id pid, int msg_type,
+ const void *buf, size_t len,
+ BOOL duplicates_allowed);
+
/****************************************************************************
A useful function for testing the message system.
****************************************************************************/
@@ -142,9 +146,9 @@ static BOOL message_init(struct messaging_context *msg_ctx)
/* Register some debugging related messages */
- register_msg_pool_usage();
+ register_msg_pool_usage(msg_ctx);
register_dmalloc_msgs();
- debug_register_msgs();
+ debug_register_msgs(msg_ctx);
return True;
}
@@ -366,26 +370,15 @@ static NTSTATUS message_send_pid_internal(struct server_id pid, int msg_type,
Send a message to a particular pid - no timeout.
****************************************************************************/
-NTSTATUS message_send_pid(struct server_id pid, int msg_type, const void *buf,
- size_t len, BOOL duplicates_allowed)
+static NTSTATUS message_send_pid(struct server_id pid, int msg_type,
+ const void *buf, size_t len,
+ BOOL duplicates_allowed)
{
return message_send_pid_internal(pid, msg_type, buf, len,
duplicates_allowed, 0);
}
/****************************************************************************
- Send a message to a particular pid, with timeout in seconds.
-****************************************************************************/
-
-NTSTATUS message_send_pid_with_timeout(struct server_id pid, int msg_type,
- const void *buf, size_t len,
- BOOL duplicates_allowed, unsigned int timeout)
-{
- return message_send_pid_internal(pid, msg_type, buf, len, duplicates_allowed,
- timeout);
-}
-
-/****************************************************************************
Count the messages pending for a particular pid. Expensive....
****************************************************************************/
diff --git a/source3/lib/tallocmsg.c b/source3/lib/tallocmsg.c
index 098f8a03d9..f5160125aa 100644
--- a/source3/lib/tallocmsg.c
+++ b/source3/lib/tallocmsg.c
@@ -65,9 +65,11 @@ static void msg_pool_usage_helper(const void *ptr, int depth, int max_depth, int
* Respond to a POOL_USAGE message by sending back string form of memory
* usage stats.
**/
-void msg_pool_usage(int msg_type, struct server_id src_pid,
- void *UNUSED(buf), size_t UNUSED(len),
- void *private_data)
+static void msg_pool_usage(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id src,
+ DATA_BLOB *data)
{
struct msg_pool_usage_state state;
@@ -90,8 +92,8 @@ void msg_pool_usage(int msg_type, struct server_id src_pid,
return;
}
- message_send_pid(src_pid, MSG_POOL_USAGE,
- state.s, strlen(state.s)+1, True);
+ messaging_send_buf(msg_ctx, src, MSG_POOL_USAGE,
+ (uint8 *)state.s, strlen(state.s)+1);
talloc_destroy(state.mem_ctx);
}
@@ -99,8 +101,8 @@ void msg_pool_usage(int msg_type, struct server_id src_pid,
/**
* Register handler for MSG_REQ_POOL_USAGE
**/
-void register_msg_pool_usage(void)
+void register_msg_pool_usage(struct messaging_context *msg_ctx)
{
- message_register(MSG_REQ_POOL_USAGE, msg_pool_usage, NULL);
+ messaging_register(msg_ctx, NULL, MSG_REQ_POOL_USAGE, msg_pool_usage);
DEBUG(2, ("Registered MSG_REQ_POOL_USAGE\n"));
}