[PATCH 3/3] util: Check/ignore already disabled event

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

 



If the event is already disabled, then don't bother with setting it
disabled again.  Causes unnecessary error on systems that don't support
the feature anyway.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/util/virperf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virperf.c b/src/util/virperf.c
index 6387430..5d57962 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -234,6 +234,9 @@ virPerfEventDisable(virPerfPtr perf,
     if (event == NULL)
         return -1;
 
+    if (!event->enabled)
+        return 0;
+
     if (ioctl(event->fd, PERF_EVENT_IOC_DISABLE) < 0) {
         virReportSystemError(errno,
                              _("unable to disable host cpu perf event for %s"),
-- 
2.7.4

--
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]