diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-10 15:52:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-01-13 12:56:43 -0500 |
commit | 84427eaef1fb91704c7112bdb598c810003b99f3 (patch) | |
tree | bf22a7186295fcb6dc6bced34cfa73aa74b27300 | |
parent | 974a9f0b47da74e28f68b9c8645c3786aa5ace1a (diff) |
remove task_ppid_nr_ns
task_ppid_nr_ns is called in three places. One of these should never
have called it. In the other two, using it broke the existing
semantics. This was presumably accidental. If the function had not
been there, it would have been much more obvious to the eye that those
patches were changing the behavior. We don't need this function.
In task_state, the pid of the ptracer is not the ppid of the ptracer.
In do_task_stat, ppid is the tgid of the real_parent, not its pid.
I also moved the call outside of lock_task_sighand, since it doesn't
need it.
In sys_getppid, ppid is the tgid of the real_parent, not its pid.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/proc/array.c | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 13 | ||||
-rw-r--r-- | kernel/timer.c | 2 |
3 files changed, 3 insertions, 16 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 65c62e1bfd6f..810eb8fd6500 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -169,7 +169,7 @@ static inline char *task_state(struct task_struct *p, char *buffer) | |||
169 | ppid = pid_alive(p) ? | 169 | ppid = pid_alive(p) ? |
170 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; | 170 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; |
171 | tpid = pid_alive(p) && p->ptrace ? | 171 | tpid = pid_alive(p) && p->ptrace ? |
172 | task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0; | 172 | task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0; |
173 | buffer += sprintf(buffer, | 173 | buffer += sprintf(buffer, |
174 | "State:\t%s\n" | 174 | "State:\t%s\n" |
175 | "Tgid:\t%d\n" | 175 | "Tgid:\t%d\n" |
@@ -426,6 +426,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
426 | cgtime = gtime = cputime_zero; | 426 | cgtime = gtime = cputime_zero; |
427 | 427 | ||
428 | rcu_read_lock(); | 428 | rcu_read_lock(); |
429 | ppid = task_tgid_nr_ns(task->real_parent, ns); | ||
429 | if (lock_task_sighand(task, &flags)) { | 430 | if (lock_task_sighand(task, &flags)) { |
430 | struct signal_struct *sig = task->signal; | 431 | struct signal_struct *sig = task->signal; |
431 | 432 | ||
@@ -465,7 +466,6 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) | |||
465 | 466 | ||
466 | sid = task_session_nr_ns(task, ns); | 467 | sid = task_session_nr_ns(task, ns); |
467 | pgid = task_pgrp_nr_ns(task, ns); | 468 | pgid = task_pgrp_nr_ns(task, ns); |
468 | ppid = task_ppid_nr_ns(task, ns); | ||
469 | 469 | ||
470 | unlock_task_sighand(task, &flags); | 470 | unlock_task_sighand(task, &flags); |
471 | } | 471 | } |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ac3d496fbd20..cc14656f8682 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1255,13 +1255,6 @@ struct pid_namespace; | |||
1255 | * | 1255 | * |
1256 | * set_task_vxid() : assigns a virtual id to a task; | 1256 | * set_task_vxid() : assigns a virtual id to a task; |
1257 | * | 1257 | * |
1258 | * task_ppid_nr_ns() : the parent's id as seen from the namespace specified. | ||
1259 | * the result depends on the namespace and whether the | ||
1260 | * task in question is the namespace's init. e.g. for the | ||
1261 | * namespace's init this will return 0 when called from | ||
1262 | * the namespace of this init, or appropriate id otherwise. | ||
1263 | * | ||
1264 | * | ||
1265 | * see also pid_nr() etc in include/linux/pid.h | 1258 | * see also pid_nr() etc in include/linux/pid.h |
1266 | */ | 1259 | */ |
1267 | 1260 | ||
@@ -1317,12 +1310,6 @@ static inline pid_t task_session_vnr(struct task_struct *tsk) | |||
1317 | } | 1310 | } |
1318 | 1311 | ||
1319 | 1312 | ||
1320 | static inline pid_t task_ppid_nr_ns(struct task_struct *tsk, | ||
1321 | struct pid_namespace *ns) | ||
1322 | { | ||
1323 | return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns); | ||
1324 | } | ||
1325 | |||
1326 | /** | 1313 | /** |
1327 | * pid_alive - check that a task structure is not stale | 1314 | * pid_alive - check that a task structure is not stale |
1328 | * @p: Task structure to be checked. | 1315 | * @p: Task structure to be checked. |
diff --git a/kernel/timer.c b/kernel/timer.c index d4527dcef1af..26671f4db07f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -978,7 +978,7 @@ asmlinkage long sys_getppid(void) | |||
978 | int pid; | 978 | int pid; |
979 | 979 | ||
980 | rcu_read_lock(); | 980 | rcu_read_lock(); |
981 | pid = task_ppid_nr_ns(current, current->nsproxy->pid_ns); | 981 | pid = task_tgid_nr_ns(current->real_parent, current->nsproxy->pid_ns); |
982 | rcu_read_unlock(); | 982 | rcu_read_unlock(); |
983 | 983 | ||
984 | return pid; | 984 | return pid; |