Re: [PATCH 3/4] Add a 'send-process-signal' command to virsh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> * 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?

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]