summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-15 14:39:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:06 -0500
commit331041139f2389baab6ba28483121abc31c1a870 (patch)
treed4d719104d3a864507af67904c7442265cc036e3 /source3/utils
parent63f9607ea7d48ad4bd418fc1135d72215aa05c85 (diff)
downloadsamba-331041139f2389baab6ba28483121abc31c1a870.tar.gz
samba-331041139f2389baab6ba28483121abc31c1a870.tar.bz2
samba-331041139f2389baab6ba28483121abc31c1a870.zip
r22906: Some more message_send_pid
(This used to be commit 8abf9f396375b42d838e992b3a4e40e68e550ab2)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbcontrol.c79
1 files changed, 46 insertions, 33 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 55711c94a1..c4d71361fd 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -47,7 +47,8 @@ static int num_replies; /* Used by message callback fns */
/* Send a message to a destination pid. Zero means broadcast smbd. */
-static BOOL send_message(struct server_id pid, int msg_type,
+static BOOL send_message(struct messaging_context *msg_ctx,
+ struct server_id pid, int msg_type,
const void *buf, int len,
BOOL duplicates)
{
@@ -58,8 +59,9 @@ static BOOL send_message(struct server_id pid, int msg_type,
return False;
if (procid_to_pid(&pid) != 0)
- return NT_STATUS_IS_OK(message_send_pid(pid, msg_type, buf, len,
- duplicates));
+ return NT_STATUS_IS_OK(
+ messaging_send_buf(msg_ctx, pid, msg_type,
+ (uint8 *)buf, len));
ret = message_send_all(msg_type, buf, len, duplicates,
&n_sent);
@@ -133,7 +135,7 @@ static BOOL do_debug(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_DEBUG, argv[1], strlen(argv[1]) + 1, False);
}
@@ -328,7 +330,7 @@ static BOOL do_inject_fault(struct messaging_context *msg_ctx,
return False;
}
- return send_message(pid, MSG_SMB_INJECT_FAULT,
+ return send_message(msg_ctx, pid, MSG_SMB_INJECT_FAULT,
&sig, sizeof(int), False);
}
#endif /* DEVELOPER */
@@ -345,7 +347,7 @@ static BOOL do_election(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_FORCE_ELECTION, NULL, 0, False);
}
@@ -371,7 +373,7 @@ static BOOL do_ping(struct messaging_context *msg_ctx,
/* Send a message and register our interest in a reply */
- if (!send_message(pid, MSG_PING, NULL, 0, False))
+ if (!send_message(msg_ctx, pid, MSG_PING, NULL, 0, False))
return False;
message_register(MSG_PONG, pong_cb, NULL);
@@ -415,26 +417,29 @@ static BOOL do_profile(struct messaging_context *msg_ctx,
return False;
}
- return send_message(pid, MSG_PROFILE, &v, sizeof(int), False);
+ return send_message(msg_ctx, pid, MSG_PROFILE, &v, sizeof(int), False);
}
/* Return the profiling level */
-static void profilelevel_cb(int msg_type, struct server_id pid, void *buf,
- size_t len, void *private_data)
+static void profilelevel_cb(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id pid,
+ DATA_BLOB *data)
{
int level;
const char *s;
num_replies++;
- if (len != sizeof(int)) {
+ if (data->length != sizeof(int)) {
fprintf(stderr, "invalid message length %ld returned\n",
- (unsigned long)len);
+ (unsigned long)data->length);
return;
}
- memcpy(&level, buf, sizeof(int));
+ memcpy(&level, data->data, sizeof(int));
switch (level) {
case 0:
@@ -457,14 +462,17 @@ static void profilelevel_cb(int msg_type, struct server_id pid, void *buf,
printf("Profiling %s on pid %u\n",s,(unsigned int)procid_to_pid(&pid));
}
-static void profilelevel_rqst(int msg_type, struct server_id pid,
- void *buf, size_t len, void *private_data)
+static void profilelevel_rqst(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id pid,
+ DATA_BLOB *data)
{
int v = 0;
/* Send back a dummy reply */
- send_message(pid, MSG_PROFILELEVEL, &v, sizeof(int), False);
+ send_message(msg_ctx, pid, MSG_PROFILELEVEL, &v, sizeof(int), False);
}
static BOOL do_profilelevel(struct messaging_context *msg_ctx,
@@ -478,11 +486,12 @@ static BOOL do_profilelevel(struct messaging_context *msg_ctx,
/* Send a message and register our interest in a reply */
- if (!send_message(pid, MSG_REQ_PROFILELEVEL, NULL, 0, False))
+ if (!send_message(msg_ctx, pid, MSG_REQ_PROFILELEVEL, NULL, 0, False))
return False;
- message_register(MSG_PROFILELEVEL, profilelevel_cb, NULL);
- message_register(MSG_REQ_PROFILELEVEL, profilelevel_rqst, NULL);
+ messaging_register(msg_ctx, NULL, MSG_PROFILELEVEL, profilelevel_cb);
+ messaging_register(msg_ctx, NULL, MSG_REQ_PROFILELEVEL,
+ profilelevel_rqst);
wait_replies(procid_to_pid(&pid) == 0);
@@ -509,7 +518,7 @@ static BOOL do_debuglevel(struct messaging_context *msg_ctx,
/* Send a message and register our interest in a reply */
- if (!send_message(pid, MSG_REQ_DEBUGLEVEL, NULL, 0, False))
+ if (!send_message(msg_ctx, pid, MSG_REQ_DEBUGLEVEL, NULL, 0, False))
return False;
message_register(MSG_DEBUGLEVEL, print_pid_string_cb, NULL);
@@ -679,7 +688,7 @@ static BOOL do_closeshare(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_SMB_FORCE_TDIS, argv[1], strlen(argv[1]) + 1, False);
}
@@ -694,7 +703,7 @@ static BOOL do_samsync(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_SMB_SAM_SYNC, NULL, 0, False);
}
@@ -709,7 +718,7 @@ static BOOL do_samrepl(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_SMB_SAM_REPL, NULL, 0, False);
}
@@ -728,7 +737,7 @@ static BOOL do_poolusage(struct messaging_context *msg_ctx,
/* Send a message and register our interest in a reply */
- if (!send_message(pid, MSG_REQ_POOL_USAGE, NULL, 0, False))
+ if (!send_message(msg_ctx, pid, MSG_REQ_POOL_USAGE, NULL, 0, False))
return False;
wait_replies(procid_to_pid(&pid) == 0);
@@ -754,7 +763,7 @@ static BOOL do_dmalloc_mark(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_REQ_DMALLOC_MARK, NULL, 0, False);
}
@@ -770,7 +779,7 @@ static BOOL do_dmalloc_changed(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_REQ_DMALLOC_LOG_CHANGED, NULL, 0, False);
}
@@ -785,7 +794,7 @@ static BOOL do_shutdown(struct messaging_context *msg_ctx,
return False;
}
- return send_message(pid, MSG_SHUTDOWN, NULL, 0, False);
+ return send_message(msg_ctx, pid, MSG_SHUTDOWN, NULL, 0, False);
}
/* Notify a driver upgrade */
@@ -800,7 +809,7 @@ static BOOL do_drvupgrade(struct messaging_context *msg_ctx,
return False;
}
- return send_message(
+ return send_message(msg_ctx,
pid, MSG_DEBUG, argv[1], strlen(argv[1]) + 1, False);
}
@@ -835,7 +844,7 @@ static BOOL do_winbind_online(struct messaging_context *msg_ctx,
tdb_delete_bystring(tdb, "WINBINDD_OFFLINE");
tdb_close(tdb);
- return send_message(pid, MSG_WINBIND_ONLINE, NULL, 0, False);
+ return send_message(msg_ctx, pid, MSG_WINBIND_ONLINE, NULL, 0, False);
}
static BOOL do_winbind_offline(struct messaging_context *msg_ctx,
@@ -891,7 +900,8 @@ static BOOL do_winbind_offline(struct messaging_context *msg_ctx,
tdb_store_bystring(tdb, "WINBINDD_OFFLINE", d, TDB_INSERT);
- ret = send_message(pid, MSG_WINBIND_OFFLINE, NULL, 0, False);
+ ret = send_message(msg_ctx, pid, MSG_WINBIND_OFFLINE,
+ NULL, 0, False);
/* Check that the entry "WINBINDD_OFFLINE" still exists. */
d = tdb_fetch_bystring( tdb, "WINBINDD_OFFLINE" );
@@ -924,7 +934,8 @@ static BOOL do_winbind_onlinestatus(struct messaging_context *msg_ctx,
message_register(MSG_WINBIND_ONLINESTATUS, print_pid_string_cb, NULL);
- if (!send_message(pid, MSG_WINBIND_ONLINESTATUS, &myid, sizeof(myid), False))
+ if (!send_message(msg_ctx, pid, MSG_WINBIND_ONLINESTATUS, &myid,
+ sizeof(myid), False))
return False;
wait_replies(procid_to_pid(&pid) == 0);
@@ -949,7 +960,8 @@ static BOOL do_reload_config(struct messaging_context *msg_ctx,
return False;
}
- return send_message(pid, MSG_SMB_CONF_UPDATED, NULL, 0, False);
+ return send_message(msg_ctx, pid, MSG_SMB_CONF_UPDATED,
+ NULL, 0, False);
}
static void my_make_nmb_name( struct nmb_name *n, const char *name, int type)
@@ -997,7 +1009,8 @@ static BOOL do_nodestatus(struct messaging_context *msg_ctx,
p.packet.nmb.question.question_type = 0x21;
p.packet.nmb.question.question_class = 0x1;
- return send_message(pid, MSG_SEND_PACKET, &p, sizeof(p), False);
+ return send_message(msg_ctx, pid, MSG_SEND_PACKET, &p, sizeof(p),
+ False);
}
/* A list of message type supported */