kern
annotate include/kdef.h @ 98:921a264297a4
merged the filesystem stuff
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 17 Apr 2014 17:03:30 +0300 |
parents | 07fe6a614185 |
children |
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@94 | 32 #define EFOO 1 /* I just like to return -1 some times :) */ |
nuclear@90 | 33 |
nuclear@96 | 34 #define EAGAIN 2 |
nuclear@96 | 35 #define EINVAL 3 |
nuclear@96 | 36 #define ECHILD 4 |
nuclear@96 | 37 #define EBUSY 5 |
nuclear@96 | 38 #define ENOMEM 6 |
nuclear@96 | 39 #define EIO 7 |
nuclear@96 | 40 #define ENOENT 8 |
nuclear@96 | 41 #define ENAMETOOLONG 9 |
nuclear@96 | 42 #define ENOSPC 10 |
nuclear@96 | 43 #define EPERM 11 |
nuclear@97 | 44 #define ENOTDIR 12 |
nuclear@94 | 45 |
nuclear@94 | 46 #define EBUG 127 /* for missing features and known bugs */ |
nuclear@72 | 47 #endif /* errno.h */ |
nuclear@72 | 48 |
nuclear@72 | 49 |
nuclear@72 | 50 /* --- defines for syscall.h */ |
nuclear@72 | 51 #if defined(KERNEL) || defined(KDEF_SYSCALL_H) |
nuclear@72 | 52 |
nuclear@72 | 53 #define SYSCALL_INT 0x80 |
nuclear@72 | 54 |
nuclear@72 | 55 #define SYS_HELLO 0 |
nuclear@72 | 56 #define SYS_SLEEP 1 |
nuclear@72 | 57 #define SYS_FORK 2 |
nuclear@72 | 58 #define SYS_EXIT 3 |
nuclear@72 | 59 #define SYS_WAITPID 4 |
nuclear@72 | 60 #define SYS_GETPID 5 |
nuclear@72 | 61 #define SYS_GETPPID 6 |
nuclear@90 | 62 #define SYS_MOUNT 7 |
nuclear@90 | 63 #define SYS_UMOUNT 8 |
nuclear@90 | 64 #define SYS_OPEN 9 |
nuclear@90 | 65 #define SYS_CLOSE 10 |
nuclear@90 | 66 #define SYS_READ 11 |
nuclear@90 | 67 #define SYS_WRITE 12 |
nuclear@90 | 68 #define SYS_LSEEK 13 |
nuclear@72 | 69 |
nuclear@90 | 70 /* keep this one more than the last syscall */ |
nuclear@90 | 71 #define NUM_SYSCALLS 14 |
nuclear@72 | 72 |
nuclear@72 | 73 #endif /* syscall.h */ |
nuclear@72 | 74 |
nuclear@96 | 75 /* --- defines for sys/stat.h */ |
nuclear@96 | 76 #if defined(KERNEL) || defined(STAT_H) |
nuclear@96 | 77 |
nuclear@96 | 78 #define S_IFMT 0170000 /* bit mask for the file type bit fields */ |
nuclear@96 | 79 #define S_IFSOCK 0140000 /* socket */ |
nuclear@96 | 80 #define S_IFLNK 0120000 /* symbolic link */ |
nuclear@96 | 81 #define S_IFREG 0100000 /* regular file */ |
nuclear@96 | 82 #define S_IFBLK 0060000 /* block device */ |
nuclear@96 | 83 #define S_IFDIR 0040000 /* directory */ |
nuclear@96 | 84 #define S_IFCHR 0020000 /* character device */ |
nuclear@96 | 85 #define S_IFIFO 0010000 /* FIFO */ |
nuclear@96 | 86 |
nuclear@96 | 87 #define S_ISUID 0004000 /* set UID bit */ |
nuclear@96 | 88 #define S_ISGID 0002000 /* set-group-ID bit (see below) */ |
nuclear@96 | 89 #define S_ISVTX 0001000 /* sticky bit (see below) */ |
nuclear@96 | 90 |
nuclear@96 | 91 #define S_IRWXU 00700 /* mask for file owner permissions */ |
nuclear@96 | 92 #define S_IRUSR 00400 /* owner has read permission */ |
nuclear@96 | 93 #define S_IWUSR 00200 /* owner has write permission */ |
nuclear@96 | 94 #define S_IXUSR 00100 /* owner has execute permission */ |
nuclear@96 | 95 #define S_IRWXG 00070 /* mask for group permissions */ |
nuclear@96 | 96 #define S_IRGRP 00040 /* group has read permission */ |
nuclear@96 | 97 #define S_IWGRP 00020 /* group has write permission */ |
nuclear@96 | 98 #define S_IXGRP 00010 /* group has execute permission */ |
nuclear@96 | 99 #define S_IRWXO 00007 /* mask for permissions for others (not in group) */ |
nuclear@96 | 100 #define S_IROTH 00004 /* others have read permission */ |
nuclear@96 | 101 #define S_IWOTH 00002 /* others have write permission */ |
nuclear@96 | 102 #define S_IXOTH 00001 /* others have execute permission */ |
nuclear@96 | 103 |
nuclear@96 | 104 #endif /* sys/stat.h */ |
nuclear@96 | 105 |
nuclear@96 | 106 |
nuclear@72 | 107 #endif /* KERNEL_DEFS_H_ */ |