diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-04-28 23:08:45 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-04-28 23:08:45 +0200 |
commit | d367355eb4c3569d422034b69737d8dc7022e13e (patch) | |
tree | f9f6768228235f4712466d65edeb0b745d904833 /lib/src/io.c | |
parent | cf97ecd5b52c2f7a8953fd1674742d46fd15418a (diff) | |
parent | fc137e7d0263a0fe908ca1a150e34a9c8b9902d4 (diff) | |
download | dynld-d367355eb4c3569d422034b69737d8dc7022e13e.tar.gz dynld-d367355eb4c3569d422034b69737d8dc7022e13e.zip |
Merge branch 'dev04'
Diffstat (limited to 'lib/src/io.c')
-rw-r--r-- | lib/src/io.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/src/io.c b/lib/src/io.c index b5e0dc5..5194042 100644 --- a/lib/src/io.c +++ b/lib/src/io.c @@ -1,10 +1,9 @@ // Copyright (c) 2020 Johannes Stoelp -#include <io.h> #include <fmt.h> +#include <io.h> #include <syscall.h> - -#include <asm/unistd.h> +#include <syscalls.h> // `pfmt` uses fixed-size buffer on the stack for formating the message // (for simplicity and since we don't impl buffered I/O). @@ -21,14 +20,14 @@ static int vdfmt(int fd, const char* fmt, va_list ap) { int ret = vfmt(buf, sizeof(buf), fmt, ap); if (ret > MAX_PRINTF_LEN - 1) { - syscall3(__NR_write, fd, buf, MAX_PRINTF_LEN - 1); + write(fd, buf, MAX_PRINTF_LEN - 1); static const char warn[] = "\npfmt: Message truncated, max length can be configured by defining MAX_PRINTF_LEN\n"; - syscall3(__NR_write, FD_STDERR, warn, sizeof(warn)); + write(FD_STDERR, warn, sizeof(warn)); return MAX_PRINTF_LEN - 1; } - syscall3(__NR_write, fd, buf, ret); + write(fd, buf, ret); return ret; } |