kern

view include/kdef.h @ 72:3941e82b07f2

- implemented syscalls: exit, waitpid, getppid - moved sys_whatever functions out of syscall.c into more reasonable files - putting all the definitions that must be synced with userland to include/kdef.h
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 15 Oct 2011 07:45:56 +0300
parents
children 7ff2b4971216
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 #endif /* errno.h */
38 /* --- defines for syscall.h */
39 #if defined(KERNEL) || defined(KDEF_SYSCALL_H)
41 #define SYSCALL_INT 0x80
43 #define SYS_HELLO 0
44 #define SYS_SLEEP 1
45 #define SYS_FORK 2
46 #define SYS_EXIT 3
47 #define SYS_WAITPID 4
48 #define SYS_GETPID 5
49 #define SYS_GETPPID 6
51 #define NUM_SYSCALLS 7
53 #endif /* syscall.h */
55 #endif /* KERNEL_DEFS_H_ */