lkml.org 
[lkml]   [2016]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/15] proc: export task_first_tid() and task_next_tid()
Date
It will be more convenient when this function will be used in
task_diag.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
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
\
 
 \ /
  Last update: 2016-04-12 02:01    [W:0.134 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site