2005-04-16 22:20:36 +00:00
|
|
|
/* internal.h: internal procfs definitions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
|
|
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
2012-08-23 10:43:24 +00:00
|
|
|
#include <linux/sched.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/proc_fs.h>
|
2013-02-28 01:03:15 +00:00
|
|
|
#include <linux/binfmts.h>
|
2012-01-06 12:07:15 +00:00
|
|
|
struct ctl_table_header;
|
2012-10-19 08:00:55 +00:00
|
|
|
struct mempolicy;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-04-29 08:01:44 +00:00
|
|
|
extern struct proc_dir_entry proc_root;
|
2010-07-10 21:52:49 +00:00
|
|
|
extern void proc_self_init(void);
|
2007-04-02 06:49:35 +00:00
|
|
|
#ifdef CONFIG_PROC_SYSCTL
|
2007-02-14 08:34:12 +00:00
|
|
|
extern int proc_sys_init(void);
|
2012-01-06 12:07:15 +00:00
|
|
|
extern void sysctl_head_put(struct ctl_table_header *head);
|
2007-04-02 06:49:35 +00:00
|
|
|
#else
|
|
|
|
static inline void proc_sys_init(void) { }
|
2012-01-06 12:07:15 +00:00
|
|
|
static inline void sysctl_head_put(struct ctl_table_header *head) { }
|
2007-04-02 06:49:35 +00:00
|
|
|
#endif
|
2007-09-12 10:01:34 +00:00
|
|
|
#ifdef CONFIG_NET
|
|
|
|
extern int proc_net_init(void);
|
|
|
|
#else
|
|
|
|
static inline int proc_net_init(void) { return 0; }
|
|
|
|
#endif
|
2007-02-14 08:34:12 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct vmalloc_info {
|
|
|
|
unsigned long used;
|
|
|
|
unsigned long largest_chunk;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_MMU
|
|
|
|
#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
|
|
|
|
extern void get_vmalloc_info(struct vmalloc_info *vmi);
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define VMALLOC_TOTAL 0UL
|
|
|
|
#define get_vmalloc_info(vmi) \
|
|
|
|
do { \
|
|
|
|
(vmi)->used = 0; \
|
|
|
|
(vmi)->largest_chunk = 0; \
|
|
|
|
} while(0)
|
|
|
|
#endif
|
|
|
|
|
2008-02-08 12:18:31 +00:00
|
|
|
extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
|
|
|
|
struct pid *pid, struct task_struct *task);
|
|
|
|
extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
|
|
|
|
struct pid *pid, struct task_struct *task);
|
2008-02-08 12:18:33 +00:00
|
|
|
extern int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
|
|
|
|
struct pid *pid, struct task_struct *task);
|
2008-02-08 12:18:32 +00:00
|
|
|
extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
|
|
|
|
struct pid *pid, struct task_struct *task);
|
2008-02-05 06:29:04 +00:00
|
|
|
extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2012-05-31 23:26:43 +00:00
|
|
|
extern const struct file_operations proc_tid_children_operations;
|
procfs: mark thread stack correctly in proc/<pid>/maps
Stack for a new thread is mapped by userspace code and passed via
sys_clone. This memory is currently seen as anonymous in
/proc/<pid>/maps, which makes it difficult to ascertain which mappings
are being used for thread stacks. This patch uses the individual task
stack pointers to determine which vmas are actually thread stacks.
For a multithreaded program like the following:
#include <pthread.h>
void *thread_main(void *foo)
{
while(1);
}
int main()
{
pthread_t t;
pthread_create(&t, NULL, thread_main, NULL);
pthread_join(t, NULL);
}
proc/PID/maps looks like the following:
00400000-00401000 r-xp 00000000 fd:0a 3671804 /home/siddhesh/a.out
00600000-00601000 rw-p 00000000 fd:0a 3671804 /home/siddhesh/a.out
019ef000-01a10000 rw-p 00000000 00:00 0 [heap]
7f8a44491000-7f8a44492000 ---p 00000000 00:00 0
7f8a44492000-7f8a44c92000 rw-p 00000000 00:00 0
7f8a44c92000-7f8a44e3d000 r-xp 00000000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a44e3d000-7f8a4503d000 ---p 001ab000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a4503d000-7f8a45041000 r--p 001ab000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a45041000-7f8a45043000 rw-p 001af000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a45043000-7f8a45048000 rw-p 00000000 00:00 0
7f8a45048000-7f8a4505f000 r-xp 00000000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4505f000-7f8a4525e000 ---p 00017000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4525e000-7f8a4525f000 r--p 00016000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4525f000-7f8a45260000 rw-p 00017000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a45260000-7f8a45264000 rw-p 00000000 00:00 0
7f8a45264000-7f8a45286000 r-xp 00000000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45457000-7f8a4545a000 rw-p 00000000 00:00 0
7f8a45484000-7f8a45485000 rw-p 00000000 00:00 0
7f8a45485000-7f8a45486000 r--p 00021000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45486000-7f8a45487000 rw-p 00022000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45487000-7f8a45488000 rw-p 00000000 00:00 0
7fff6273b000-7fff6275c000 rw-p 00000000 00:00 0 [stack]
7fff627ff000-7fff62800000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Here, one could guess that 7f8a44492000-7f8a44c92000 is a stack since
the earlier vma that has no permissions (7f8a44e3d000-7f8a4503d000) but
that is not always a reliable way to find out which vma is a thread
stack. Also, /proc/PID/maps and /proc/PID/task/TID/maps has the same
content.
With this patch in place, /proc/PID/task/TID/maps are treated as 'maps
as the task would see it' and hence, only the vma that that task uses as
stack is marked as [stack]. All other 'stack' vmas are marked as
anonymous memory. /proc/PID/maps acts as a thread group level view,
where all thread stack vmas are marked as [stack:TID] where TID is the
process ID of the task that uses that vma as stack, while the process
stack is marked as [stack].
So /proc/PID/maps will look like this:
00400000-00401000 r-xp 00000000 fd:0a 3671804 /home/siddhesh/a.out
00600000-00601000 rw-p 00000000 fd:0a 3671804 /home/siddhesh/a.out
019ef000-01a10000 rw-p 00000000 00:00 0 [heap]
7f8a44491000-7f8a44492000 ---p 00000000 00:00 0
7f8a44492000-7f8a44c92000 rw-p 00000000 00:00 0 [stack:1442]
7f8a44c92000-7f8a44e3d000 r-xp 00000000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a44e3d000-7f8a4503d000 ---p 001ab000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a4503d000-7f8a45041000 r--p 001ab000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a45041000-7f8a45043000 rw-p 001af000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a45043000-7f8a45048000 rw-p 00000000 00:00 0
7f8a45048000-7f8a4505f000 r-xp 00000000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4505f000-7f8a4525e000 ---p 00017000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4525e000-7f8a4525f000 r--p 00016000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4525f000-7f8a45260000 rw-p 00017000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a45260000-7f8a45264000 rw-p 00000000 00:00 0
7f8a45264000-7f8a45286000 r-xp 00000000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45457000-7f8a4545a000 rw-p 00000000 00:00 0
7f8a45484000-7f8a45485000 rw-p 00000000 00:00 0
7f8a45485000-7f8a45486000 r--p 00021000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45486000-7f8a45487000 rw-p 00022000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45487000-7f8a45488000 rw-p 00000000 00:00 0
7fff6273b000-7fff6275c000 rw-p 00000000 00:00 0 [stack]
7fff627ff000-7fff62800000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Thus marking all vmas that are used as stacks by the threads in the
thread group along with the process stack. The task level maps will
however like this:
00400000-00401000 r-xp 00000000 fd:0a 3671804 /home/siddhesh/a.out
00600000-00601000 rw-p 00000000 fd:0a 3671804 /home/siddhesh/a.out
019ef000-01a10000 rw-p 00000000 00:00 0 [heap]
7f8a44491000-7f8a44492000 ---p 00000000 00:00 0
7f8a44492000-7f8a44c92000 rw-p 00000000 00:00 0 [stack]
7f8a44c92000-7f8a44e3d000 r-xp 00000000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a44e3d000-7f8a4503d000 ---p 001ab000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a4503d000-7f8a45041000 r--p 001ab000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a45041000-7f8a45043000 rw-p 001af000 fd:00 2097482 /lib64/libc-2.14.90.so
7f8a45043000-7f8a45048000 rw-p 00000000 00:00 0
7f8a45048000-7f8a4505f000 r-xp 00000000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4505f000-7f8a4525e000 ---p 00017000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4525e000-7f8a4525f000 r--p 00016000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a4525f000-7f8a45260000 rw-p 00017000 fd:00 2099938 /lib64/libpthread-2.14.90.so
7f8a45260000-7f8a45264000 rw-p 00000000 00:00 0
7f8a45264000-7f8a45286000 r-xp 00000000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45457000-7f8a4545a000 rw-p 00000000 00:00 0
7f8a45484000-7f8a45485000 rw-p 00000000 00:00 0
7f8a45485000-7f8a45486000 r--p 00021000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45486000-7f8a45487000 rw-p 00022000 fd:00 2097348 /lib64/ld-2.14.90.so
7f8a45487000-7f8a45488000 rw-p 00000000 00:00 0
7fff6273b000-7fff6275c000 rw-p 00000000 00:00 0
7fff627ff000-7fff62800000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
where only the vma that is being used as a stack by *that* task is
marked as [stack].
Analogous changes have been made to /proc/PID/smaps,
/proc/PID/numa_maps, /proc/PID/task/TID/smaps and
/proc/PID/task/TID/numa_maps. Relevant snippets from smaps and
numa_maps:
[siddhesh@localhost ~ ]$ pgrep a.out
1441
[siddhesh@localhost ~ ]$ cat /proc/1441/smaps | grep "\[stack"
7f8a44492000-7f8a44c92000 rw-p 00000000 00:00 0 [stack:1442]
7fff6273b000-7fff6275c000 rw-p 00000000 00:00 0 [stack]
[siddhesh@localhost ~ ]$ cat /proc/1441/task/1442/smaps | grep "\[stack"
7f8a44492000-7f8a44c92000 rw-p 00000000 00:00 0 [stack]
[siddhesh@localhost ~ ]$ cat /proc/1441/task/1441/smaps | grep "\[stack"
7fff6273b000-7fff6275c000 rw-p 00000000 00:00 0 [stack]
[siddhesh@localhost ~ ]$ cat /proc/1441/numa_maps | grep "stack"
7f8a44492000 default stack:1442 anon=2 dirty=2 N0=2
7fff6273a000 default stack anon=3 dirty=3 N0=3
[siddhesh@localhost ~ ]$ cat /proc/1441/task/1442/numa_maps | grep "stack"
7f8a44492000 default stack anon=2 dirty=2 N0=2
[siddhesh@localhost ~ ]$ cat /proc/1441/task/1441/numa_maps | grep "stack"
7fff6273a000 default stack anon=3 dirty=3 N0=3
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix build]
Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jamie Lokier <jamie@shareable.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-21 23:34:04 +00:00
|
|
|
extern const struct file_operations proc_pid_maps_operations;
|
|
|
|
extern const struct file_operations proc_tid_maps_operations;
|
|
|
|
extern const struct file_operations proc_pid_numa_maps_operations;
|
|
|
|
extern const struct file_operations proc_tid_numa_maps_operations;
|
|
|
|
extern const struct file_operations proc_pid_smaps_operations;
|
|
|
|
extern const struct file_operations proc_tid_smaps_operations;
|
2008-02-05 06:29:03 +00:00
|
|
|
extern const struct file_operations proc_clear_refs_operations;
|
2008-02-05 06:29:04 +00:00
|
|
|
extern const struct file_operations proc_pagemap_operations;
|
[NET]: Make /proc/net a symlink on /proc/self/net (v3)
Current /proc/net is done with so called "shadows", but current
implementation is broken and has little chances to get fixed.
The problem is that dentries subtree of /proc/net directory has
fancy revalidation rules to make processes living in different
net namespaces see different entries in /proc/net subtree, but
currently, tasks see in the /proc/net subdir the contents of any
other namespace, depending on who opened the file first.
The proposed fix is to turn /proc/net into a symlink, which points
to /proc/self/net, which in turn shows what previously was in
/proc/net - the network-related info, from the net namespace the
appropriate task lives in.
# ls -l /proc/net
lrwxrwxrwx 1 root root 8 Mar 5 15:17 /proc/net -> self/net
In other words - this behaves like /proc/mounts, but unlike
"mounts", "net" is not a file, but a directory.
Changes from v2:
* Fixed discrepancy of /proc/net nlink count and selinux labeling
screwup pointed out by Stephen.
To get the correct nlink count the ->getattr callback for /proc/net
is overridden to read one from the net->proc_net entry.
To make selinux still work the net->proc_net entry is initialized
properly, i.e. with the "net" name and the proc_net parent.
Selinux fixes are
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Changes from v1:
* Fixed a task_struct leak in get_proc_task_net, pointed out by Paul.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-07 19:08:40 +00:00
|
|
|
extern const struct file_operations proc_net_operations;
|
|
|
|
extern const struct inode_operations proc_net_inode_operations;
|
2012-08-23 10:43:24 +00:00
|
|
|
extern const struct inode_operations proc_pid_link_inode_operations;
|
2006-06-26 07:25:55 +00:00
|
|
|
|
2011-05-25 00:12:48 +00:00
|
|
|
struct proc_maps_private {
|
|
|
|
struct pid *pid;
|
|
|
|
struct task_struct *task;
|
|
|
|
#ifdef CONFIG_MMU
|
|
|
|
struct vm_area_struct *tail_vma;
|
|
|
|
#endif
|
2012-10-19 08:00:55 +00:00
|
|
|
#ifdef CONFIG_NUMA
|
|
|
|
struct mempolicy *task_mempolicy;
|
|
|
|
#endif
|
2011-05-25 00:12:48 +00:00
|
|
|
};
|
|
|
|
|
2008-10-16 23:43:55 +00:00
|
|
|
void proc_init_inodecache(void);
|
2006-01-08 09:04:16 +00:00
|
|
|
|
2006-06-26 07:25:56 +00:00
|
|
|
static inline struct pid *proc_pid(struct inode *inode)
|
2006-06-26 07:25:55 +00:00
|
|
|
{
|
2006-06-26 07:25:56 +00:00
|
|
|
return PROC_I(inode)->pid;
|
2006-06-26 07:25:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct task_struct *get_proc_task(struct inode *inode)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2006-06-26 07:25:56 +00:00
|
|
|
return get_pid_task(proc_pid(inode), PIDTYPE_PID);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2006-06-26 07:25:44 +00:00
|
|
|
static inline int proc_fd(struct inode *inode)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2006-06-26 07:25:44 +00:00
|
|
|
return PROC_I(inode)->fd;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
[NET]: Make /proc/net a symlink on /proc/self/net (v3)
Current /proc/net is done with so called "shadows", but current
implementation is broken and has little chances to get fixed.
The problem is that dentries subtree of /proc/net directory has
fancy revalidation rules to make processes living in different
net namespaces see different entries in /proc/net subtree, but
currently, tasks see in the /proc/net subdir the contents of any
other namespace, depending on who opened the file first.
The proposed fix is to turn /proc/net into a symlink, which points
to /proc/self/net, which in turn shows what previously was in
/proc/net - the network-related info, from the net namespace the
appropriate task lives in.
# ls -l /proc/net
lrwxrwxrwx 1 root root 8 Mar 5 15:17 /proc/net -> self/net
In other words - this behaves like /proc/mounts, but unlike
"mounts", "net" is not a file, but a directory.
Changes from v2:
* Fixed discrepancy of /proc/net nlink count and selinux labeling
screwup pointed out by Stephen.
To get the correct nlink count the ->getattr callback for /proc/net
is overridden to read one from the net->proc_net entry.
To make selinux still work the net->proc_net entry is initialized
properly, i.e. with the "net" name and the proc_net parent.
Selinux fixes are
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Changes from v1:
* Fixed a task_struct leak in get_proc_task_net, pointed out by Paul.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-07 19:08:40 +00:00
|
|
|
|
2012-08-23 10:43:24 +00:00
|
|
|
static inline int task_dumpable(struct task_struct *task)
|
|
|
|
{
|
|
|
|
int dumpable = 0;
|
|
|
|
struct mm_struct *mm;
|
|
|
|
|
|
|
|
task_lock(task);
|
|
|
|
mm = task->mm;
|
|
|
|
if (mm)
|
|
|
|
dumpable = get_dumpable(mm);
|
|
|
|
task_unlock(task);
|
2013-02-28 01:03:15 +00:00
|
|
|
if (dumpable == SUID_DUMP_USER)
|
2012-08-23 10:43:24 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int pid_delete_dentry(const struct dentry * dentry)
|
|
|
|
{
|
|
|
|
/* Is the task we represent dead?
|
|
|
|
* If so, then don't put the dentry on the lru list,
|
|
|
|
* kill it immediately.
|
|
|
|
*/
|
|
|
|
return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned name_to_int(struct dentry *dentry)
|
|
|
|
{
|
|
|
|
const char *name = dentry->d_name.name;
|
|
|
|
int len = dentry->d_name.len;
|
|
|
|
unsigned n = 0;
|
|
|
|
|
|
|
|
if (len > 1 && *name == '0')
|
|
|
|
goto out;
|
|
|
|
while (len-- > 0) {
|
|
|
|
unsigned c = *name++ - '0';
|
|
|
|
if (c > 9)
|
|
|
|
goto out;
|
|
|
|
if (n >= (~0U-9)/10)
|
|
|
|
goto out;
|
|
|
|
n *= 10;
|
|
|
|
n += c;
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
out:
|
|
|
|
return ~0U;
|
|
|
|
}
|
|
|
|
|
[NET]: Make /proc/net a symlink on /proc/self/net (v3)
Current /proc/net is done with so called "shadows", but current
implementation is broken and has little chances to get fixed.
The problem is that dentries subtree of /proc/net directory has
fancy revalidation rules to make processes living in different
net namespaces see different entries in /proc/net subtree, but
currently, tasks see in the /proc/net subdir the contents of any
other namespace, depending on who opened the file first.
The proposed fix is to turn /proc/net into a symlink, which points
to /proc/self/net, which in turn shows what previously was in
/proc/net - the network-related info, from the net namespace the
appropriate task lives in.
# ls -l /proc/net
lrwxrwxrwx 1 root root 8 Mar 5 15:17 /proc/net -> self/net
In other words - this behaves like /proc/mounts, but unlike
"mounts", "net" is not a file, but a directory.
Changes from v2:
* Fixed discrepancy of /proc/net nlink count and selinux labeling
screwup pointed out by Stephen.
To get the correct nlink count the ->getattr callback for /proc/net
is overridden to read one from the net->proc_net entry.
To make selinux still work the net->proc_net entry is initialized
properly, i.e. with the "net" name and the proc_net parent.
Selinux fixes are
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Changes from v1:
* Fixed a task_struct leak in get_proc_task_net, pointed out by Paul.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-07 19:08:40 +00:00
|
|
|
struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *ino,
|
|
|
|
struct dentry *dentry);
|
|
|
|
int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent,
|
|
|
|
filldir_t filldir);
|
2008-07-25 08:48:29 +00:00
|
|
|
|
|
|
|
struct pde_opener {
|
|
|
|
struct inode *inode;
|
|
|
|
struct file *file;
|
|
|
|
int (*release)(struct inode *, struct file *);
|
|
|
|
struct list_head lh;
|
|
|
|
};
|
2009-02-20 14:04:33 +00:00
|
|
|
void pde_users_dec(struct proc_dir_entry *pde);
|
2009-04-07 17:19:18 +00:00
|
|
|
|
|
|
|
extern spinlock_t proc_subdir_lock;
|
|
|
|
|
2012-06-10 21:13:09 +00:00
|
|
|
struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int);
|
2009-04-07 17:19:18 +00:00
|
|
|
int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
|
|
|
|
unsigned long task_vsize(struct mm_struct *);
|
2011-01-13 01:00:32 +00:00
|
|
|
unsigned long task_statm(struct mm_struct *,
|
|
|
|
unsigned long *, unsigned long *, unsigned long *, unsigned long *);
|
2009-04-07 17:19:18 +00:00
|
|
|
void task_mem(struct seq_file *, struct mm_struct *);
|
|
|
|
|
2009-12-16 00:45:39 +00:00
|
|
|
static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde)
|
|
|
|
{
|
|
|
|
atomic_inc(&pde->count);
|
|
|
|
return pde;
|
|
|
|
}
|
|
|
|
void pde_put(struct proc_dir_entry *pde);
|
2009-04-07 17:19:18 +00:00
|
|
|
|
|
|
|
int proc_fill_super(struct super_block *);
|
2011-01-13 01:00:33 +00:00
|
|
|
struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *);
|
2012-01-10 23:11:27 +00:00
|
|
|
int proc_remount(struct super_block *sb, int *flags, char *data);
|
2009-04-07 17:19:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These are generic /proc routines that use the internal
|
|
|
|
* "struct proc_dir_entry" tree to traverse the filesystem.
|
|
|
|
*
|
|
|
|
* The /proc root directory has extended versions to take care
|
|
|
|
* of the /proc/<pid> subdirectories.
|
|
|
|
*/
|
|
|
|
int proc_readdir(struct file *, void *, filldir_t);
|
2012-06-10 21:13:09 +00:00
|
|
|
struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int);
|
2010-03-08 00:41:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Lookups */
|
|
|
|
typedef struct dentry *instantiate_t(struct inode *, struct dentry *,
|
|
|
|
struct task_struct *, const void *);
|
|
|
|
int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
|
|
|
|
const char *name, int len,
|
|
|
|
instantiate_t instantiate, struct task_struct *task, const void *ptr);
|
2012-06-10 20:03:43 +00:00
|
|
|
int pid_revalidate(struct dentry *dentry, unsigned int flags);
|
2010-03-08 00:41:34 +00:00
|
|
|
struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task);
|
|
|
|
extern const struct dentry_operations pid_dentry_operations;
|
|
|
|
int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
|
|
|
|
int proc_setattr(struct dentry *dentry, struct iattr *attr);
|
|
|
|
|
|
|
|
extern const struct inode_operations proc_ns_dir_inode_operations;
|
|
|
|
extern const struct file_operations proc_ns_dir_operations;
|
|
|
|
|