Subject: [PATCH] Fix getxpid on alpha to use getpid and getppid. From: Eric W. Biederman Date: 1129752689 -0600 The code was wrong for threaded programs even without put my pspace work. --- arch/alpha/kernel/entry.S | 21 +++++++-------------- arch/alpha/kernel/process.c | 11 +++++++++++ kernel/timer.c | 14 +++++++------- 3 files changed, 25 insertions(+), 21 deletions(-) 6c6ee86578ba876ab0b85cb2089794da5e06c86a diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index e38671c..780cb93 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S @@ -874,22 +874,15 @@ sys_getxgid: .globl sys_getxpid .ent sys_getxpid sys_getxpid: + lda $sp, -16($sp) + stq $26, 0($sp) .prologue 0 - ldq $2, TI_TASK($8) - /* See linux/kernel/timer.c sys_getppid for discussion - about this loop. */ - ldq $3, TASK_REAL_PARENT($2) -1: ldl $1, TASK_TGID($3) -#ifdef CONFIG_SMP - mov $3, $4 - mb - ldq $3, TASK_REAL_PARENT($2) - cmpeq $3, $4, $4 - beq $4, 1b -#endif - stq $1, 80($sp) - ldl $0, TASK_TGID($2) + lda $16, 96($sp) + jsr $26, do_getxpid + ldq $26, 0($sp) + + lda $sp, 16($sp) ret .end sys_getxpid diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index eb20c3a..dd7baf0 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -527,3 +528,13 @@ get_wchan(struct task_struct *p) } return pc; } + +asmlinkage long do_getxpid(long *ppid) +{ + /* The assembly version as getting out of sync with + * sys_getpid and sys_getppid in timer.c so just call + * them and stop optimizing infrequently called functions. + */ + *ppid = sys_getppid(); + return sys_getpid(); +} diff --git a/kernel/timer.c b/kernel/timer.c index b56659f..72b5e6d 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -979,13 +979,6 @@ asmlinkage unsigned long sys_alarm(unsig #endif -#ifndef __alpha__ - -/* - * The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this - * should be moved into arch/i386 instead? - */ - /** * sys_getpid - return the thread group id of the current process * @@ -1044,6 +1037,13 @@ asmlinkage long sys_getppid(void) return pid_to_user(pid); } +#ifndef __alpha__ + +/* + * The Alpha uses getxpid, getxuid, and getxgid instead. + * And is suffering bit-rot because of the difference. + */ + asmlinkage long sys_getuid(void) { /* Only we change this so SMP safe */ -- 1.0.GIT