r22910: Make message_send_pid static to messages.c
authorVolker Lendecke <vlendec@samba.org>
Tue, 15 May 2007 15:41:37 +0000 (15:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:22:07 +0000 (12:22 -0500)
(This used to be commit 27224922cf964cc70aad7cf529ab6c03fb277a89)

source3/lib/debug.c
source3/lib/messages.c
source3/lib/tallocmsg.c

index 5ef07f806b677781de7044f81d253e87ce29c830..049ef5cfa49d35e1cbd97add6ce9b1d1c9fa705b 100644 (file)
@@ -471,13 +471,16 @@ BOOL debug_parse_levels(const char *params_str)
  Receive a "set debug level" message.
 ****************************************************************************/
 
  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! */
 
        /* 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()));
                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.
 ****************************************************************************/
 
  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();
 
 {
        char *message = debug_list_class_names_and_levels();
 
@@ -505,9 +511,10 @@ static void debuglevel_message(int msg_type, struct server_id src,
                return;
        }
 
                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);
 }
 
        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);
 }
 
 /***************************************************************************
 }
 
 /***************************************************************************
index 63c136db61c50971a66995ee6b04d4533523149d..55eed105b3c3a8dc8658d3686fbcb65bb44281ea 100644 (file)
@@ -99,6 +99,10 @@ static void sig_usr1(void)
        sys_select_signal(SIGUSR1);
 }
 
        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.
 ****************************************************************************/
 /****************************************************************************
  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 some debugging related messages */
 
-       register_msg_pool_usage();
+       register_msg_pool_usage(msg_ctx);
        register_dmalloc_msgs();
        register_dmalloc_msgs();
-       debug_register_msgs();
+       debug_register_msgs(msg_ctx);
 
        return True;
 }
 
        return True;
 }
@@ -366,25 +370,14 @@ static NTSTATUS message_send_pid_internal(struct server_id pid, int msg_type,
  Send a message to a particular pid - no timeout.
 ****************************************************************************/
 
  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);
 }
 
 {
        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....
 ****************************************************************************/
 /****************************************************************************
  Count the messages pending for a particular pid. Expensive....
 ****************************************************************************/
index 098f8a03d910b82d03725b5352909df0852fc8ff..f5160125aaa13418b3f942a1cbcad40f8c2682c5 100644 (file)
@@ -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.
  **/
  * 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;
 
 {
        struct msg_pool_usage_state state;
 
@@ -90,8 +92,8 @@ void msg_pool_usage(int msg_type, struct server_id src_pid,
                return;
        }
        
                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);
 }
 
        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
  **/
 /**
  * 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"));
 }      
        DEBUG(2, ("Registered MSG_REQ_POOL_USAGE\n"));
 }