diff mbox

[RFC,v9,15/27] notifier: Add a function to set the notifier

Message ID 1342624074-24650-16-git-send-email-stefanha@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Hajnoczi July 18, 2012, 3:07 p.m. UTC
Although past users only needed to test and clear event notifiers, it is
useful to be able to set them too.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 event_notifier.c |    7 +++++++
 event_notifier.h |    1 +
 2 files changed, 8 insertions(+)
diff mbox

Patch

diff --git a/event_notifier.c b/event_notifier.c
index 0b82981..006adc5 100644
--- a/event_notifier.c
+++ b/event_notifier.c
@@ -59,3 +59,10 @@  int event_notifier_test(EventNotifier *e)
     }
     return r == sizeof(value);
 }
+
+int event_notifier_set(EventNotifier *e)
+{
+    uint64_t value = 1;
+    int r = write(e->fd, &value, sizeof(value));
+    return r == sizeof(value);
+}
diff --git a/event_notifier.h b/event_notifier.h
index 886222c..46a22f8 100644
--- a/event_notifier.h
+++ b/event_notifier.h
@@ -24,5 +24,6 @@  void event_notifier_cleanup(EventNotifier *);
 int event_notifier_get_fd(EventNotifier *);
 int event_notifier_test_and_clear(EventNotifier *);
 int event_notifier_test(EventNotifier *);
+int event_notifier_set(EventNotifier *);
 
 #endif