kern
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/include/kdef.h Sat Oct 15 07:45:56 2011 +0300 1.3 @@ -0,0 +1,55 @@ 1.4 +/* definitions that must be in-sync between kernel and user space */ 1.5 +#ifndef KERNEL_DEFS_H_ 1.6 +#define KERNEL_DEFS_H_ 1.7 + 1.8 +/* --- defines for sys/wait.h */ 1.9 +#if defined(KERNEL) || defined(KDEF_WAIT_H) 1.10 +#define WNOHANG 1 1.11 + 1.12 +#define WEXITSTATUS(s) ((s) & _WSTATUS_MASK) 1.13 +#define WCOREDUMP(s) ((s) & _WCORE_BIT) 1.14 + 1.15 +#define WIFEXITED(s) (_WREASON(s) == _WREASON_EXITED) 1.16 +#define WIFSIGNALED(s) (_WREASON(s) == _WREASON_SIGNALED) 1.17 + 1.18 +/* implementation details */ 1.19 +#define _WSTATUS_MASK 0xff 1.20 + 1.21 +#define _WREASON_SHIFT 8 1.22 +#define _WREASON_MASK 0xf00 1.23 +#define _WREASON(s) (((s) & _WREASON_MASK) >> _WREASON_SHIFT) 1.24 + 1.25 +#define _WREASON_EXITED 1 1.26 +#define _WREASON_SIGNALED 2 1.27 + 1.28 +#define _WCORE_BIT 0x1000 1.29 +#endif /* sys/wait.h */ 1.30 + 1.31 + 1.32 + 1.33 +/* --- defines for errno.h */ 1.34 +#if defined(KERNEL) || defined(KDEF_ERRNO_H) 1.35 +#define EAGAIN 1 1.36 +#define EINVAL 2 1.37 +#define ECHILD 3 1.38 +#endif /* errno.h */ 1.39 + 1.40 + 1.41 +/* --- defines for syscall.h */ 1.42 +#if defined(KERNEL) || defined(KDEF_SYSCALL_H) 1.43 + 1.44 +#define SYSCALL_INT 0x80 1.45 + 1.46 +#define SYS_HELLO 0 1.47 +#define SYS_SLEEP 1 1.48 +#define SYS_FORK 2 1.49 +#define SYS_EXIT 3 1.50 +#define SYS_WAITPID 4 1.51 +#define SYS_GETPID 5 1.52 +#define SYS_GETPPID 6 1.53 + 1.54 +#define NUM_SYSCALLS 7 1.55 + 1.56 +#endif /* syscall.h */ 1.57 + 1.58 +#endif /* KERNEL_DEFS_H_ */