From 6dd488b87fdc47fb377ba648a6cd598bdab87f59 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 8 Mar 2015 19:07:48 +0100 Subject: Implement select ; add two tests for channels. --- src/lib/include/syscall.h | 3 ++- src/lib/libkogata/syscall.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/include/syscall.h b/src/lib/include/syscall.h index 7579be3..79e930f 100644 --- a/src/lib/include/syscall.h +++ b/src/lib/include/syscall.h @@ -17,7 +17,7 @@ void dbg_print(const char* str); void yield(); void exit(int code); void usleep(int usecs); -bool new_thread(entry_t entry, void* data); +bool sys_new_thread(void* eip, void* esp); void exit_thread(); bool mmap(void* addr, size_t size, int mode); @@ -38,6 +38,7 @@ 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 get_mode(fd_t file); +bool select(sel_fd_t* fds, size_t nfds, int timeout); fd_pair_t make_channel(bool blocking); bool gen_token(fd_t file, token_t *tok); diff --git a/src/lib/libkogata/syscall.c b/src/lib/libkogata/syscall.c index 7ae0283..b724e69 100644 --- a/src/lib/libkogata/syscall.c +++ b/src/lib/libkogata/syscall.c @@ -39,9 +39,8 @@ void usleep(int usecs) { call(SC_USLEEP, usecs, 0, 0, 0, 0); } -bool new_thread(entry_t entry, void* data) { - // TODO - return false; +bool sys_new_thread(void* eip, void* esp) { + return call(SC_NEW_THREAD, (uint32_t)eip, (uint32_t)esp, 0, 0, 0); } void exit_thread() { @@ -98,6 +97,9 @@ int ioctl(fd_t file, int command, void* data) { int get_mode(fd_t file) { return call(SC_GET_MODE, file, 0, 0, 0, 0); } +bool select(sel_fd_t* fds, size_t nfds, int timeout) { + return call(SC_SELECT, (uint32_t)fds, nfds, timeout, 0, 0); +} fd_pair_t make_channel(bool blocking) { fd_pair_t ret; -- cgit v1.2.3