aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/proc.c
diff options
context:
space:
mode:
authorMarvin Borner2021-01-21 16:14:56 +0100
committerMarvin Borner2021-01-21 16:14:56 +0100
commitef407d1e965674c5278daeb25a72acf446ec3223 (patch)
tree941d61b0fff4682bba57e056fcee93059a9cd4b8 /kernel/features/proc.c
parent7442dc40a12bd61d6a77fafbc1ea031a2b51937a (diff)
Fixed some dumb bugs
Diffstat (limited to 'kernel/features/proc.c')
-rw-r--r--kernel/features/proc.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index 9af1ce4..5e918b2 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -99,6 +99,11 @@ struct proc *proc_from_pid(u32 pid)
return NULL;
}
+void proc_clear_quantum()
+{
+ quantum = 0;
+}
+
void proc_exit(struct proc *proc, int status)
{
assert(proc);
@@ -120,19 +125,14 @@ void proc_exit(struct proc *proc, int status)
if (res)
printf("Process %s exited with status %d\n", proc->name, status);
- quantum = 0; // TODO: Add quantum to each process struct?
+ proc_clear_quantum(); // TODO: Add quantum to each process struct?
sti();
hlt();
}
-void proc_clear_quantum()
-{
- quantum = 0;
-}
-
void proc_yield(struct regs *r)
{
- proc_clear_quantum();
+ //proc_clear_quantum();
scheduler(r);
}
@@ -245,6 +245,13 @@ u32 procfs_read(const char *path, void *buf, u32 offset, u32 count, struct devic
return 0;
}
+u32 procfs_ready(const char *path, struct device *dev)
+{
+ (void)path;
+ (void)dev;
+ return 1;
+}
+
extern void proc_jump_userspace(void);
u32 _esp, _eip;
@@ -262,6 +269,7 @@ void proc_init(void)
vfs->type = VFS_PROCFS;
vfs->read = procfs_read;
vfs->write = procfs_write;
+ vfs->ready = procfs_ready;
struct device *dev = malloc(sizeof(*dev));
dev->name = "proc";
dev->type = DEV_CHAR;