summaryrefslogtreecommitdiff
path: root/src/user/lib/stdlib.h
diff options
context:
space:
mode:
authordzwdz2022-07-11 21:54:51 +0200
committerdzwdz2022-07-11 21:54:51 +0200
commit2e79a2e5af3affa7a6a3becdffb1c91d89af90af (patch)
treec253761c4ec010ad14b08f9ee8dfc1a50411b30f /src/user/lib/stdlib.h
parent6c01d9a7e34e1fccc2775b0e2187ac5e50dd4392 (diff)
user: reorganize the userland sources
Diffstat (limited to 'src/user/lib/stdlib.h')
-rw-r--r--src/user/lib/stdlib.h23
1 files changed, 23 insertions, 0 deletions
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 <user/lib/malloc.h>
+#include <shared/mem.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+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;