#include <linux/uaccess.h>
#include <linux/proc_fs.h>
#include <linux/sched/task.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/nsproxy.h>
#include <linux/uidgid.h>
#include <net/net_namespace.h>
#include <linux/seq_file.h>
static inline struct net *PDE_NET(struct proc_dir_entry *pde)
return pde->parent->data;
static struct net *get_proc_net(const struct inode *inode)
return maybe_get_net(PDE_NET(PDE(inode)));
static int proc_net_d_revalidate(struct dentry *dentry, unsigned int flags)
static const struct dentry_operations proc_net_dentry_ops = {
.d_revalidate = proc_net_d_revalidate,
.d_delete = always_delete_dentry,
static void pde_force_lookup(struct proc_dir_entry *pde)
pde->proc_dops = &proc_net_dentry_ops;
static int seq_open_net(struct inode *inode, struct file *file)
unsigned int state_size = PDE(inode)->state_size;
struct seq_net_private *p;
WARN_ON_ONCE(state_size < sizeof(*p));