Skip to contentSkip to conversation

Error reporting patches for 2017-01-19

GIT PULL Applied Markus Armbruster 2 participants 4 messages Jan 19, 2017 – Jan 20, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit ab4b92760498e097ff668f0e9c83aa87a2ec1128:

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2017-01-17 16:54:09 +0000)

are available in the git repository at:

git://repo.or.cz/qemu/armbru.git tags/pull-error-2017-01-19

for you to fetch changes up to 0d6b50d474090b9085c595e2475c40cfdc092411:

error: Report certain hints on stderr when no monitor (2017-01-19 15:42:36 +0100)

----------------------------------------------------------------
Error reporting patches for 2017-01-19

----------------------------------------------------------------
Marc-André Lureau (1):
error: Report certain hints on stderr when no monitor

Sascha Silbe (1):
error: error_setg_errno(): errno gets preserved

 include/qapi/error.h | 3 +++
 monitor.c            | 2 ++
 2 files changed, 5 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

[Qemu-devel] [PULL 2/2] error: Report certain hints on stderr when no monitor

From: Marc-André Lureau <[email protected]>

Hints printed with error_printf_unless_qmp() are suppressed outside monitor context. Reproducer:

    $ qemu-system-x86_64 -m 1Z
    qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size

Print to stderr instead. The reproducer now additionally prints:

You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.

Message-Id: <[email protected]>

---
 monitor.c | 2 ++
 1 file changed, 2 insertions(+)
monitor.c +2 -0
index 0841d43..90c5baf 100644
@@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
 {
     if (cur_mon && !monitor_cur_is_qmp()) {
         monitor_vprintf(cur_mon, fmt, ap);
+    } else if (!cur_mon) {
+        vfprintf(stderr, fmt, ap);
     }
 }
 
Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL 1/2] error: error_setg_errno(): errno gets preserved

In reply to Markus Armbruster

From: Sascha Silbe <[email protected]>

C11 allows errno to be clobbered by pretty much any library function call, so in general callers need to take care to save errno before calling other functions.

However, for error reporting functions this is rather awkward and can make the code on the caller side more complicated than necessary. error_setg_errno() already takes care of preserving errno and some functions rely on that, so just promise that we continue to do so in the future.

Message-Id: <[email protected]>

---
 include/qapi/error.h | 3 +++
 1 file changed, 3 insertions(+)
include/qapi/error.h +3 -0
index 0576659..7e532d0 100644
@@ -170,6 +170,9 @@ void error_setg_internal(Error **errp,
  * Just like error_setg(), with @os_error info added to the message.
  * If @os_error is non-zero, ": " + strerror(os_error) is appended to
  * the human-readable error message.
+ *
+ * The value of errno (which usually can get clobbered by almost any
+ * function call) will be preserved.
  */
 #define error_setg_errno(errp, os_error, fmt, ...)                      \
     error_setg_errno_internal((errp), __FILE__, __LINE__, __func__,     \
Signature · 1 line
2.7.4
#3 lore raw
In reply to Markus Armbruster
Quoted 19 lines · Markus Armbruster

The following changes since commit ab4b92760498e097ff668f0e9c83aa87a2ec1128:

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging (2017-01-17 16:54:09 +0000)

are available in the git repository at:

git://repo.or.cz/qemu/armbru.git tags/pull-error-2017-01-19

for you to fetch changes up to 0d6b50d474090b9085c595e2475c40cfdc092411:

error: Report certain hints on stderr when no monitor (2017-01-19 15:42:36 +0100)

----------------------------------------------------------------
Error reporting patches for 2017-01-19

----------------------------------------------------------------
Marc-André Lureau (1):
error: Report certain hints on stderr when no monitor

Quoted 6 lines

Sascha Silbe (1):
error: error_setg_errno(): errno gets preserved

 include/qapi/error.h | 3 +++
 monitor.c            | 2 ++
 2 files changed, 5 insertions(+)

Applied, thanks.

-- PMM