Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-drm-fsl-dcu.git] / fs / proc / proc_misc.c
index 66bc425f2f3db467344dd81c841442c5806b985e..5e2d4359c2927b6ad851a6607f5c955eec64d8ae 100644 (file)
 #include <linux/seq_file.h>
 #include <linux/times.h>
 #include <linux/profile.h>
+#include <linux/utsname.h>
 #include <linux/blkdev.h>
 #include <linux/hugetlb.h>
 #include <linux/jiffies.h>
 #include <linux/sysrq.h>
 #include <linux/vmalloc.h>
 #include <linux/crash_dump.h>
+#include <linux/pid_namespace.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
@@ -91,7 +93,7 @@ static int loadavg_read_proc(char *page, char **start, off_t off,
                LOAD_INT(a), LOAD_FRAC(a),
                LOAD_INT(b), LOAD_FRAC(b),
                LOAD_INT(c), LOAD_FRAC(c),
-               nr_running(), nr_threads, last_pid);
+               nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid);
        return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
@@ -119,16 +121,11 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
 {
        struct sysinfo i;
        int len;
-       unsigned long inactive;
-       unsigned long active;
-       unsigned long free;
        unsigned long committed;
        unsigned long allowed;
        struct vmalloc_info vmi;
        long cached;
 
-       get_zone_counts(&active, &inactive, &free);
-
 /*
  * display in kilobytes.
  */
@@ -185,8 +182,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
                K(i.bufferram),
                K(cached),
                K(total_swapcache_pages),
-               K(active),
-               K(inactive),
+               K(global_page_state(NR_ACTIVE)),
+               K(global_page_state(NR_INACTIVE)),
 #ifdef CONFIG_HIGHMEM
                K(i.totalhigh),
                K(i.freehigh),
@@ -251,8 +248,10 @@ static int version_read_proc(char *page, char **start, off_t off,
 {
        int len;
 
-       strcpy(page, linux_banner);
-       len = strlen(page);
+       len = snprintf(page, PAGE_SIZE, linux_proc_banner,
+               utsname()->sysname,
+               utsname()->release,
+               utsname()->version);
        return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
@@ -646,7 +645,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
 
                if (get_user(c, buf))
                        return -EFAULT;
-               __handle_sysrq(c, NULL, NULL, 0);
+               __handle_sysrq(c, NULL, 0);
        }
        return count;
 }
@@ -668,7 +667,6 @@ void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
 
 void __init proc_misc_init(void)
 {
-       struct proc_dir_entry *entry;
        static struct {
                char *name;
                int (*read_proc)(char*,char**,off_t,int,int*,void*);
@@ -695,9 +693,14 @@ void __init proc_misc_init(void)
        proc_symlink("mounts", NULL, "self/mounts");
 
        /* And now for trickier ones */
-       entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
-       if (entry)
-               entry->proc_fops = &proc_kmsg_operations;
+#ifdef CONFIG_PRINTK
+       {
+               struct proc_dir_entry *entry;
+               entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
+               if (entry)
+                       entry->proc_fops = &proc_kmsg_operations;
+       }
+#endif
        create_seq_entry("devices", 0, &proc_devinfo_operations);
        create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
 #ifdef CONFIG_BLOCK
@@ -737,8 +740,11 @@ void __init proc_misc_init(void)
                proc_vmcore->proc_fops = &proc_vmcore_operations;
 #endif
 #ifdef CONFIG_MAGIC_SYSRQ
-       entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
-       if (entry)
-               entry->proc_fops = &proc_sysrq_trigger_operations;
+       {
+               struct proc_dir_entry *entry;
+               entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
+               if (entry)
+                       entry->proc_fops = &proc_sysrq_trigger_operations;
+       }
 #endif
 }