11 #include <asm/uaccess.h>
13 #include <linux/errno.h>
14 #include <linux/time.h>
16 #include <linux/stat.h>
17 #include <linux/slab.h>
19 #include <linux/sched.h>
20 #include <linux/module.h>
21 #include <linux/bitops.h>
32 return maybe_get_net(PDE_NET(PDE(inode)));
43 net = get_proc_net(ino);
60 int (*show)(
struct seq_file *,
void *))
66 net = get_proc_net(inode);
89 put_net(seq_file_net(seq));
103 static struct net *get_proc_task_net(
struct inode *dir)
112 ns = task_nsproxy(task);
114 net = get_net(ns->
net_ns);
121 static struct dentry *proc_tgid_net_lookup(
struct inode *dir,
128 net = get_proc_task_net(dir);
136 static int proc_tgid_net_getattr(
struct vfsmount *mnt,
struct dentry *dentry,
139 struct inode *inode = dentry->
d_inode;
142 net = get_proc_task_net(inode);
155 .lookup = proc_tgid_net_lookup,
156 .getattr = proc_tgid_net_getattr,
159 static int proc_tgid_net_readdir(
struct file *filp,
void *
dirent,
166 net = get_proc_task_net(filp->
f_path.dentry->d_inode);
177 .readdir = proc_tgid_net_readdir,
184 return proc_create(name, mode, net->
proc_net, fops);
194 static __net_init int proc_net_ns_init(
struct net *net)
200 netd = kzalloc(
sizeof(*netd) + 4,
GFP_KERNEL);
225 static __net_exit void proc_net_ns_exit(
struct net *net)
232 .init = proc_net_ns_init,
233 .exit = proc_net_ns_exit,