BarryServer : Git

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

// Related

Nucleus

Barry Signals and small task functions 9d6eb50 (3 years, 2 months ago)
diff --git a/task/clone.c b/task/clone.c
index 0ec2f95..7516f18 100644
--- a/task/clone.c
+++ b/task/clone.c
@@ -34,9 +34,24 @@ clone(int flags)
 
 	/* Clone parent's virtual memory namespace */
 	if (flags & CLONE_VM)
-		child->vm = get(parent->fs);
+		child->vm = get(parent->vm);
 	else
-		child->fs = copy(parent->fs);
+		child->vm = copy(parent->vm);
+	/* Copy stack */
+	if (parent->stack)
+		child->stack = copy(parent->stack);
+
+	/* Clone parent's signals namespace */
+	if (flags & CLONE_SIGHAND)
+		child->signals = get(parent->signals);
+	else
+		child->signals = copy(parent->signals);
+
+	/* Get executable file */
+	if (parent->executable)
+		child->executable = get(parent->executable);
+
+	child->inSyscall = parent->inSyscall;
 
 	/* After this, anything on the stack is desynchronised */
 	child->pageDir = clone_dir();
@@ -50,7 +65,7 @@ clone(int flags)
 	put(child);
 	exit_critical_section();
 end:
-	if (!tid) {
+	if (tid && !current->inSyscall) {
 		outb(0x20, 0x20);
 		if (apic)
 			LAPIC(0xB0) = 0;