It will be more convenient when this function will be used in
task_diag.

Signed-off-by: Andrey Vagin <[email protected]>
---
 fs/proc/base.c     | 8 ++++----
 fs/proc/internal.h | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index b1755b2..614f1d0 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3341,7 +3341,7 @@ out_no_task:
  * In the case of a seek we start with the leader and walk nr
  * threads past it.
  */
-static struct task_struct *first_tid(struct pid *pid, int tid, loff_t f_pos,
+struct task_struct *task_first_tid(struct pid *pid, int tid, loff_t f_pos,
                                        struct pid_namespace *ns)
 {
        struct task_struct *pos, *task;
@@ -3390,7 +3390,7 @@ out:
  *
  * The reference to the input task_struct is released.
  */
-static struct task_struct *next_tid(struct task_struct *start)
+struct task_struct *task_next_tid(struct task_struct *start)
 {
        struct task_struct *pos = NULL;
        rcu_read_lock();
@@ -3426,9 +3426,9 @@ static int proc_task_readdir(struct file *file, struct 
dir_context *ctx)
        ns = inode->i_sb->s_fs_info;
        tid = (int)file->f_version;
        file->f_version = 0;
-       for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns);
+       for (task = task_first_tid(proc_pid(inode), tid, ctx->pos - 2, ns);
             task;
-            task = next_tid(task), ctx->pos++) {
+            task = task_next_tid(task), ctx->pos++) {
                char name[PROC_NUMBUF];
                int len;
                tid = task_pid_nr_ns(task, ns);
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 969e05b..49145e2 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -306,3 +306,7 @@ extern void task_mem(struct seq_file *, struct mm_struct *);
 
 struct task_struct *
 task_next_child(struct task_struct *parent, struct task_struct *prev, unsigned 
int pos);
+
+struct task_struct *task_first_tid(struct pid *pid, int tid, loff_t f_pos,
+                                       struct pid_namespace *ns);
+struct task_struct *task_next_tid(struct task_struct *start);
-- 
2.5.5

Reply via email to