aboutsummaryrefslogtreecommitdiff
path: root/src/lib/include/kogata/syscall.h
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2016-07-15 23:12:14 +0200
committerAlex Auvolat <alex@adnab.me>2016-07-15 23:12:14 +0200
commit32407e728971006ed3d0885e01c22fb66c8adc57 (patch)
tree89483d39e8e2638383f815d4e73b647334fe2fe9 /src/lib/include/kogata/syscall.h
parentba4e59a1d687173ac5cfa74d26d71d6059dc6bc6 (diff)
downloadkogata-32407e728971006ed3d0885e01c22fb66c8adc57.tar.gz
kogata-32407e728971006ed3d0885e01c22fb66c8adc57.zip
Move stuff around, again
Diffstat (limited to 'src/lib/include/kogata/syscall.h')
-rw-r--r--src/lib/include/kogata/syscall.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/lib/include/kogata/syscall.h b/src/lib/include/kogata/syscall.h
new file mode 100644
index 0000000..378dda2
--- /dev/null
+++ b/src/lib/include/kogata/syscall.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <proto/syscall.h>
+#include <proto/mmap.h>
+#include <proto/fs.h>
+#include <proto/token.h>
+
+#include <kogata/debug.h>
+
+typedef void (*entry_t)(void*);
+
+void dbg_print(const char* str);
+void yield();
+void exit(int code);
+void usleep(int usecs);
+bool sys_new_thread(void* eip, void* esp);
+void exit_thread();
+
+bool mmap(void* addr, size_t size, int mode);
+bool mmap_file(fd_t file, size_t offset, void* addr, size_t size, int mode);
+bool mchmap(void* addr, int mode);
+bool munmap(void* addr);
+
+bool create(const char* name, int type);
+bool delete(const char* name);
+bool move(const char* oldname, const char* newname);
+bool stat(const char* name, stat_t *s);
+
+fd_t open(const char* name, int mode);
+void close(fd_t file);
+size_t read(fd_t file, size_t offset, size_t len, char *buf);
+size_t write(fd_t file, size_t offset, size_t len, const char* buf);
+bool readdir(fd_t file, size_t ent_no, dirent_t *d);
+bool stat_open(fd_t file, stat_t *s);
+int ioctl(fd_t file, int command, void* data);
+int fctl(fd_t file, int command, void* data);
+bool select(sel_fd_t* fds, size_t nfds, int timeout);
+
+fd_pair_t make_channel(bool blocking);
+fd_t make_shm(size_t size);
+bool gen_token(fd_t file, token_t *tok);
+fd_t use_token(token_t *tok);
+
+bool make_fs(const char* name, const char* driver, fd_t source, const char* options);
+bool fs_add_source(const char* fs, fd_t source, const char* options);
+bool fs_subfs(const char* name, const char* orig_fs, const char* root, int ok_modes);
+void fs_remove(const char* name);
+
+pid_t new_proc();
+bool bind_fs(pid_t pid, const char* new_name, const char* fs);
+bool bind_subfs(pid_t pid, const char* new_name, const char* fs, const char* root, int ok_modes);
+bool bind_make_fs(pid_t pid, const char* name, const char* driver, fd_t source, const char* options);
+bool bind_fd(pid_t pid, fd_t new_fd, fd_t fd);
+bool proc_exec(pid_t pid, const char* file);
+bool proc_status(pid_t pid, proc_status_t *s);
+bool proc_kill(pid_t pid, proc_status_t *s);
+void proc_wait(pid_t pid, bool wait, proc_status_t *s);
+
+/* vim: set ts=4 sw=4 tw=0 noet :*/