* [PATCH 2/3] pids: Introduce for_each_tgid() macro
@ 2012-01-30 1:13 Anton Vorontsov
0 siblings, 0 replies; only message in thread
From: Anton Vorontsov @ 2012-01-30 1:13 UTC (permalink / raw)
To: Arve Hjønnevåg
Cc: KOSAKI Motohiro, Greg Kroah-Hartman, San Mehat, Colin Cross,
Oleg Nesterov, Eric W. Biederman, linux-kernel, kernel-team,
linaro-kernel
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@linaro.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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-01-30 1:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 1:13 [PATCH 2/3] pids: Introduce for_each_tgid() macro Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®