aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-13 22:44:10 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-13 22:44:10 +0100
commit706c69d40fcc46e7d7f170dab932d3c7fcc7c34e (patch)
tree5248ff8712eced5bc4fdd76e9399654ce5224a37 /src/common
parent47e6cd42f0744f6c04b8347093f6549339a856c9 (diff)
downloadkogata-706c69d40fcc46e7d7f170dab932d3c7fcc7c34e.tar.gz
kogata-706c69d40fcc46e7d7f170dab932d3c7fcc7c34e.zip
Begin implementation of syscalls.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/include/syscallid.h40
-rw-r--r--src/common/libc/string.c2
2 files changed, 41 insertions, 1 deletions
diff --git a/src/common/include/syscallid.h b/src/common/include/syscallid.h
new file mode 100644
index 0000000..bfcd37a
--- /dev/null
+++ b/src/common/include/syscallid.h
@@ -0,0 +1,40 @@
+#pragma once
+
+
+#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_MAKE_FS 40
+#define SC_FS_ADD_SRC 41
+#define SC_RM_FS 42
+
+#define SC_NEW_PROC 50
+#define SC_BIND_FS 51 // bind FS to children process
+#define SC_PROC_EXEC 52 // execute binary in process
+
+// much more to do
+
+
+/* vim: set ts=4 sw=4 tw=0 noet :*/
diff --git a/src/common/libc/string.c b/src/common/libc/string.c
index f6c27b4..7aa155d 100644
--- a/src/common/libc/string.c
+++ b/src/common/libc/string.c
@@ -33,7 +33,7 @@ char *strncpy(char *dest, const char *src, size_t n) {
size_t x = strlen(src + 1);
if (n < x) x = n;
memcpy(dest, src, x);
- if (n > x) memset(dest + n, 0, n - x);
+ if (n > x) memset(dest + x, 0, n - x);
return (char*)dest;
}