summary refs log tree commit diff stats
path: root/stubs/fdset.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2018-06-08 11:55:11 +0800
committerMarkus Armbruster <armbru@redhat.com>2018-06-18 15:48:22 +0200
commit474514668b47c9d2148b526e379ffbb6764d9a9e (patch)
tree093a62a7cd6cf125fb9987e17574c58524df3aa8 /stubs/fdset.c
parentd32749deb61513c5456901f20e19887e1bc3d7f3 (diff)
downloadfocaccia-qemu-474514668b47c9d2148b526e379ffbb6764d9a9e.tar.gz
focaccia-qemu-474514668b47c9d2148b526e379ffbb6764d9a9e.zip
monitor: add lock to protect mon_fdsets
Introduce a new global big lock for mon_fdsets.  Take it where needed.

The monitor_fdset_get_fd() handling is a bit tricky: now we need to call
qemu_mutex_unlock() which might pollute errno, so we need to make sure
the correct errno be passed up to the callers.  To make things simpler,
we let monitor_fdset_get_fd() return the -errno directly when error
happens, then in qemu_open() we move it back into errno.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180608035511.7439-8-peterx@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'stubs/fdset.c')
-rw-r--r--stubs/fdset.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stubs/fdset.c b/stubs/fdset.c
index 6020cf28c8..4f3edf2ea4 100644
--- a/stubs/fdset.c
+++ b/stubs/fdset.c
@@ -14,7 +14,7 @@ int monitor_fdset_dup_fd_find(int dup_fd)
 
 int monitor_fdset_get_fd(int64_t fdset_id, int flags)
 {
-    return -1;
+    return -ENOENT;
 }
 
 void monitor_fdset_dup_fd_remove(int dupfd)