kern

view include/kdef.h @ 93:083849df660b

split the system call implementations out of fs.c into fs_sys.c
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 11 Dec 2011 10:17:58 +0200
parents 7ff2b4971216
children b3351d018ac6
line source
1 /* definitions that must be in-sync between kernel and user space */
2 #ifndef KERNEL_DEFS_H_
3 #define KERNEL_DEFS_H_
5 /* --- defines for sys/wait.h */
6 #if defined(KERNEL) || defined(KDEF_WAIT_H)
7 #define WNOHANG 1
9 #define WEXITSTATUS(s) ((s) & _WSTATUS_MASK)
10 #define WCOREDUMP(s) ((s) & _WCORE_BIT)
12 #define WIFEXITED(s) (_WREASON(s) == _WREASON_EXITED)
13 #define WIFSIGNALED(s) (_WREASON(s) == _WREASON_SIGNALED)
15 /* implementation details */
16 #define _WSTATUS_MASK 0xff
18 #define _WREASON_SHIFT 8
19 #define _WREASON_MASK 0xf00
20 #define _WREASON(s) (((s) & _WREASON_MASK) >> _WREASON_SHIFT)
22 #define _WREASON_EXITED 1
23 #define _WREASON_SIGNALED 2
25 #define _WCORE_BIT 0x1000
26 #endif /* sys/wait.h */
30 /* --- defines for errno.h */
31 #if defined(KERNEL) || defined(KDEF_ERRNO_H)
32 #define EAGAIN 1
33 #define EINVAL 2
34 #define ECHILD 3
35 #define EBUSY 4
36 #define ENOMEM 5
37 #define EIO 6
39 #define EBUG 127 /* error: feature not implemented yet */
40 #endif /* errno.h */
43 /* --- defines for syscall.h */
44 #if defined(KERNEL) || defined(KDEF_SYSCALL_H)
46 #define SYSCALL_INT 0x80
48 #define SYS_HELLO 0
49 #define SYS_SLEEP 1
50 #define SYS_FORK 2
51 #define SYS_EXIT 3
52 #define SYS_WAITPID 4
53 #define SYS_GETPID 5
54 #define SYS_GETPPID 6
55 #define SYS_MOUNT 7
56 #define SYS_UMOUNT 8
57 #define SYS_OPEN 9
58 #define SYS_CLOSE 10
59 #define SYS_READ 11
60 #define SYS_WRITE 12
61 #define SYS_LSEEK 13
63 /* keep this one more than the last syscall */
64 #define NUM_SYSCALLS 14
66 #endif /* syscall.h */
68 #endif /* KERNEL_DEFS_H_ */