[PATCH] do_fork fixes on Alpha

From: Marc Zyngier (mzyngier@freesurf.fr)
Date: Tue May 20 2003 - 07:37:54 EST


Richard, Linus,

The enclosed patch updates the Alpha architecture to the new do_fork
prototype (as of latest BK), following what has been done on x86.

Patched kernel is running fine on Jensen and AS1000. SMP case
compiles, but otherwise untested.

Thanks,

        M.

===== arch/alpha/kernel/process.c 1.26 vs edited =====
--- 1.26/arch/alpha/kernel/process.c Mon Mar 3 03:13:32 2003
+++ edited/arch/alpha/kernel/process.c Tue May 20 13:44:13 2003
@@ -235,23 +235,18 @@
 alpha_clone(unsigned long clone_flags, unsigned long usp, int *parent_tid,
             int *child_tid, unsigned long tls_value, struct pt_regs *regs)
 {
- struct task_struct *p;
-
         if (!usp)
                 usp = rdusp();
 
- p = do_fork(clone_flags & ~CLONE_IDLETASK, usp, regs, 0,
- parent_tid, child_tid);
- return IS_ERR(p) ? PTR_ERR(p) : p->pid;
+ return do_fork(clone_flags & ~CLONE_IDLETASK, usp, regs, 0,
+ parent_tid, child_tid);
 }
 
 int
 alpha_vfork(struct pt_regs *regs)
 {
- struct task_struct *p;
- p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(),
- regs, 0, NULL, NULL);
- return IS_ERR(p) ? PTR_ERR(p) : p->pid;
+ return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(),
+ regs, 0, NULL, NULL);
 }
 
 /*
===== arch/alpha/kernel/smp.c 1.34 vs edited =====
--- 1.34/arch/alpha/kernel/smp.c Tue Apr 1 00:29:49 2003
+++ edited/arch/alpha/kernel/smp.c Tue May 20 14:35:12 2003
@@ -417,7 +417,12 @@
         /* Don't care about the contents of regs since we'll never
            reschedule the forked task. */
         struct pt_regs regs;
- return do_fork(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
+ int pid;
+ pid = do_fork(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
+ if (pid < 0)
+ return NULL;
+
+ return find_task_by_pid (pid);
 }
 
 /*
@@ -436,7 +441,7 @@
            wish. We can't use kernel_thread since we must avoid
            rescheduling the child. */
         idle = fork_by_hand();
- if (IS_ERR(idle))
+ if (!idle)
                 panic("failed fork for CPU %d", cpuid);
 
         init_idle(idle, cpuid);

-- 
Places change, faces change. Life is so very strange.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:40 EST