aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/sandbox/cpu/os.c13
-rw-r--r--include/os.h7
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 3b230606a97..f937991139c 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -12,6 +12,7 @@
#include <getopt.h>
#include <setjmp.h>
#include <signal.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@@ -54,6 +55,18 @@ ssize_t os_write(int fd, const void *buf, size_t count)
return write(fd, buf, count);
}
+int os_printf(const char *fmt, ...)
+{
+ va_list args;
+ int i;
+
+ va_start(args, fmt);
+ i = vfprintf(stdout, fmt, args);
+ va_end(args);
+
+ return i;
+}
+
off_t os_lseek(int fd, off_t offset, int whence)
{
if (whence == OS_SEEK_SET)
diff --git a/include/os.h b/include/os.h
index 10e198cf503..148178787bc 100644
--- a/include/os.h
+++ b/include/os.h
@@ -17,6 +17,13 @@ struct rtc_time;
struct sandbox_state;
/**
+ * os_printf() - print directly to OS console
+ *
+ * @format: format string
+ */
+int os_printf(const char *format, ...);
+
+/**
* Access to the OS read() system call
*
* @fd: File descriptor as returned by os_open()