diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-19 18:25:29 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-19 18:25:29 +0100 |
commit | 277b329c5609b8172ad0c142117edfa9a08279da (patch) | |
tree | 23dc957e64e5b67e61072516bea30d650ffcefdd /src/common | |
parent | 408faed4df730384538aaa0e338ae8ea7abe400d (diff) | |
download | kogata-277b329c5609b8172ad0c142117edfa9a08279da.tar.gz kogata-277b329c5609b8172ad0c142117edfa9a08279da.zip |
Implement basic syscalls...
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/include/syscallproto.h | 44 | ||||
-rw-r--r-- | src/common/libc/string.c | 2 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/common/include/syscallproto.h b/src/common/include/syscallproto.h index bfcd37a..8c86762 100644 --- a/src/common/include/syscallproto.h +++ b/src/common/include/syscallproto.h @@ -3,28 +3,28 @@ #define SC_MAX 128 // maximum number of syscalls -#define SC_DBG_PRINT 0 -#define SC_EXIT 1 -#define SC_YIELD 2 - -#define SC_MMAP 10 -#define SC_MMAP_FILE 11 -#define SC_MCHMAP 12 -#define SC_MUNMAP 13 - -#define SC_CREATE 20 -#define SC_DELETE 21 -#define SC_MOVE 22 -#define SC_STAT 23 -#define SC_IOCTL 24 - -#define SC_OPEN 30 -#define SC_CLOSE 31 -#define SC_READ 32 -#define SC_WRITE 33 -#define SC_READDIR 34 -#define SC_STAT_OPEN 35 // stat on open file handle -#define SC_GET_MODE 36 // get mode for open file handle +#define SC_DBG_PRINT 0 // args: msg, msg_strlen +#define SC_EXIT 1 // args: code +#define SC_YIELD 2 // args: () + +#define SC_MMAP 10 // args: addr, size, mode +#define SC_MMAP_FILE 11 // args: handle, offset, addr, size, mode +#define SC_MCHMAP 12 // args: addr, new_mode +#define SC_MUNMAP 13 // args: addr + +#define SC_CREATE 20 // args: file, file_strlen, type +#define SC_DELETE 21 // args: file, file_strlen +#define SC_MOVE 22 // args: old_file, old_file_strlen, new_file, new_file_strlen +#define SC_STAT 23 // args: file, file_strlen, out stat_t* data +#define SC_IOCTL 24 // args: file, file_strlen, code, out void* data + +#define SC_OPEN 30 // args: file, file_strlen, mode +#define SC_CLOSE 31 // args: fd +#define SC_READ 32 // args: fd, offset, size, out char* data +#define SC_WRITE 33 // args: fd, offset, size, data +#define SC_READDIR 34 // args: fd, out dirent_t *data +#define SC_STAT_OPEN 35 // args: fd, out stat_t *data -- stat on open file handle +#define SC_GET_MODE 36 // args: fd -- get mode for open file handle #define SC_MAKE_FS 40 #define SC_FS_ADD_SRC 41 diff --git a/src/common/libc/string.c b/src/common/libc/string.c index 7aa155d..dfc93e6 100644 --- a/src/common/libc/string.c +++ b/src/common/libc/string.c @@ -30,7 +30,7 @@ char *strcpy(char *dest, const char *src) { } char *strncpy(char *dest, const char *src, size_t n) { - size_t x = strlen(src + 1); + size_t x = strlen(src); if (n < x) x = n; memcpy(dest, src, x); if (n > x) memset(dest + x, 0, n - x); |