]> granicus.if.org Git - strace/commitdiff
Implement -e kvm= option on all architectures
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 11 Jul 2018 00:00:57 +0000 (00:00 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 11 Jul 2018 00:00:57 +0000 (00:00 +0000)
Make -e kvm= interface available on all architectures by adding a stub
on those architectures that do not have <linux/kvm.h>.

* filter_qualify.c (qualify_kvm): Define unconditionally.
(qual_options): Define qualify_kvm entry unconditionally.
* strace.c (usage): Mention kvm argument of -e option unconditionally.

filter_qualify.c
strace.c

index 95b67e99aea5033008430aa55e7c21e561e5ee98..69928b4e1aa227abbf744d6fa81701c6f219941b 100644 (file)
@@ -405,20 +405,24 @@ qualify_inject(const char *const str)
        qualify_inject_common(str, false, "inject argument");
 }
 
-#ifdef HAVE_LINUX_KVM_H
 static void
 qualify_kvm(const char *const str)
 {
        if (strcmp(str, "vcpu") == 0) {
+#ifdef HAVE_LINUX_KVM_H
                if (os_release >= KERNEL_VERSION(4, 16, 0))
                        kvm_run_structure_decoder_init();
                else
-                       error_msg("-e kvm=vcpu option needs Linux 4.16.0 or higher");
+                       error_msg("-e kvm=vcpu option needs"
+                                 " Linux 4.16.0 or higher");
+#else
+               error_msg("-e kvm=vcpu option is not implemented"
+                         " for this architecture");
+#endif
        } else {
                error_msg_and_die("invalid -e kvm= argument: '%s'", str);
        }
 }
-#endif
 
 static const struct qual_options {
        const char *name;
@@ -443,9 +447,7 @@ static const struct qual_options {
        { "w",          qualify_write   },
        { "fault",      qualify_fault   },
        { "inject",     qualify_inject  },
-#ifdef HAVE_LINUX_KVM_H
        { "kvm",        qualify_kvm     },
-#endif
 };
 
 void
index 07aab5cbd50466c7a5d3619f85be676347823c09..cd04b9898f6a2ea7afd9e75d7ee6a789782912e3 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -278,10 +278,7 @@ Statistics:\n\
 \n\
 Filtering:\n\
   -e expr        a qualifying expression: option=[!]all or option=[!]val1[,val2]...\n\
-     options:    trace, abbrev, verbose, raw, signal, read, write, fault, inject"
-#ifdef HAVE_LINUX_KVM_H
-               ", kvm"
-#endif
+     options:    trace, abbrev, verbose, raw, signal, read, write, fault, inject, kvm"
 "\n\
   -P path        trace accesses to path\n\
 \n\