aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-06-17 17:54:34 +1000
committerPaolo Bonzini <pbonzini@redhat.com>2014-10-31 16:35:15 +0100
commita15d5642a03a0b6c6cf327e497e688d1ba4c676d (patch)
tree9fe389191548c82b5a28ff844405073474ac6a6a /scripts
parent4d4103ff32ee4c88857727515b5e596a1debc227 (diff)
kvm_stat: Abstract ioctl numbers
Unfortunately ioctl numbers are platform specific, so abstract them out of the code so they can be overridden. As it happens x86 and s390 share the same values, so nothing needs to change yet. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kvm/kvm_stat12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index 00d4c5dffa..a65d0a364d 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -177,6 +177,12 @@ x86_exit_reasons = {
sc_perf_evt_open = None
exit_reasons = None
+ioctl_numbers = {
+ 'SET_FILTER' : 0x40082406,
+ 'ENABLE' : 0x00002400,
+ 'DISABLE' : 0x00002401,
+}
+
def x86_init(flag):
globals().update({
'sc_perf_evt_open' : 298,
@@ -301,14 +307,14 @@ class Event(object):
raise Exception('perf_event_open failed')
if filter:
import fcntl
- fcntl.ioctl(fd, 0x40082406, filter)
+ fcntl.ioctl(fd, ioctl_numbers['SET_FILTER'], filter)
self.fd = fd
def enable(self):
import fcntl
- fcntl.ioctl(self.fd, 0x00002400, 0)
+ fcntl.ioctl(self.fd, ioctl_numbers['ENABLE'], 0)
def disable(self):
import fcntl
- fcntl.ioctl(self.fd, 0x00002401, 0)
+ fcntl.ioctl(self.fd, ioctl_numbers['DISABLE'], 0)
class TracepointProvider(object):
def __init__(self):