Add read/write syscalls again

This commit is contained in:
Mark
2020-01-12 22:59:13 +02:00
parent d0784e5f4b
commit 8b0fe62240
12 changed files with 147 additions and 59 deletions
+4
View File
@@ -2,6 +2,10 @@
#include "node.h"
#include <sys/types.h>
#define OF_WRITABLE (1 << 0)
#define OF_READABLE (1 << 1)
#define OF_DIRECTORY (1 << 2)
struct ofile {
int flags;
struct vnode *vnode;
+2
View File
@@ -28,9 +28,11 @@ int vfs_link_resolve(struct vfs_ioctx *ctx, struct vnode *lnk, struct vnode **re
int vfs_find(struct vfs_ioctx *ctx, struct vnode *rel, const char *path, struct vnode **node);
int vfs_mount(struct vfs_ioctx *ctx, const char *at, void *blk, const char *fs, const char *opt);
int vfs_open_vnode(struct vfs_ioctx *ctx, struct ofile *fd, struct vnode *node, int opt);
int vfs_open(struct vfs_ioctx *ctx, struct ofile *fd, const char *path, int flags, int mode);
void vfs_close(struct vfs_ioctx *ctx, struct ofile *fd);
int vfs_stat(struct vfs_ioctx *ctx, const char *path, struct stat *st);
ssize_t vfs_write(struct vfs_ioctx *ctx, struct ofile *fd, const void *buf, size_t count);
ssize_t vfs_read(struct vfs_ioctx *ctx, struct ofile *fd, void *buf, size_t count);
+3 -3
View File
@@ -16,8 +16,6 @@
#define THREAD_STOPPED (1 << 2)
// Thread init flags:
// Initialize I/O context and open stdio
#define THREAD_INIT_IOCTX (1 << 1)
// Initialize platform context
#define THREAD_INIT_CTX (1 << 0)
@@ -26,6 +24,8 @@ typedef uint64_t *mm_space_t;
#include "sys/amd64/sys/thread.h"
#endif
#define THREAD_MAX_FDS 16
struct image_info {
uintptr_t image_end;
uintptr_t brk;
@@ -47,7 +47,7 @@ struct thread {
int exit_code;
struct vfs_ioctx ioctx;
struct ofile fds[4];
struct ofile *fds[THREAD_MAX_FDS];
// Signals
uint32_t sigq;