diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-04-17 23:42:18 +0200 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-04-17 23:42:18 +0200 |
commit | b3f93e87f773c0e9099f256c78c1485fd7ce1dce (patch) | |
tree | 164fa334e09d5e5dbcb3eec8594a8de1f49b2b73 /lib/src | |
parent | 1bcaa7aceefad99c7bda9cb7bf6fcc5b48b53a75 (diff) | |
download | dynld-b3f93e87f773c0e9099f256c78c1485fd7ce1dce.tar.gz dynld-b3f93e87f773c0e9099f256c78c1485fd7ce1dce.zip |
io: make use of write syscall wrapper
Diffstat (limited to 'lib/src')
-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; } |