From: Ilya Maximets <i.maximets@samsung.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Ilya Maximets" <i.maximets@samsung.com>
Subject: [Qemu-devel] [PATCH v3 4/4] memfd: improve error messages
Date: Mon, 11 Mar 2019 16:58:50 +0300 [thread overview]
Message-ID: <20190311135850.6537-5-i.maximets@samsung.com> (raw)
In-Reply-To: <20190311135850.6537-1-i.maximets@samsung.com>
This gives more information about the failure.
Additionally 'ENOSYS' returned for a non-Linux platforms instead of
'errno', which is not initilaized in this case.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
util/memfd.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/util/memfd.c b/util/memfd.c
index 393d23da96..00334e5b21 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -71,14 +71,18 @@ int qemu_memfd_create(const char *name, size_t size, bool hugetlb,
}
mfd = memfd_create(name, flags);
if (mfd < 0) {
+ error_setg_errno(errp, errno,
+ "failed to create memfd with flags 0x%x", flags);
goto err;
}
if (ftruncate(mfd, size) == -1) {
+ error_setg_errno(errp, errno, "failed to resize memfd to %zu", size);
goto err;
}
if (seals && fcntl(mfd, F_ADD_SEALS, seals) == -1) {
+ error_setg_errno(errp, errno, "failed to add seals 0x%x", seals);
goto err;
}
@@ -88,8 +92,9 @@ err:
if (mfd >= 0) {
close(mfd);
}
+#else
+ error_setg_errno(errp, ENOSYS, "failed to create memfd");
#endif
- error_setg_errno(errp, errno, "failed to create memfd");
return -1;
}
--
2.17.1
prev parent reply other threads:[~2019-03-11 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190311135911eucas1p2612665dccba27cc8b5d81b67a70480c6@eucas1p2.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 0/4] memfd fixes Ilya Maximets
[not found] ` <CGME20190311135916eucas1p27b50ca29c84af5f7529d56fd43a2964d@eucas1p2.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 1/4] hostmem-memfd: disable for systems wihtout sealing support Ilya Maximets
[not found] ` <CGME20190311135919eucas1p11c7fad66884a0303b2637cd2d2b05cad@eucas1p1.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 2/4] memfd: always check for MFD_CLOEXEC Ilya Maximets
[not found] ` <CGME20190311135922eucas1p2e131e72beea41ae584761ea5a62a948c@eucas1p2.samsung.com>
2019-03-11 13:58 ` [Qemu-devel] [PATCH v3 3/4] memfd: set up correct errno if not supported Ilya Maximets
[not found] ` <CGME20190311135925eucas1p21442eda0f28a7e6ae1f9a238ca0a4f0d@eucas1p2.samsung.com>
2019-03-11 13:58 ` Ilya Maximets [this message]
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=20190311135850.6537-5-i.maximets@samsung.com \
--to=i.maximets@samsung.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).