lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20120130011336.GB30274@oksana.dev.rtsoft.ru>
Date:	Mon, 30 Jan 2012 05:13:36 +0400
From:	Anton Vorontsov <anton.vorontsov@...aro.org>
To:	Arve Hjønnevåg <arve@...roid.com>
Cc:	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	San Mehat <san@...gle.com>, Colin Cross <ccross@...roid.com>,
	Oleg Nesterov <oleg@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	linux-kernel@...r.kernel.org, kernel-team@...roid.com,
	linaro-kernel@...ts.linaro.org
Subject: [PATCH 2/3] pids: Introduce for_each_tgid() macro

Just a handy macro. This patch converts procfs user to this new
macro, plus android lowmemorykiller driver will use it as well.

Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
---
 fs/proc/base.c      |    4 +---
 include/linux/pid.h |    5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 84b8625..e815d63 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3367,9 +3367,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
 	ns = filp->f_dentry->d_sb->s_fs_info;
 	iter.task = NULL;
 	iter.tgid = filp->f_pos - TGID_OFFSET;
-	for (iter = next_tgid(ns, iter);
-	     iter.task;
-	     iter.tgid += 1, iter = next_tgid(ns, iter)) {
+	for_each_tgid(ns, iter) {
 		if (has_pid_permissions(ns, iter.task, 2))
 			__filldir = filldir;
 		else
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 33e350b..da87cae 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -206,4 +206,9 @@ struct tgid_iter {
 
 struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter iter);
 
+#define for_each_tgid(ns, iter)					\
+	for (iter = next_tgid(ns, iter);			\
+	     iter.task;						\
+	     iter.tgid += 1, iter = next_tgid(ns, iter))	\
+
 #endif /* _LINUX_PID_H */
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ