From 474514668b47c9d2148b526e379ffbb6764d9a9e Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Fri, 8 Jun 2018 11:55:11 +0800 Subject: 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 Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu Message-Id: <20180608035511.7439-8-peterx@redhat.com> Signed-off-by: Markus Armbruster --- stubs/fdset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stubs/fdset.c') diff --git a/stubs/fdset.c b/stubs/fdset.c index 6020cf2..4f3edf2 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) -- cgit v1.1