Nucleus
Barry File system namespace b085b26 (3 years, 3 months ago)
diff --git a/task/clone.c b/task/clone.c
index 41cbc48..86cf440 100644
--- a/task/clone.c
+++ b/task/clone.c
@@ -4,7 +4,9 @@
*/
#include <sys/types.h>
+#include <sys/sched.h>
#include <nucleus/task.h>
+#include <nucleus/vfs.h>
extern ObjectList *readyQueue[];
@@ -17,6 +19,12 @@ clone(int flags)
Task *parent = current, *child = new(&taskType), *tmp;
pid_t tid = 0;
+ /* Clone parent's file system namespace */
+ if (flags & CLONE_FS)
+ child->fs = get(parent->fs);
+ else
+ child->fs = copy(parent->fs);
+
/* After this, anything on the stack is desynchronised */
child->pageDir = clone_dir();
diff --git a/task/task.c b/task/task.c
index 7026698..87c0c79 100644
--- a/task/task.c
+++ b/task/task.c
@@ -77,6 +77,10 @@ init_tasking(void)
asm volatile("mov %%cr3, %0" : "=r" (current->pageDir));
current->state = RUNNING;
+ /* File System namespace */
+ current->fs = new(&fsType);
+
init_scheduler();
register_interrupt(0, timer_handler);
+
}