Skip to content

Commit 9a5e733

Browse files
ebiedermLinus Torvalds
authored andcommitted
[PATCH] alpha: Fix getxpid on alpha so it works for threads
While looking in the code I discovered that alpha has fallen behind because it doesn't use sys_getppid. The problem is that it doesn't follow the task struct to the task_group_leader. Acked-by: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 975b3d3 commit 9a5e733

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎arch/alpha/kernel/asm-offsets.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void foo(void)
2828
DEFINE(TASK_GID, offsetof(struct task_struct, gid));
2929
DEFINE(TASK_EGID, offsetof(struct task_struct, egid));
3030
DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent));
31+
DEFINE(TASK_GROUP_LEADER, offsetof(struct task_struct, group_leader));
3132
DEFINE(TASK_TGID, offsetof(struct task_struct, tgid));
3233
BLANK();
3334

‎arch/alpha/kernel/entry.S‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -879,17 +879,19 @@ sys_getxpid:
879879

880880
/* See linux/kernel/timer.c sys_getppid for discussion
881881
about this loop. */
882-
ldq $3, TASK_REAL_PARENT($2)
883-
1: ldl $1, TASK_TGID($3)
882+
ldq $3, TASK_GROUP_LEADER($2)
883+
ldq $4, TASK_REAL_PARENT($3)
884+
ldl $0, TASK_TGID($2)
885+
1: ldl $1, TASK_TGID($4)
884886
#ifdef CONFIG_SMP
885-
mov $3, $4
887+
mov $4, $5
886888
mb
887-
ldq $3, TASK_REAL_PARENT($2)
888-
cmpeq $3, $4, $4
889-
beq $4, 1b
889+
ldq $3, TASK_GROUP_LEADER($2)
890+
ldq $4, TASK_REAL_PARENT($3)
891+
cmpeq $4, $5, $5
892+
beq $5, 1b
890893
#endif
891894
stq $1, 80($sp)
892-
ldl $0, TASK_TGID($2)
893895
ret
894896
.end sys_getxpid
895897

0 commit comments

Comments
 (0)