From: Pavel Emelyanov <xemul@parallels.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>,
Glauber Costa <glommer@parallels.com>,
Andi Kleen <andi@firstfloor.org>, Tejun Heo <tj@kernel.org>,
Matt Helsley <matthltc@us.ibm.com>,
Pekka Enberg <penberg@kernel.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files
Date: Thu, 17 Nov 2011 13:56:37 +0400 [thread overview]
Message-ID: <4EC4DA55.2070706@parallels.com> (raw)
In-Reply-To: <4EC4DA15.7090106@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
fs/proc/namespaces.c | 12 ++++++++++++
include/linux/mm.h | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index be177f7..48c64ab 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -27,8 +27,20 @@ static const struct proc_ns_operations *ns_entries[] = {
#endif
};
+static ssize_t proc_ns_read(struct file *file, char __user *buf,
+ size_t len, loff_t *ppos)
+{
+ char tmp[32];
+ struct proc_inode *ei = PROC_I(file->f_dentry->d_inode);
+
+ snprintf(tmp, sizeof(tmp), "id:\t%lu\n",
+ gen_object_id(ei->ns, GEN_OBJ_ID_NS));
+ return simple_read_from_buffer(buf, len, ppos, tmp, strlen(tmp));
+}
+
static const struct file_operations ns_file_operations = {
.llseek = no_llseek,
+ .read = proc_ns_read,
};
static struct dentry *proc_ns_instantiate(struct inode *dir,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 80ea327..cd4d727 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1628,6 +1628,7 @@ extern void copy_user_huge_page(struct page *dst, struct page *src,
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
enum {
+ GEN_OBJ_ID_NS,
GEN_OBJ_ID_TYPES,
};
--
1.5.5.6
next prev parent reply other threads:[~2011-11-17 9:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 9:55 [PATCH v2 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks Pavel Emelyanov
2011-11-17 9:56 ` [PATCH 1/4] Routine for generating a safe ID for kernel pointer Pavel Emelyanov
2011-11-17 9:56 ` Pavel Emelyanov [this message]
2011-11-17 9:56 ` [PATCH 3/4] proc: Show open file ID in /proc/pid/fdinfo/* Pavel Emelyanov
2011-11-17 20:48 ` [PATCH v2 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks Andrew Morton
2011-11-18 9:24 ` Pavel Emelyanov
2011-11-18 19:07 ` Andrew Morton
2011-11-18 20:03 ` Cyrill Gorcunov
2011-11-18 20:37 ` Andrew Morton
2011-11-18 21:03 ` Cyrill Gorcunov
2011-11-18 21:09 ` Pekka Enberg
2011-11-18 22:10 ` Kyle Moffett
2011-11-18 23:46 ` Tejun Heo
2011-11-19 1:09 ` Kyle Moffett
2011-11-19 5:30 ` Cyrill Gorcunov
2011-11-18 23:38 ` Matt Helsley
2011-11-19 5:35 ` Cyrill Gorcunov
2011-11-19 7:57 ` Vasiliy Kulikov
2011-11-19 8:10 ` Vasiliy Kulikov
2011-11-19 8:18 ` Vasiliy Kulikov
2011-11-19 15:34 ` Cyrill Gorcunov
-- strict thread matches above, loose matches on Subject: below --
2011-12-23 12:47 [patch 0/4] generic object ids, v2 Cyrill Gorcunov
2011-12-23 12:47 ` [patch 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Cyrill Gorcunov
2012-01-04 6:02 ` Eric W. Biederman
2012-01-04 11:26 ` Cyrill Gorcunov
2012-01-04 17:56 ` Eric W. Biederman
2012-01-04 18:19 ` Cyrill Gorcunov
2011-12-22 12:56 [patch 0/4] kernel generic object IDs series Cyrill Gorcunov
2011-12-22 12:56 ` [patch 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Cyrill Gorcunov
2011-11-15 11:35 [PATCH 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks Pavel Emelyanov
2011-11-15 11:36 ` [PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Pavel Emelyanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EC4DA55.2070706@parallels.com \
--to=xemul@parallels.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=eric.dumazet@gmail.com \
--cc=glommer@parallels.com \
--cc=gorcunov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthltc@us.ibm.com \
--cc=penberg@kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome