summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/dmallocmsg.c27
-rw-r--r--source3/lib/events.c15
-rw-r--r--source3/lib/messages.c20
3 files changed, 43 insertions, 19 deletions
diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c
index bccede3515..7e52e93a10 100644
--- a/source3/lib/dmallocmsg.c
+++ b/source3/lib/dmallocmsg.c
@@ -35,10 +35,11 @@ static unsigned long our_dm_mark = 0;
* Respond to a POOL_USAGE message by sending back string form of memory
* usage stats.
**/
-static void msg_req_dmalloc_mark(int UNUSED(msg_type),
- struct server_id UNUSED(src_pid),
- void *UNUSED(buf), size_t UNUSED(len),
- void *private_data)
+static void msg_req_dmalloc_mark(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
#ifdef ENABLE_DMALLOC
our_dm_mark = dmalloc_mark();
@@ -50,10 +51,11 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type),
-static void msg_req_dmalloc_log_changed(int UNUSED(msg_type),
- struct server_id UNUSED(src_pid),
- void *UNUSED(buf), size_t UNUSED(len),
- void *private_data)
+static void msg_req_dmalloc_log_changed(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
{
#ifdef ENABLE_DMALLOC
dmalloc_log_changed(our_dm_mark, True, True, True);
@@ -67,10 +69,11 @@ static void msg_req_dmalloc_log_changed(int UNUSED(msg_type),
/**
* Register handler for MSG_REQ_POOL_USAGE
**/
-void register_dmalloc_msgs(void)
+void register_dmalloc_msgs(struct messaging_context *msg_ctx)
{
- message_register(MSG_REQ_DMALLOC_MARK, msg_req_dmalloc_mark, NULL);
- message_register(MSG_REQ_DMALLOC_LOG_CHANGED,
- msg_req_dmalloc_log_changed, NULL);
+ messaging_register(msg_ctx, NULL, MSG_REQ_DMALLOC_MARK,
+ msg_req_dmalloc_mark);
+ messaging_register(msg_ctx, NULL, MSG_REQ_DMALLOC_LOG_CHANGED,
+ msg_req_dmalloc_log_changed);
DEBUG(2, ("Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED\n"));
}
diff --git a/source3/lib/events.c b/source3/lib/events.c
index 77d18ec13d..9b0a2b6712 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -224,6 +224,21 @@ BOOL event_add_to_select_args(struct event_context *event_ctx,
return True;
}
+BOOL events_pending(struct event_context *event_ctx)
+{
+ struct fd_event *fde;
+
+ if (event_ctx->timed_events != NULL) {
+ return True;
+ }
+ for (fde = event_ctx->fd_events; fde; fde = fde->next) {
+ if (fde->flags & (EVENT_FD_READ|EVENT_FD_WRITE)) {
+ return True;
+ }
+ }
+ return False;
+}
+
BOOL run_events(struct event_context *event_ctx,
int selrtn, fd_set *read_fds, fd_set *write_fds)
{
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 4cbdda61ee..667571a75d 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -71,6 +71,12 @@ static struct dispatch_fns {
void *private_data;
} *dispatch_fns;
+static void message_register(int msg_type,
+ void (*fn)(int msg_type, struct server_id pid,
+ void *buf, size_t len,
+ void *private_data),
+ void *private_data);
+
/****************************************************************************
Free global objects.
****************************************************************************/
@@ -147,7 +153,7 @@ static BOOL message_init(struct messaging_context *msg_ctx)
/* Register some debugging related messages */
register_msg_pool_usage(msg_ctx);
- register_dmalloc_msgs();
+ register_dmalloc_msgs(msg_ctx);
debug_register_msgs(msg_ctx);
return True;
@@ -545,11 +551,11 @@ void message_dispatch(void)
messages on an *odd* byte boundary.
****************************************************************************/
-void message_register(int msg_type,
- void (*fn)(int msg_type, struct server_id pid,
- void *buf, size_t len,
- void *private_data),
- void *private_data)
+static void message_register(int msg_type,
+ void (*fn)(int msg_type, struct server_id pid,
+ void *buf, size_t len,
+ void *private_data),
+ void *private_data)
{
struct dispatch_fns *dfn;
@@ -582,7 +588,7 @@ void message_register(int msg_type,
De-register the function for a particular message type.
****************************************************************************/
-void message_deregister(int msg_type)
+static void message_deregister(int msg_type)
{
struct dispatch_fns *dfn, *next;