BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / b085b2618dada4e753dc58cad71c21a21eb1c998 / task / clone.c

// Related

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();