diff options
Diffstat (limited to 'lib/sys')
| -rw-r--r-- | lib/sys/getdents.h | 18 | ||||
| -rw-r--r-- | lib/sys/io.h | 16 | ||||
| -rw-r--r-- | lib/sys/open.h | 2 |
3 files changed, 33 insertions, 3 deletions
diff --git a/lib/sys/getdents.h b/lib/sys/getdents.h new file mode 100644 index 0000000..b5a0c74 --- /dev/null +++ b/lib/sys/getdents.h @@ -0,0 +1,18 @@ +#ifndef GETDENTS_H +#define GETDENTS_H + +#include "syscalls.h" + +struct dirent { + unsigned long d_ino; + unsigned long d_off; + unsigned short d_reclen; + char d_name[]; +}; + +static int getdents(unsigned int fd, char *buf, unsigned int count) +{ + return syscall(GETDENTS, fd, buf, count); +} + +#endif diff --git a/lib/sys/io.h b/lib/sys/io.h index 4222c4d..c518fcb 100644 --- a/lib/sys/io.h +++ b/lib/sys/io.h @@ -10,8 +10,18 @@ #define STDOUT_FD 1 #define STDERR_FD 2 -#define FILE_READ_ONLY 0 -#define FILE_WRITE_ONLY 1 -#define FILE_READ_WRITE 2 +#define OPEN_READ_ONLY 0 +#define OPEN_WRITE_ONLY 1 +#define OPEN_READ_WRITE 2 +#define OPEN_DIRECTORY 0200000 + +#define TYPE_UNKNOWN 0 +#define TYPE_FIFO 1 +#define TYPE_CHAR_DEVICE 2 +#define TYPE_DIRECTORY 4 +#define TYPE_BLOCK_DEVICE 6 +#define TYPE_REGULAR_FILE 8 +#define TYPE_SYM_LINK 10 +#define TYPE_SOCKET 12 #endif diff --git a/lib/sys/open.h b/lib/sys/open.h index 5aeab6d..e01da63 100644 --- a/lib/sys/open.h +++ b/lib/sys/open.h @@ -3,6 +3,8 @@ #include "syscalls.h" + + static int open(const char *filename, int flags, int mode) { return syscall(OPEN, filename, flags, mode); |