lkml.org 
[lkml]   [2011]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---
fs/proc/namespaces.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index be177f7..06baabb 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -12,6 +12,7 @@
#include <linux/mnt_namespace.h>
#include <linux/ipc_namespace.h>
#include <linux/pid_namespace.h>
+#include <linux/gen_object_ids.h>
#include "internal.h"


@@ -27,8 +28,19 @@ 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));
+ 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,
--
1.5.5.6

\
 
 \ /
  Last update: 2011-11-15 12:39    [W:0.359 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site