Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30251
b: refs/heads/master
c: 9cc8cbc
h: refs/heads/master
i:
  30249: ff5f756
  30247: 10a741f
v: v3
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Jun 26, 2006
1 parent cbccb03 commit bfe8c3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: de7587343bfebc186995ad294e3de0da382eb9bc
refs/heads/master: 9cc8cbc7f8b7bc3db48bf6d59a731af728e786ce
28 changes: 13 additions & 15 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,34 +2040,32 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry
* In the case of a seek we start with &init_task and walk nr
* threads past it.
*/
static struct task_struct *first_tgid(int tgid, int nr)
static struct task_struct *first_tgid(int tgid, unsigned int nr)
{
struct task_struct *pos = NULL;
struct task_struct *pos;
rcu_read_lock();
if (tgid && nr) {
pos = find_task_by_pid(tgid);
if (pos && !thread_group_leader(pos))
pos = NULL;
if (pos)
nr = 0;
if (pos && thread_group_leader(pos))
goto found;
}
/* If nr exceeds the number of processes get out quickly */
pos = NULL;
if (nr && nr >= nr_processes())
goto done;

/* If we haven't found our starting place yet start with
* the init_task and walk nr tasks forward.
*/
if (!pos && (nr >= 0))
pos = next_task(&init_task);

for (; pos && pid_alive(pos); pos = next_task(pos)) {
if (--nr > 0)
continue;
get_task_struct(pos);
goto done;
for (pos = next_task(&init_task); nr > 0; --nr) {
pos = next_task(pos);
if (pos == &init_task) {
pos = NULL;
goto done;
}
}
pos = NULL;
found:
get_task_struct(pos);
done:
rcu_read_unlock();
return pos;
Expand Down

0 comments on commit bfe8c3e

Please sign in to comment.