aboutsummaryrefslogtreecommitdiff
path: root/util/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/log.c')
-rw-r--r--util/log.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/log.c b/util/log.c
index b87d399..58d24de 100644
--- a/util/log.c
+++ b/util/log.c
@@ -558,3 +558,15 @@ void qemu_print_log_usage(FILE *f)
fprintf(f, "\nUse \"-d trace:help\" to get a list of trace events.\n\n");
#endif
}
+
+#ifdef CONFIG_HAVE_RUST
+ssize_t rust_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
+{
+ /*
+ * Same as fwrite, but return -errno because Rust libc does not provide
+ * portable access to errno. :(
+ */
+ int ret = fwrite(ptr, size, nmemb, stream);
+ return ret < 0 ? -errno : 0;
+}
+#endif