kern

annotate include/kdef.h @ 91:f83f50c17c3b

continuing with the fs added strtol and strstr to klibc
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 09 Dec 2011 15:29:54 +0200
parents 3941e82b07f2
children 083849df660b
rev   line source
nuclear@72 1 /* definitions that must be in-sync between kernel and user space */
nuclear@72 2 #ifndef KERNEL_DEFS_H_
nuclear@72 3 #define KERNEL_DEFS_H_
nuclear@72 4
nuclear@72 5 /* --- defines for sys/wait.h */
nuclear@72 6 #if defined(KERNEL) || defined(KDEF_WAIT_H)
nuclear@72 7 #define WNOHANG 1
nuclear@72 8
nuclear@72 9 #define WEXITSTATUS(s) ((s) & _WSTATUS_MASK)
nuclear@72 10 #define WCOREDUMP(s) ((s) & _WCORE_BIT)
nuclear@72 11
nuclear@72 12 #define WIFEXITED(s) (_WREASON(s) == _WREASON_EXITED)
nuclear@72 13 #define WIFSIGNALED(s) (_WREASON(s) == _WREASON_SIGNALED)
nuclear@72 14
nuclear@72 15 /* implementation details */
nuclear@72 16 #define _WSTATUS_MASK 0xff
nuclear@72 17
nuclear@72 18 #define _WREASON_SHIFT 8
nuclear@72 19 #define _WREASON_MASK 0xf00
nuclear@72 20 #define _WREASON(s) (((s) & _WREASON_MASK) >> _WREASON_SHIFT)
nuclear@72 21
nuclear@72 22 #define _WREASON_EXITED 1
nuclear@72 23 #define _WREASON_SIGNALED 2
nuclear@72 24
nuclear@72 25 #define _WCORE_BIT 0x1000
nuclear@72 26 #endif /* sys/wait.h */
nuclear@72 27
nuclear@72 28
nuclear@72 29
nuclear@72 30 /* --- defines for errno.h */
nuclear@72 31 #if defined(KERNEL) || defined(KDEF_ERRNO_H)
nuclear@72 32 #define EAGAIN 1
nuclear@72 33 #define EINVAL 2
nuclear@72 34 #define ECHILD 3
nuclear@90 35
nuclear@90 36 #define EBUG 255 /* not implemented yet */
nuclear@72 37 #endif /* errno.h */
nuclear@72 38
nuclear@72 39
nuclear@72 40 /* --- defines for syscall.h */
nuclear@72 41 #if defined(KERNEL) || defined(KDEF_SYSCALL_H)
nuclear@72 42
nuclear@72 43 #define SYSCALL_INT 0x80
nuclear@72 44
nuclear@72 45 #define SYS_HELLO 0
nuclear@72 46 #define SYS_SLEEP 1
nuclear@72 47 #define SYS_FORK 2
nuclear@72 48 #define SYS_EXIT 3
nuclear@72 49 #define SYS_WAITPID 4
nuclear@72 50 #define SYS_GETPID 5
nuclear@72 51 #define SYS_GETPPID 6
nuclear@90 52 #define SYS_MOUNT 7
nuclear@90 53 #define SYS_UMOUNT 8
nuclear@90 54 #define SYS_OPEN 9
nuclear@90 55 #define SYS_CLOSE 10
nuclear@90 56 #define SYS_READ 11
nuclear@90 57 #define SYS_WRITE 12
nuclear@90 58 #define SYS_LSEEK 13
nuclear@72 59
nuclear@90 60 /* keep this one more than the last syscall */
nuclear@90 61 #define NUM_SYSCALLS 14
nuclear@72 62
nuclear@72 63 #endif /* syscall.h */
nuclear@72 64
nuclear@72 65 #endif /* KERNEL_DEFS_H_ */