From: Alan Cox Date: Thu, 21 Jan 2016 11:53:52 +0000 (+0000) Subject: syscall_proc: document that dofork might do two things X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=3cd4d2e958385f8709afaca6eaaeb045127380ca;p=FUZIX.git syscall_proc: document that dofork might do two things On banked platforms it'll probably return twice for now anyway. On some others the child will return to user space directly on a different kernel stack. --- diff --git a/Kernel/syscall_proc.c b/Kernel/syscall_proc.c index 0acfa56f..213d3173 100644 --- a/Kernel/syscall_proc.c +++ b/Kernel/syscall_proc.c @@ -373,10 +373,18 @@ arg_t _fork(void) return -1; irq = di(); - // we're going to run our child process next, so mark this process as being ready to run + /* + * We're going to run our child process next, so mark this process as + * being ready to run + */ udata.u_ptab->p_status = P_READY; - // kick off the new process (the bifurcation happens inside here, we returns in both - // the child and parent contexts) + /* + * Kick off the new process (the bifurcation happens inside here, we + * *MAY* returns in both the child and parent contexts, however in a + * non error case the child may also directly return to userspace + * with the return code of 0 and not return from here. Do not assume + * you can execute any child code reliably beyond this call + */ r = dofork(new_process); #ifdef DEBUG kprintf("Dofork %x (n %x)returns %d\n", udata.u_ptab,