Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755361AbcDKXgN (ORCPT ); Mon, 11 Apr 2016 19:36:13 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:32822 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754837AbcDKXgJ (ORCPT ); Mon, 11 Apr 2016 19:36:09 -0400 From: Andrey Vagin To: linux-kernel@vger.kernel.org Cc: Andrey Vagin , Oleg Nesterov , Andrew Morton , Cyrill Gorcunov , Pavel Emelyanov , Roger Luethi , Arnd Bergmann , Arnaldo Carvalho de Melo , David Ahern , Andy Lutomirski , Pavel Odintsov Subject: [PATCH 02/15] proc: export task_first_tid() and task_next_tid() Date: Mon, 11 Apr 2016 16:35:42 -0700 Message-Id: <1460417755-18201-3-git-send-email-avagin@openvz.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1460417755-18201-1-git-send-email-avagin@openvz.org> References: <1460417755-18201-1-git-send-email-avagin@openvz.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1983 Lines: 57 It will be more convenient when this function will be used in task_diag. Signed-off-by: Andrey Vagin --- 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