From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org, Brad Smith <brad@comstyle.com>,
Kamil Rytarowski <kamil@netbsd.org>,
Peter Maydell <peter.maydell@linaro.org>
Cc: "Fam Zheng" <fam@euphon.net>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Li Qiang" <liq3ea@163.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] XXX oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure
Date: Fri, 25 Jan 2019 20:27:18 +0100 [thread overview]
Message-ID: <20190125192719.15339-3-philmd@redhat.com> (raw)
In-Reply-To: <20190125192719.15339-1-philmd@redhat.com>
Previous to OpenBSD 6.3 [1], fcntl(F_SETFL) is not permitted on memory
devices. Do not assert fcntl failures on OpenBSD.
This fixes:
$ lm32-softmmu/qemu-system-lm32
assertion "f != -1" failed: file "util/oslib-posix.c", line 247, function "qemu_set_nonblock"
Abort trap (core dumped)
[1] The fix seems https://github.com/openbsd/src/commit/c2a35b387f9d3c
"fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, so
the memory devices (/dev/null, /dev/zero, etc) need to permit them."
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
util/oslib-posix.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 4ce1ba9ca4..064c3ae2f7 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -244,7 +244,9 @@ void qemu_set_nonblock(int fd)
f = fcntl(fd, F_GETFL);
assert(f != -1);
f = fcntl(fd, F_SETFL, f | O_NONBLOCK);
+#ifndef __OpenBSD__
assert(f != -1);
+#endif
}
int socket_set_fast_reuse(int fd)
--
2.20.1
next prev parent reply other threads:[~2019-01-25 19:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 19:27 [Qemu-devel] [PATCH 0/3] OpenBSD fixes Philippe Mathieu-Daudé
2019-01-25 19:27 ` [Qemu-devel] [PATCH 1/3] configure: Disable W^X on OpenBSD Philippe Mathieu-Daudé
2019-01-28 8:43 ` Thomas Huth
2019-01-28 10:53 ` Philippe Mathieu-Daudé
2019-01-25 19:27 ` Philippe Mathieu-Daudé [this message]
2019-01-28 6:22 ` [Qemu-devel] [PATCH 2/3] XXX oslib-posix: Ignore fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Markus Armbruster
2019-01-28 10:55 ` Philippe Mathieu-Daudé
2019-01-28 9:47 ` Alex Bennée
2019-01-28 10:59 ` Philippe Mathieu-Daudé
2019-01-28 11:03 ` Paolo Bonzini
2019-01-28 15:05 ` Philippe Mathieu-Daudé
2019-01-25 19:27 ` [Qemu-devel] [PATCH 3/3] WIP tests/vm: Run tests on OpenBSD Philippe Mathieu-Daudé
2019-01-28 8:44 ` Thomas Huth
2019-01-28 11:03 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190125192719.15339-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=brad@comstyle.com \
--cc=fam@euphon.net \
--cc=kamil@netbsd.org \
--cc=liq3ea@163.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).