From 2e79a2e5af3affa7a6a3becdffb1c91d89af90af Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 11 Jul 2022 21:54:51 +0200 Subject: user: reorganize the userland sources --- src/user/lib/stdlib.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/user/lib/stdlib.h (limited to 'src/user/lib/stdlib.h') diff --git a/src/user/lib/stdlib.h b/src/user/lib/stdlib.h new file mode 100644 index 0000000..9bbcc5f --- /dev/null +++ b/src/user/lib/stdlib.h @@ -0,0 +1,23 @@ +#pragma once +#include +#include +#include +#include + +int printf(const char *fmt, ...); +int snprintf(char *str, size_t len, const char *fmt, ...); + +int _klogf(const char *fmt, ...); // for kernel debugging only + +typedef struct { + int fd; + int pos; + bool eof; +} libc_file; +libc_file *file_open(const char *path, int flags); +libc_file *file_reopen(libc_file*, const char *path, int flags); +int file_read(libc_file*, char *buf, size_t len); +int file_write(libc_file*, const char *buf, size_t len); +void file_close(libc_file*); + +extern libc_file *stdin, *stdout; -- cgit v1.2.3