aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/Makefile2
-rw-r--r--fs/proc/array.c1
-rw-r--r--fs/proc/base.c100
-rw-r--r--fs/proc/internal.h18
-rw-r--r--fs/proc/kcore.c9
-rw-r--r--fs/proc/meminfo.c1
-rw-r--r--fs/proc/mmu.c60
7 files changed, 109 insertions, 82 deletions
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index 712f24db9600..ab30716584f5 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -5,7 +5,7 @@
5obj-y += proc.o 5obj-y += proc.o
6 6
7proc-y := nommu.o task_nommu.o 7proc-y := nommu.o task_nommu.o
8proc-$(CONFIG_MMU) := mmu.o task_mmu.o 8proc-$(CONFIG_MMU) := task_mmu.o
9 9
10proc-y += inode.o root.o base.o generic.o array.o \ 10proc-y += inode.o root.o base.o generic.o array.o \
11 fd.o 11 fd.o
diff --git a/fs/proc/array.c b/fs/proc/array.c
index f7ed9ee46eb9..cbd0f1b324b9 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -143,6 +143,7 @@ static const char * const task_state_array[] = {
143 "x (dead)", /* 64 */ 143 "x (dead)", /* 64 */
144 "K (wakekill)", /* 128 */ 144 "K (wakekill)", /* 128 */
145 "W (waking)", /* 256 */ 145 "W (waking)", /* 256 */
146 "P (parked)", /* 512 */
146}; 147};
147 148
148static inline const char *get_task_state(struct task_struct *tsk) 149static inline const char *get_task_state(struct task_struct *tsk)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 69078c7cef1f..a19308604145 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -86,6 +86,7 @@
86#include <linux/fs_struct.h> 86#include <linux/fs_struct.h>
87#include <linux/slab.h> 87#include <linux/slab.h>
88#include <linux/flex_array.h> 88#include <linux/flex_array.h>
89#include <linux/posix-timers.h>
89#ifdef CONFIG_HARDWALL 90#ifdef CONFIG_HARDWALL
90#include <asm/hardwall.h> 91#include <asm/hardwall.h>
91#endif 92#endif
@@ -2013,6 +2014,102 @@ static const struct file_operations proc_map_files_operations = {
2013 .llseek = default_llseek, 2014 .llseek = default_llseek,
2014}; 2015};
2015 2016
2017struct timers_private {
2018 struct pid *pid;
2019 struct task_struct *task;
2020 struct sighand_struct *sighand;
2021 struct pid_namespace *ns;
2022 unsigned long flags;
2023};
2024
2025static void *timers_start(struct seq_file *m, loff_t *pos)
2026{
2027 struct timers_private *tp = m->private;
2028
2029 tp->task = get_pid_task(tp->pid, PIDTYPE_PID);
2030 if (!tp->task)
2031 return ERR_PTR(-ESRCH);
2032
2033 tp->sighand = lock_task_sighand(tp->task, &tp->flags);
2034 if (!tp->sighand)
2035 return ERR_PTR(-ESRCH);
2036
2037 return seq_list_start(&tp->task->signal->posix_timers, *pos);
2038}
2039
2040static void *timers_next(struct seq_file *m, void *v, loff_t *pos)
2041{
2042 struct timers_private *tp = m->private;
2043 return seq_list_next(v, &tp->task->signal->posix_timers, pos);
2044}
2045
2046static void timers_stop(struct seq_file *m, void *v)
2047{
2048 struct timers_private *tp = m->private;
2049
2050 if (tp->sighand) {
2051 unlock_task_sighand(tp->task, &tp->flags);
2052 tp->sighand = NULL;
2053 }
2054
2055 if (tp->task) {
2056 put_task_struct(tp->task);
2057 tp->task = NULL;
2058 }
2059}
2060
2061static int show_timer(struct seq_file *m, void *v)
2062{
2063 struct k_itimer *timer;
2064 struct timers_private *tp = m->private;
2065 int notify;
2066 static char *nstr[] = {
2067 [SIGEV_SIGNAL] = "signal",
2068 [SIGEV_NONE] = "none",
2069 [SIGEV_THREAD] = "thread",
2070 };
2071
2072 timer = list_entry((struct list_head *)v, struct k_itimer, list);
2073 notify = timer->it_sigev_notify;
2074
2075 seq_printf(m, "ID: %d\n", timer->it_id);
2076 seq_printf(m, "signal: %d/%p\n", timer->sigq->info.si_signo,
2077 timer->sigq->info.si_value.sival_ptr);
2078 seq_printf(m, "notify: %s/%s.%d\n",
2079 nstr[notify & ~SIGEV_THREAD_ID],
2080 (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
2081 pid_nr_ns(timer->it_pid, tp->ns));
2082
2083 return 0;
2084}
2085
2086static const struct seq_operations proc_timers_seq_ops = {
2087 .start = timers_start,
2088 .next = timers_next,
2089 .stop = timers_stop,
2090 .show = show_timer,
2091};
2092
2093static int proc_timers_open(struct inode *inode, struct file *file)
2094{
2095 struct timers_private *tp;
2096
2097 tp = __seq_open_private(file, &proc_timers_seq_ops,
2098 sizeof(struct timers_private));
2099 if (!tp)
2100 return -ENOMEM;
2101
2102 tp->pid = proc_pid(inode);
2103 tp->ns = inode->i_sb->s_fs_info;
2104 return 0;
2105}
2106
2107static const struct file_operations proc_timers_operations = {
2108 .open = proc_timers_open,
2109 .read = seq_read,
2110 .llseek = seq_lseek,
2111 .release = seq_release_private,
2112};
2016#endif /* CONFIG_CHECKPOINT_RESTORE */ 2113#endif /* CONFIG_CHECKPOINT_RESTORE */
2017 2114
2018static struct dentry *proc_pident_instantiate(struct inode *dir, 2115static struct dentry *proc_pident_instantiate(struct inode *dir,
@@ -2583,6 +2680,9 @@ static const struct pid_entry tgid_base_stuff[] = {
2583 REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations), 2680 REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations),
2584 REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations), 2681 REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
2585#endif 2682#endif
2683#ifdef CONFIG_CHECKPOINT_RESTORE
2684 REG("timers", S_IRUGO, proc_timers_operations),
2685#endif
2586}; 2686};
2587 2687
2588static int proc_tgid_base_readdir(struct file * filp, 2688static int proc_tgid_base_readdir(struct file * filp,
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 85ff3a4598b3..75710357a517 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -30,24 +30,6 @@ extern int proc_net_init(void);
30static inline int proc_net_init(void) { return 0; } 30static inline int proc_net_init(void) { return 0; }
31#endif 31#endif
32 32
33struct vmalloc_info {
34 unsigned long used;
35 unsigned long largest_chunk;
36};
37
38#ifdef CONFIG_MMU
39#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
40extern void get_vmalloc_info(struct vmalloc_info *vmi);
41#else
42
43#define VMALLOC_TOTAL 0UL
44#define get_vmalloc_info(vmi) \
45do { \
46 (vmi)->used = 0; \
47 (vmi)->largest_chunk = 0; \
48} while(0)
49#endif
50
51extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, 33extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
52 struct pid *pid, struct task_struct *task); 34 struct pid *pid, struct task_struct *task);
53extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, 35extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index eda6f017f272..f6a13f489e30 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -15,6 +15,7 @@
15#include <linux/capability.h> 15#include <linux/capability.h>
16#include <linux/elf.h> 16#include <linux/elf.h>
17#include <linux/elfcore.h> 17#include <linux/elfcore.h>
18#include <linux/notifier.h>
18#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
20#include <linux/printk.h> 21#include <linux/printk.h>
@@ -564,7 +565,6 @@ static const struct file_operations proc_kcore_operations = {
564 .llseek = default_llseek, 565 .llseek = default_llseek,
565}; 566};
566 567
567#ifdef CONFIG_MEMORY_HOTPLUG
568/* just remember that we have to update kcore */ 568/* just remember that we have to update kcore */
569static int __meminit kcore_callback(struct notifier_block *self, 569static int __meminit kcore_callback(struct notifier_block *self,
570 unsigned long action, void *arg) 570 unsigned long action, void *arg)
@@ -578,8 +578,11 @@ static int __meminit kcore_callback(struct notifier_block *self,
578 } 578 }
579 return NOTIFY_OK; 579 return NOTIFY_OK;
580} 580}
581#endif
582 581
582static struct notifier_block kcore_callback_nb __meminitdata = {
583 .notifier_call = kcore_callback,
584 .priority = 0,
585};
583 586
584static struct kcore_list kcore_vmalloc; 587static struct kcore_list kcore_vmalloc;
585 588
@@ -631,7 +634,7 @@ static int __init proc_kcore_init(void)
631 add_modules_range(); 634 add_modules_range();
632 /* Store direct-map area from physical memory map */ 635 /* Store direct-map area from physical memory map */
633 kcore_update_ram(); 636 kcore_update_ram();
634 hotplug_memory_notifier(kcore_callback, 0); 637 register_hotmemory_notifier(&kcore_callback_nb);
635 638
636 return 0; 639 return 0;
637} 640}
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 1efaaa19c4f3..5aa847a603c0 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -11,6 +11,7 @@
11#include <linux/swap.h> 11#include <linux/swap.h>
12#include <linux/vmstat.h> 12#include <linux/vmstat.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <linux/vmalloc.h>
14#include <asm/page.h> 15#include <asm/page.h>
15#include <asm/pgtable.h> 16#include <asm/pgtable.h>
16#include "internal.h" 17#include "internal.h"
diff --git a/fs/proc/mmu.c b/fs/proc/mmu.c
deleted file mode 100644
index 8ae221dfd010..000000000000
--- a/fs/proc/mmu.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/* mmu.c: mmu memory info files
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/spinlock.h>
12#include <linux/vmalloc.h>
13#include <linux/highmem.h>
14#include <asm/pgtable.h>
15#include "internal.h"
16
17void get_vmalloc_info(struct vmalloc_info *vmi)
18{
19 struct vm_struct *vma;
20 unsigned long free_area_size;
21 unsigned long prev_end;
22
23 vmi->used = 0;
24
25 if (!vmlist) {
26 vmi->largest_chunk = VMALLOC_TOTAL;
27 }
28 else {
29 vmi->largest_chunk = 0;
30
31 prev_end = VMALLOC_START;
32
33 read_lock(&vmlist_lock);
34
35 for (vma = vmlist; vma; vma = vma->next) {
36 unsigned long addr = (unsigned long) vma->addr;
37
38 /*
39 * Some archs keep another range for modules in vmlist
40 */
41 if (addr < VMALLOC_START)
42 continue;
43 if (addr >= VMALLOC_END)
44 break;
45
46 vmi->used += vma->size;
47
48 free_area_size = addr - prev_end;
49 if (vmi->largest_chunk < free_area_size)
50 vmi->largest_chunk = free_area_size;
51
52 prev_end = vma->size + addr;
53 }
54
55 if (VMALLOC_END - prev_end > vmi->largest_chunk)
56 vmi->largest_chunk = VMALLOC_END - prev_end;
57
58 read_unlock(&vmlist_lock);
59 }
60}