mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
s4 messaging: Add support for smbcontrol sleep
Add a sleep command that pauses the target process for the specified number of seconds This command is only enabled on developer and self test builds. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
a70deab0fb
commit
b3e4e09426
@ -1,2 +0,0 @@
|
||||
^samba.tests.blackbox.smbcontrol_process.samba.tests.blackbox.smbcontrol_process.SmbcontrolProcessBlockboxTests.test_sleep\(preforkrestartdc:local\)
|
||||
^samba.tests.blackbox.smbcontrol_process.python3.samba.tests.blackbox.smbcontrol_process.SmbcontrolProcessBlockboxTests.test_sleep\(preforkrestartdc:local\)
|
@ -69,6 +69,34 @@ static void do_inject_fault(struct imessaging_context *msg,
|
||||
kill(getpid(), sig);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cause the current process to sleep for a specified number of seconds
|
||||
*/
|
||||
static void do_sleep(struct imessaging_context *msg,
|
||||
void *private_data,
|
||||
uint32_t msg_type,
|
||||
struct server_id src,
|
||||
DATA_BLOB *data)
|
||||
{
|
||||
unsigned int seconds;
|
||||
struct server_id_buf tmp;
|
||||
|
||||
if (data->length != sizeof(seconds)) {
|
||||
DBG_ERR("Process %s sent bogus sleep request\n",
|
||||
server_id_str_buf(src, &tmp));
|
||||
return;
|
||||
}
|
||||
|
||||
seconds = *(unsigned int *)data->data;
|
||||
DBG_ERR("Process %s requested a sleep of %u seconds\n",
|
||||
server_id_str_buf(src, &tmp),
|
||||
seconds);
|
||||
sleep(seconds);
|
||||
DBG_ERR("Restarting after %u second sleep requested by process %s\n",
|
||||
seconds,
|
||||
server_id_str_buf(src, &tmp));
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the extra messaging handlers
|
||||
*/
|
||||
@ -82,6 +110,11 @@ NTSTATUS imessaging_register_extra_handlers(struct imessaging_context *msg)
|
||||
return status;
|
||||
}
|
||||
|
||||
status = imessaging_register(msg, NULL, MSG_SMB_SLEEP, do_sleep);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user