kvm_stat: Print errno when syscall to perf_event_open() fails
commit874b1cfad51e325d535f99261f91c92df444c18c
authorWei Huang <wei@redhat.com>
Wed, 21 Jan 2015 21:15:31 +0000 (21 16:15 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Jan 2015 11:27:05 +0000 (26 12:27 +0100)
treeb8f1088e836d817c83889fa3cd10ef8316f9d850
parent2c9d535a2e43699de32987b76cf548a39e4d04d2
kvm_stat: Print errno when syscall to perf_event_open() fails

kvm_stat uses syscall() to call perf_event_open(). If this function
call fails, the returned value is -1, which doesn't tell the details
of such failure (i.e. ENOSYS or EINVAL). This patch retrieves errno
and prints it when syscall() fails. The error message will look like
"Exception: perf_event_open failed, errno = 38".

Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
scripts/kvm/kvm_stat