summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/errno.h42
-rw-r--r--src/include/tce/syscalls.h38
-rw-r--r--src/include/tce/vfs.h42
-rw-r--r--src/include/types.h17
4 files changed, 139 insertions, 0 deletions
diff --git a/src/include/errno.h b/src/include/errno.h
new file mode 100644
index 0000000..fe60d81
--- /dev/null
+++ b/src/include/errno.h
@@ -0,0 +1,42 @@
+#ifndef _DEF_ERRNO_H
+#define _DEF_ERRNO_H
+
+// Copied from /usr/include/asm-generic/errno-base.h on a standard Linux system
+// Most of these will NOT be used here.
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+
+#endif
diff --git a/src/include/tce/syscalls.h b/src/include/tce/syscalls.h
new file mode 100644
index 0000000..6c67523
--- /dev/null
+++ b/src/include/tce/syscalls.h
@@ -0,0 +1,38 @@
+#ifndef DEF_TCE_SYSCALLS_H
+#define DEF_TCE_SYSCALLS_H
+
+#define SC_THREAD_EXIT 1
+#define SC_SCHEDULE 2
+#define SC_THREAD_SLEEP 3
+#define SC_PROCESS_EXIT 4
+#define SC_PRINTK 5
+#define SC_THREAD_NEW 6
+#define SC_IRQ_WAIT 7
+#define SC_PROC_PRIV 8
+
+#define SC_SBRK 10
+#define SC_BRK 11
+// NOT YET IMPLEMENTED
+#define SC_MMAP 12
+#define SC_MUNMAP 13
+
+#define SC_OPEN 20
+#define SC_OPEN_RELATIVE 21
+#define SC_STAT 22
+#define SC_STAT_RELATIVE 23
+#define SC_STATF 24
+#define SC_CLOSE 25
+#define SC_READ 26
+#define SC_WRITE 27
+#define SC_LINK 28
+
+
+// ERRORS
+#define E_NOT_IMPLEMENTED -1
+#define E_NOT_FOUND -2
+#define E_INVALID_FD -3
+#define E_TOO_SHORT -4 // not enough space for data to be copied to
+#define E_INVALID_RANGE -5
+#define E_INVALID -6 // anything went wrong - invalid parameter, usually
+
+#endif
diff --git a/src/include/tce/vfs.h b/src/include/tce/vfs.h
new file mode 100644
index 0000000..20ea03b
--- /dev/null
+++ b/src/include/tce/vfs.h
@@ -0,0 +1,42 @@
+#ifndef DEF_TCE_VFS_H
+#define DEF_TCE_VFS_H
+
+#include <types.h>
+
+typedef size_t FILE;
+
+typedef struct _file_info {
+ uint32_t type;
+ uint32_t dev_type;
+ uint32_t mode;
+ uint32_t uid, gid;
+ size_t size;
+} file_info;
+
+// file open flags
+#define FM_READ 0x00000001
+#define FM_WRITE 0x00000002
+#define FM_APPEND 0x00000004
+#define FM_TRUNC 0x00000008
+#define FM_CREATE 0x00000010
+#define FM_DELETE 0x00000020
+
+// link modes
+#define LM_SYMLINK 1
+#define LM_HARDLINK 2
+#define LM_MOUNT 3
+#define LM_OUTPUT_TO 4
+
+// file type flags
+#define FT_FILE 0x00000001
+#define FT_DIR 0x00000002
+#define FT_SYMLINK 0x00000004
+#define FT_DEV 0x00000008
+#define FT_TERMINAL 0x00000010
+
+// device types
+#define DT_BLOCK 1
+#define DT_KEYBOARD 2
+#define DT_DISPLAY 3
+
+#endif
diff --git a/src/include/types.h b/src/include/types.h
new file mode 100644
index 0000000..e7c1a35
--- /dev/null
+++ b/src/include/types.h
@@ -0,0 +1,17 @@
+#ifndef DEF_TYPES_H
+#define DEF_TYPES_H
+
+typedef unsigned long long uint64_t;
+typedef unsigned long int uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+typedef long long int64_t;
+typedef int int32_t;
+typedef short int16_t;
+typedef char int8_t;
+
+typedef long unsigned int size_t;
+
+#define NULL 0
+
+#endif