diff options
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 61 |
1 files changed, 45 insertions, 16 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ce410bb9f2e1..2082b1a88fb9 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/aio.h> | ||
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
23 | #include <linux/swap.h> | 24 | #include <linux/swap.h> |
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
@@ -92,11 +93,9 @@ | |||
92 | #include <linux/nmi.h> | 93 | #include <linux/nmi.h> |
93 | #endif | 94 | #endif |
94 | 95 | ||
95 | |||
96 | #if defined(CONFIG_SYSCTL) | 96 | #if defined(CONFIG_SYSCTL) |
97 | 97 | ||
98 | /* External variables not in a header file. */ | 98 | /* External variables not in a header file. */ |
99 | extern int max_threads; | ||
100 | extern int suid_dumpable; | 99 | extern int suid_dumpable; |
101 | #ifdef CONFIG_COREDUMP | 100 | #ifdef CONFIG_COREDUMP |
102 | extern int core_uses_pid; | 101 | extern int core_uses_pid; |
@@ -709,10 +708,10 @@ static struct ctl_table kern_table[] = { | |||
709 | #endif | 708 | #endif |
710 | { | 709 | { |
711 | .procname = "threads-max", | 710 | .procname = "threads-max", |
712 | .data = &max_threads, | 711 | .data = NULL, |
713 | .maxlen = sizeof(int), | 712 | .maxlen = sizeof(int), |
714 | .mode = 0644, | 713 | .mode = 0644, |
715 | .proc_handler = proc_dointvec, | 714 | .proc_handler = sysctl_max_threads, |
716 | }, | 715 | }, |
717 | { | 716 | { |
718 | .procname = "random", | 717 | .procname = "random", |
@@ -846,7 +845,7 @@ static struct ctl_table kern_table[] = { | |||
846 | .data = &watchdog_user_enabled, | 845 | .data = &watchdog_user_enabled, |
847 | .maxlen = sizeof (int), | 846 | .maxlen = sizeof (int), |
848 | .mode = 0644, | 847 | .mode = 0644, |
849 | .proc_handler = proc_dowatchdog, | 848 | .proc_handler = proc_watchdog, |
850 | .extra1 = &zero, | 849 | .extra1 = &zero, |
851 | .extra2 = &one, | 850 | .extra2 = &one, |
852 | }, | 851 | }, |
@@ -855,11 +854,33 @@ static struct ctl_table kern_table[] = { | |||
855 | .data = &watchdog_thresh, | 854 | .data = &watchdog_thresh, |
856 | .maxlen = sizeof(int), | 855 | .maxlen = sizeof(int), |
857 | .mode = 0644, | 856 | .mode = 0644, |
858 | .proc_handler = proc_dowatchdog, | 857 | .proc_handler = proc_watchdog_thresh, |
859 | .extra1 = &zero, | 858 | .extra1 = &zero, |
860 | .extra2 = &sixty, | 859 | .extra2 = &sixty, |
861 | }, | 860 | }, |
862 | { | 861 | { |
862 | .procname = "nmi_watchdog", | ||
863 | .data = &nmi_watchdog_enabled, | ||
864 | .maxlen = sizeof (int), | ||
865 | .mode = 0644, | ||
866 | .proc_handler = proc_nmi_watchdog, | ||
867 | .extra1 = &zero, | ||
868 | #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) | ||
869 | .extra2 = &one, | ||
870 | #else | ||
871 | .extra2 = &zero, | ||
872 | #endif | ||
873 | }, | ||
874 | { | ||
875 | .procname = "soft_watchdog", | ||
876 | .data = &soft_watchdog_enabled, | ||
877 | .maxlen = sizeof (int), | ||
878 | .mode = 0644, | ||
879 | .proc_handler = proc_soft_watchdog, | ||
880 | .extra1 = &zero, | ||
881 | .extra2 = &one, | ||
882 | }, | ||
883 | { | ||
863 | .procname = "softlockup_panic", | 884 | .procname = "softlockup_panic", |
864 | .data = &softlockup_panic, | 885 | .data = &softlockup_panic, |
865 | .maxlen = sizeof(int), | 886 | .maxlen = sizeof(int), |
@@ -879,15 +900,6 @@ static struct ctl_table kern_table[] = { | |||
879 | .extra2 = &one, | 900 | .extra2 = &one, |
880 | }, | 901 | }, |
881 | #endif /* CONFIG_SMP */ | 902 | #endif /* CONFIG_SMP */ |
882 | { | ||
883 | .procname = "nmi_watchdog", | ||
884 | .data = &watchdog_user_enabled, | ||
885 | .maxlen = sizeof (int), | ||
886 | .mode = 0644, | ||
887 | .proc_handler = proc_dowatchdog, | ||
888 | .extra1 = &zero, | ||
889 | .extra2 = &one, | ||
890 | }, | ||
891 | #endif | 903 | #endif |
892 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | 904 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) |
893 | { | 905 | { |
@@ -1321,6 +1333,15 @@ static struct ctl_table vm_table[] = { | |||
1321 | .extra1 = &min_extfrag_threshold, | 1333 | .extra1 = &min_extfrag_threshold, |
1322 | .extra2 = &max_extfrag_threshold, | 1334 | .extra2 = &max_extfrag_threshold, |
1323 | }, | 1335 | }, |
1336 | { | ||
1337 | .procname = "compact_unevictable_allowed", | ||
1338 | .data = &sysctl_compact_unevictable_allowed, | ||
1339 | .maxlen = sizeof(int), | ||
1340 | .mode = 0644, | ||
1341 | .proc_handler = proc_dointvec, | ||
1342 | .extra1 = &zero, | ||
1343 | .extra2 = &one, | ||
1344 | }, | ||
1324 | 1345 | ||
1325 | #endif /* CONFIG_COMPACTION */ | 1346 | #endif /* CONFIG_COMPACTION */ |
1326 | { | 1347 | { |
@@ -1960,7 +1981,15 @@ static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, | |||
1960 | int write, void *data) | 1981 | int write, void *data) |
1961 | { | 1982 | { |
1962 | if (write) { | 1983 | if (write) { |
1963 | *valp = *negp ? -*lvalp : *lvalp; | 1984 | if (*negp) { |
1985 | if (*lvalp > (unsigned long) INT_MAX + 1) | ||
1986 | return -EINVAL; | ||
1987 | *valp = -*lvalp; | ||
1988 | } else { | ||
1989 | if (*lvalp > (unsigned long) INT_MAX) | ||
1990 | return -EINVAL; | ||
1991 | *valp = *lvalp; | ||
1992 | } | ||
1964 | } else { | 1993 | } else { |
1965 | int val = *valp; | 1994 | int val = *valp; |
1966 | if (val < 0) { | 1995 | if (val < 0) { |