
From: "Daniel P. Berrange" <berrange@redhat.com>
* tools/virsh.c: Add send-process-signal * tools/virsh.pod: Document new command --- tools/virsh-domain.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 27 +++++++++++++++ 2 files changed, 120 insertions(+)
+static int getSignalNumber(const char *signame) +{ + int signum; + + if (virStrToLong_i(signame, NULL, 10, &signum) >= 0) + return signum; + + if (STRPREFIX(signame, "sig")) + signame += 3;
Please make this case-insensitive. You just know some users will want to type 'SIGKILL' instead of 'kill', and still have it map to the right libvirt enum value.
+ + if (STRPREFIX(signame, "rtmin+")) { + signame += 6; + if (virStrToLong_i(signame, NULL, 10, &signum) >= 0) + return signum + VIR_DOMAIN_PROCESS_SIGNAL_RTMIN;
Okay, you did take care of realtime signals. However, should you do any validation that they aren't doing stupid stuff like 'rtmin+ -2'?
+++ b/tools/virsh.pod @@ -1379,6 +1379,33 @@ B<Examples> # send a tab, held for 1 second virsh send-key --holdtime 1000 0xf
+=item B<send-process-signal> I<domain-id> [I<--host-pid>] I<pid> I<signame> + +Send a signal I<signame> to the process identified by I<pid> running in +the virtual domain I<domain-id>. The I<pid> is a process ID in the virtual +domain namespace. + +The I<signame> argument may be either an integer signal constant number,
Should we mention that these constants are hard-coded by libvirt, and might not mention the signal numbers on either the client running virsh, or the guest where the signal will be executed?