diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2022-04-04 22:45:03 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-06-28 03:09:51 +0100 |
commit | 7750ee45a62c7834f170f817232e432b8d2a14d3 (patch) | |
tree | 0d796cbb17c4ff3227daa2a3cbc7fd583fdffb53 /arch/sandbox | |
parent | ebcaafcded40da8ae6cb4234c2ba9901c7bee644 (diff) | |
download | u-boot-7750ee45a62c7834f170f817232e432b8d2a14d3.zip u-boot-7750ee45a62c7834f170f817232e432b8d2a14d3.tar.gz u-boot-7750ee45a62c7834f170f817232e432b8d2a14d3.tar.bz2 |
sandbox: add function os_printf()
Before setting up the devices U-Boot's printf() function cannot be used
for console output. Provide function os_printf() to print to stderr.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/os.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 3b23060..f937991 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) |