diff options
author | dzwdz | 2021-08-24 16:25:50 +0200 |
---|---|---|
committer | dzwdz | 2021-08-24 16:25:50 +0200 |
commit | 83fa1f34ea744da7d26997179a0dd6af751dd8b0 (patch) | |
tree | 0794348a02acebf36ecab9ad665bc0f0f75fbfee /src/kernel/fd.h | |
parent | 2df1c7370bf596aebbe06f7333a65a6f4d6ec15a (diff) |
add some scaffolding for file descriptors
Diffstat (limited to 'src/kernel/fd.h')
-rw-r--r-- | src/kernel/fd.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/kernel/fd.h b/src/kernel/fd.h new file mode 100644 index 0000000..4976c7d --- /dev/null +++ b/src/kernel/fd.h @@ -0,0 +1,23 @@ +#pragma once +#include <stddef.h> + +#define FD_MAX 16 + +typedef int fd_t; // TODO duplicated in syscalls.h + +enum fd_type { + FD_EMPTY, +}; + +struct fd { + enum fd_type type; +}; + + +enum fdop { // describes the operations which can be done on file descriptors + FDOP_READ, + FDOP_WRITE, + FDOP_CLOSE, +}; + +int fdop_dispatch(enum fdop fdop, fd_t fd, void *ptr, size_t len); |