aboutsummaryrefslogtreecommitdiff
path: root/kernel/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-02-07 16:58:48 +0100
committerMarvin Borner2021-02-07 16:58:48 +0100
commit59894afa1bc0f4efc85917710adf2e93d7e17a5e (patch)
treeeafaa21081430de4a0d09d8ac963ddc4e2f21a00 /kernel/inc
parenteca4dfd49216f6158df69143994a18a0b3edd4fe (diff)
Added poll syscall
Diffstat (limited to 'kernel/inc')
-rw-r--r--kernel/inc/fs.h1
-rw-r--r--kernel/inc/proc.h10
2 files changed, 9 insertions, 2 deletions
diff --git a/kernel/inc/fs.h b/kernel/inc/fs.h
index 1069597..1f46ba3 100644
--- a/kernel/inc/fs.h
+++ b/kernel/inc/fs.h
@@ -60,6 +60,7 @@ 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_poll(const char **files);
u8 vfs_ready(const char *path);
struct device *device_get_by_name(const char *name);
diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h
index 4a75638..0007744 100644
--- a/kernel/inc/proc.h
+++ b/kernel/inc/proc.h
@@ -17,10 +17,15 @@
#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
+
enum proc_state { PROC_RUNNING, PROC_SLEEPING };
+enum proc_wait_type { PROC_WAIT_DEV };
struct proc_wait {
- u32 id; // dev_id
+ enum proc_wait_type type;
+ u32 ids[PROC_MAX_WAIT_IDS]; // dev_id
+ u32 id_cnt;
s32 (*func)();
};
@@ -43,7 +48,8 @@ struct proc *proc_from_pid(u32 pid);
void proc_exit(struct proc *proc, int status);
void proc_yield(struct regs *r);
void proc_clear_quantum();
-void proc_enable_waiting(u32 dev_id);
+void proc_enable_waiting(u32 id, enum proc_wait_type type);
+void proc_wait_for(u32 id, enum proc_wait_type type, s32 (*func)());
struct proc *proc_make(void);
#endif