diff options
author | Marvin Borner | 2021-02-14 17:07:29 +0100 |
---|---|---|
committer | Marvin Borner | 2021-02-14 17:07:29 +0100 |
commit | 1287f9dfe987f0456e4fb0741385d5f0278ef53b (patch) | |
tree | 64d3da484a4d186a725779f20d339432d51f441a /kernel/inc | |
parent | bc4e62f629a392e1a4cf204665e91c57f4e619b2 (diff) |
Message waiting and more!
Diffstat (limited to 'kernel/inc')
-rw-r--r-- | kernel/inc/fs.h | 3 | ||||
-rw-r--r-- | kernel/inc/proc.h | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/kernel/inc/fs.h b/kernel/inc/fs.h index 1f46ba3..868cd3e 100644 --- a/kernel/inc/fs.h +++ b/kernel/inc/fs.h @@ -41,6 +41,7 @@ struct vfs { s32 (*read)(const char *path, void *buf, u32 offset, u32 count, struct device *dev); s32 (*write)(const char *path, void *buf, u32 offset, u32 count, struct device *dev); s32 (*stat)(const char *path, struct stat *buf, struct device *dev); + s32 (*wait)(const char *path, s32 (*func)(), struct device *dev); u8 (*perm)(const char *path, enum vfs_perm perm, struct device *dev); u8 (*ready)(const char *path, struct device *dev); }; @@ -60,10 +61,12 @@ struct device *vfs_find_dev(const char *path); s32 vfs_read(const char *path, void *buf, u32 offset, u32 count); s32 vfs_write(const char *path, void *buf, u32 offset, u32 count); s32 vfs_stat(const char *path, struct stat *buf); +s32 vfs_wait(const char *path, s32 (*func)()); s32 vfs_poll(const char **files); u8 vfs_ready(const char *path); struct device *device_get_by_name(const char *name); +struct device *device_get_by_id(u32 id); /** * EXT2 diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h index 593141b..cb583d6 100644 --- a/kernel/inc/proc.h +++ b/kernel/inc/proc.h @@ -17,21 +17,27 @@ #define GDT_USER_CODE_OFFSET 0x1b // User code segment offset in GDT (with ring3 mask) #define GDT_USER_DATA_OFFSET 0x23 // User data segment offset in GDT (with ring3 mask) -#define PROC_MAX_WAIT_IDS 16 +#define PROC_MAX_WAIT_IDS 128 +#define PROC_WAIT_MAGIC 0x00528491 #define STREAM_MAX_SIZE 4096 enum stream_defaults { STREAM_IN, STREAM_OUT, STREAM_ERR, STREAM_LOG, STREAM_UNKNOWN = -1 }; enum proc_state { PROC_RUNNING, PROC_SLEEPING }; -enum proc_wait_type { PROC_WAIT_DEV }; +enum proc_wait_type { PROC_WAIT_DEV, PROC_WAIT_MSG }; -struct proc_wait { +struct proc_wait_identifier { + u32 magic; + u32 id; enum proc_wait_type type; - u32 ids[PROC_MAX_WAIT_IDS]; // dev_id - u32 id_cnt; s32 (*func)(); }; +struct proc_wait { + struct proc_wait_identifier ids[PROC_MAX_WAIT_IDS]; // dev_id + u32 id_cnt; +}; + struct stream { u32 offset_read; u32 offset_write; |