Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132382
b: refs/heads/master
c: ee6f779
h: refs/heads/master
v: v3
  • Loading branch information
Zhang Le authored and Linus Torvalds committed Mar 16, 2009
1 parent 937b968 commit 48e6bf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 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: 5bee17f18b595937e6beafeee5197868a3f74a06
refs/heads/master: ee6f779b9e0851e2f7da292a9f58e0095edf615a
16 changes: 7 additions & 9 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3066,7 +3066,6 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
int retval = -ENOENT;
ino_t ino;
int tid;
unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */
struct pid_namespace *ns;

task = get_proc_task(inode);
Expand All @@ -3083,18 +3082,18 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
goto out_no_task;
retval = 0;

switch (pos) {
switch (filp->f_pos) {
case 0:
ino = inode->i_ino;
if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) < 0)
goto out;
pos++;
filp->f_pos++;
/* fall through */
case 1:
ino = parent_ino(dentry);
if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) < 0)
goto out;
pos++;
filp->f_pos++;
/* fall through */
}

Expand All @@ -3104,9 +3103,9 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
ns = filp->f_dentry->d_sb->s_fs_info;
tid = (int)filp->f_version;
filp->f_version = 0;
for (task = first_tid(leader, tid, pos - 2, ns);
for (task = first_tid(leader, tid, filp->f_pos - 2, ns);
task;
task = next_tid(task), pos++) {
task = next_tid(task), filp->f_pos++) {
tid = task_pid_nr_ns(task, ns);
if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) {
/* returning this tgid failed, save it as the first
Expand All @@ -3117,7 +3116,6 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
}
}
out:
filp->f_pos = pos;
put_task_struct(leader);
out_no_task:
return retval;
Expand Down

0 comments on commit 48e6bf7

Please sign in to comment.