kern

view include/kdef.h @ 90:7ff2b4971216

started work on the filesystem
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 09 Dec 2011 13:44:15 +0200
parents 3941e82b07f2
children 083849df660b
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
36 #define EBUG 255 /* not implemented yet */
37 #endif /* errno.h */
40 /* --- defines for syscall.h */
41 #if defined(KERNEL) || defined(KDEF_SYSCALL_H)
43 #define SYSCALL_INT 0x80
45 #define SYS_HELLO 0
46 #define SYS_SLEEP 1
47 #define SYS_FORK 2
48 #define SYS_EXIT 3
49 #define SYS_WAITPID 4
50 #define SYS_GETPID 5
51 #define SYS_GETPPID 6
52 #define SYS_MOUNT 7
53 #define SYS_UMOUNT 8
54 #define SYS_OPEN 9
55 #define SYS_CLOSE 10
56 #define SYS_READ 11
57 #define SYS_WRITE 12
58 #define SYS_LSEEK 13
60 /* keep this one more than the last syscall */
61 #define NUM_SYSCALLS 14
63 #endif /* syscall.h */
65 #endif /* KERNEL_DEFS_H_ */