aboutsummaryrefslogtreecommitdiff
path: root/util/event_notifier-posix.c
diff options
context:
space:
mode:
authorSergio Lopez <slp@redhat.com>2022-03-04 11:08:51 +0100
committerMichael S. Tsirkin <mst@redhat.com>2022-03-06 06:19:47 -0500
commit3bcf0fb3f2b4ab4ceeab488af1a3f7f8b8d70ba4 (patch)
treeeda55efa6a3a9edb03bbab99ccba97f917af7c9d /util/event_notifier-posix.c
parent3234b9ffaf2dc108209f975b57297ecae0d4bc5f (diff)
event_notifier: add event_notifier_get_wfd()
event_notifier_get_fd(const EventNotifier *e) always returns EventNotifier's read file descriptor (rfd). This is not a problem when the EventNotifier is backed by a an eventfd, as a single file descriptor is used both for reading and triggering events (rfd == wfd). But, when EventNotifier is backed by a pipe pair, we have two file descriptors, one that can only be used for reads (rfd), and the other only for writes (wfd). There's, at least, one known situation in which we need to obtain wfd instead of rfd, which is when setting up the file that's going to be sent to the peer in vhost's SET_VRING_CALL. Add a new event_notifier_get_wfd(const EventNotifier *e) that can be used to obtain wfd where needed. Signed-off-by: Sergio Lopez <slp@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20220304100854.14829-2-slp@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'util/event_notifier-posix.c')
-rw-r--r--util/event_notifier-posix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
index 8307013c5d..16294e98d4 100644
--- a/util/event_notifier-posix.c
+++ b/util/event_notifier-posix.c
@@ -99,6 +99,11 @@ int event_notifier_get_fd(const EventNotifier *e)
return e->rfd;
}
+int event_notifier_get_wfd(const EventNotifier *e)
+{
+ return e->wfd;
+}
+
int event_notifier_set(EventNotifier *e)
{
static const uint64_t value = 1;