Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * sysctl.c: General linux system control interface |
| 3 | * |
| 4 | * Begun 24 March 1995, Stephen Tweedie |
| 5 | * Added /proc support, Dec 1995 |
| 6 | * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas. |
| 7 | * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver. |
| 8 | * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver. |
| 9 | * Dynamic registration fixes, Stephen Tweedie. |
| 10 | * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn. |
| 11 | * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris |
| 12 | * Horn. |
| 13 | * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer. |
| 14 | * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer. |
| 15 | * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill |
| 16 | * Wendling. |
| 17 | * The list_for_each() macro wasn't appropriate for the sysctl loop. |
| 18 | * Removed it and replaced it with older style, 03/23/00, Bill Wendling |
| 19 | */ |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <linux/module.h> |
| 22 | #include <linux/mm.h> |
| 23 | #include <linux/swap.h> |
| 24 | #include <linux/slab.h> |
| 25 | #include <linux/sysctl.h> |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 26 | #include <linux/bitmap.h> |
Dave Young | d33ed52 | 2010-03-10 15:23:59 -0800 | [diff] [blame] | 27 | #include <linux/signal.h> |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 28 | #include <linux/printk.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <linux/proc_fs.h> |
Andrew Morgan | 72c2d58 | 2007-10-18 03:05:59 -0700 | [diff] [blame] | 30 | #include <linux/security.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include <linux/ctype.h> |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 32 | #include <linux/kmemcheck.h> |
Steven Rostedt | fd4b616 | 2012-07-30 14:42:48 -0700 | [diff] [blame] | 33 | #include <linux/kmemleak.h> |
Adrian Bunk | 62239ac | 2007-07-17 04:03:45 -0700 | [diff] [blame] | 34 | #include <linux/fs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <linux/init.h> |
| 36 | #include <linux/kernel.h> |
Kay Sievers | 0296b22 | 2005-11-11 05:33:52 +0100 | [diff] [blame] | 37 | #include <linux/kobject.h> |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 38 | #include <linux/net.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include <linux/sysrq.h> |
| 40 | #include <linux/highuid.h> |
| 41 | #include <linux/writeback.h> |
Ingo Molnar | 3fff4c4 | 2009-09-22 16:18:09 +0200 | [diff] [blame] | 42 | #include <linux/ratelimit.h> |
Mel Gorman | 76ab0f5 | 2010-05-24 14:32:28 -0700 | [diff] [blame] | 43 | #include <linux/compaction.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <linux/hugetlb.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <linux/initrd.h> |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 46 | #include <linux/key.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #include <linux/times.h> |
| 48 | #include <linux/limits.h> |
| 49 | #include <linux/dcache.h> |
Alexey Dobriyan | 6e00670 | 2010-01-20 22:27:56 +0200 | [diff] [blame] | 50 | #include <linux/dnotify.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | #include <linux/syscalls.h> |
Adrian Bunk | c748e13 | 2008-07-23 21:27:03 -0700 | [diff] [blame] | 52 | #include <linux/vmstat.h> |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 53 | #include <linux/nfs_fs.h> |
| 54 | #include <linux/acpi.h> |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 55 | #include <linux/reboot.h> |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 56 | #include <linux/ftrace.h> |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 57 | #include <linux/perf_event.h> |
Masami Hiramatsu | b2be84d | 2010-02-25 08:34:15 -0500 | [diff] [blame] | 58 | #include <linux/kprobes.h> |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 59 | #include <linux/pipe_fs_i.h> |
David Rientjes | 8e4228e | 2010-08-09 17:18:56 -0700 | [diff] [blame] | 60 | #include <linux/oom.h> |
Eric Paris | 17f60a7 | 2011-04-01 17:07:50 -0400 | [diff] [blame] | 61 | #include <linux/kmod.h> |
Dan Ballard | 73efc03 | 2011-10-31 17:11:20 -0700 | [diff] [blame] | 62 | #include <linux/capability.h> |
Al Viro | 4040153 | 2012-02-13 03:58:52 +0000 | [diff] [blame] | 63 | #include <linux/binfmts.h> |
Clark Williams | cf4aebc2 | 2013-02-07 09:46:59 -0600 | [diff] [blame] | 64 | #include <linux/sched/sysctl.h> |
Kees Cook | 7984754 | 2014-01-23 15:55:59 -0800 | [diff] [blame] | 65 | #include <linux/kexec.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | #include <asm/uaccess.h> |
| 68 | #include <asm/processor.h> |
| 69 | |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 70 | #ifdef CONFIG_X86 |
| 71 | #include <asm/nmi.h> |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 72 | #include <asm/stacktrace.h> |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 73 | #include <asm/io.h> |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 74 | #endif |
David Howells | d550bbd | 2012-03-28 18:30:03 +0100 | [diff] [blame] | 75 | #ifdef CONFIG_SPARC |
| 76 | #include <asm/setup.h> |
| 77 | #endif |
Dave Young | c55b7c3 | 2010-03-10 15:24:08 -0800 | [diff] [blame] | 78 | #ifdef CONFIG_BSD_PROCESS_ACCT |
| 79 | #include <linux/acct.h> |
| 80 | #endif |
Dave Young | 4f0e056 | 2010-03-10 15:24:09 -0800 | [diff] [blame] | 81 | #ifdef CONFIG_RT_MUTEXES |
| 82 | #include <linux/rtmutex.h> |
| 83 | #endif |
Dave Young | 2edf5e4 | 2010-03-10 15:24:10 -0800 | [diff] [blame] | 84 | #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) |
| 85 | #include <linux/lockdep.h> |
| 86 | #endif |
Dave Young | 15485a4 | 2010-03-10 15:24:07 -0800 | [diff] [blame] | 87 | #ifdef CONFIG_CHR_DEV_SG |
| 88 | #include <scsi/sg.h> |
| 89 | #endif |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 90 | |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 91 | #ifdef CONFIG_LOCKUP_DETECTOR |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 92 | #include <linux/nmi.h> |
| 93 | #endif |
| 94 | |
Eric W. Biederman | 7058cb0 | 2007-10-18 03:05:58 -0700 | [diff] [blame] | 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | #if defined(CONFIG_SYSCTL) |
| 97 | |
| 98 | /* External variables not in a header file. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | extern int max_threads; |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 100 | extern int suid_dumpable; |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 101 | #ifdef CONFIG_COREDUMP |
| 102 | extern int core_uses_pid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | extern char core_pattern[]; |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 104 | extern unsigned int core_pipe_limit; |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 105 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | extern int pid_max; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | extern int pid_max_min, pid_max_max; |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 108 | extern int percpu_pagelist_fraction; |
Andi Kleen | bebfa10 | 2006-06-26 13:56:52 +0200 | [diff] [blame] | 109 | extern int compat_log; |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 110 | extern int latencytop_enabled; |
Al Viro | eceea0b | 2008-05-10 10:08:32 -0400 | [diff] [blame] | 111 | extern int sysctl_nr_open_min, sysctl_nr_open_max; |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 112 | #ifndef CONFIG_MMU |
| 113 | extern int sysctl_nr_trim_pages; |
| 114 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 116 | /* Constants used for minimum and maximum */ |
Don Zickus | 2508ce1 | 2010-05-07 17:11:46 -0400 | [diff] [blame] | 117 | #ifdef CONFIG_LOCKUP_DETECTOR |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 118 | static int sixty = 60; |
| 119 | #endif |
| 120 | |
Aaron Tomlin | 270750db | 2014-01-20 17:34:13 +0000 | [diff] [blame] | 121 | static int __maybe_unused neg_one = -1; |
| 122 | |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 123 | static int zero; |
Linus Torvalds | cd5f9a4 | 2009-04-06 13:38:46 -0700 | [diff] [blame] | 124 | static int __maybe_unused one = 1; |
| 125 | static int __maybe_unused two = 2; |
Dave Hansen | 5509a5d | 2014-04-03 14:48:19 -0700 | [diff] [blame] | 126 | static int __maybe_unused four = 4; |
Sven Wegener | fc3501d | 2009-02-11 13:04:23 -0800 | [diff] [blame] | 127 | static unsigned long one_ul = 1; |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 128 | static int one_hundred = 100; |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 129 | #ifdef CONFIG_PRINTK |
| 130 | static int ten_thousand = 10000; |
| 131 | #endif |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 132 | |
Andrea Righi | 9e4a5bd | 2009-04-30 15:08:57 -0700 | [diff] [blame] | 133 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ |
| 134 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; |
| 135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ |
| 137 | static int maxolduid = 65535; |
| 138 | static int minolduid; |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 139 | static int min_percpu_pagelist_fract = 8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | |
| 141 | static int ngroups_max = NGROUPS_MAX; |
Dan Ballard | 73efc03 | 2011-10-31 17:11:20 -0700 | [diff] [blame] | 142 | static const int cap_last_cap = CAP_LAST_CAP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Liu Hua | 80df284 | 2014-04-07 15:38:57 -0700 | [diff] [blame] | 144 | /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */ |
| 145 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 146 | static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); |
| 147 | #endif |
| 148 | |
Dave Young | d14f172 | 2010-02-25 20:28:57 -0500 | [diff] [blame] | 149 | #ifdef CONFIG_INOTIFY_USER |
| 150 | #include <linux/inotify.h> |
| 151 | #endif |
David S. Miller | 72c57ed | 2008-09-11 23:29:54 -0700 | [diff] [blame] | 152 | #ifdef CONFIG_SPARC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | #endif |
| 154 | |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 155 | #ifdef CONFIG_SPARC64 |
| 156 | extern int sysctl_tsb_ratio; |
| 157 | #endif |
| 158 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | #ifdef __hppa__ |
| 160 | extern int pwrsw_enabled; |
Vineet Gupta | bf14e3b | 2013-01-18 15:12:24 +0530 | [diff] [blame] | 161 | #endif |
| 162 | |
| 163 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | extern int unaligned_enabled; |
| 165 | #endif |
| 166 | |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 167 | #ifdef CONFIG_IA64 |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 168 | extern int unaligned_dump_stack; |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 169 | #endif |
| 170 | |
Vineet Gupta | b6fca72 | 2013-01-09 20:06:28 +0530 | [diff] [blame] | 171 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN |
| 172 | extern int no_unaligned_warning; |
| 173 | #endif |
| 174 | |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 175 | #ifdef CONFIG_PROC_SYSCTL |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 176 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 177 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 178 | static int proc_taint(struct ctl_table *table, int write, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 179 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 180 | #endif |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 181 | |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 182 | #ifdef CONFIG_PRINTK |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 183 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 184 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 185 | #endif |
| 186 | |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 187 | static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, |
| 188 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 189 | #ifdef CONFIG_COREDUMP |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 190 | static int proc_dostring_coredump(struct ctl_table *table, int write, |
| 191 | void __user *buffer, size_t *lenp, loff_t *ppos); |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 192 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 193 | |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 194 | #ifdef CONFIG_MAGIC_SYSRQ |
Andy Whitcroft | 8c6a98b | 2011-01-24 09:31:38 -0800 | [diff] [blame] | 195 | /* Note: sysrq code uses it's own private copy */ |
Ben Hutchings | 8eaede4 | 2013-10-07 01:05:46 +0100 | [diff] [blame] | 196 | static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE; |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 197 | |
| 198 | static int sysrq_sysctl_handler(ctl_table *table, int write, |
| 199 | void __user *buffer, size_t *lenp, |
| 200 | loff_t *ppos) |
| 201 | { |
| 202 | int error; |
| 203 | |
| 204 | error = proc_dointvec(table, write, buffer, lenp, ppos); |
| 205 | if (error) |
| 206 | return error; |
| 207 | |
| 208 | if (write) |
| 209 | sysrq_toggle_support(__sysrq_enabled); |
| 210 | |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | #endif |
| 215 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 216 | static struct ctl_table kern_table[]; |
| 217 | static struct ctl_table vm_table[]; |
| 218 | static struct ctl_table fs_table[]; |
| 219 | static struct ctl_table debug_table[]; |
| 220 | static struct ctl_table dev_table[]; |
| 221 | extern struct ctl_table random_table[]; |
Davide Libenzi | 7ef9964 | 2008-12-01 13:13:55 -0800 | [diff] [blame] | 222 | #ifdef CONFIG_EPOLL |
| 223 | extern struct ctl_table epoll_table[]; |
| 224 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
| 226 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
| 227 | int sysctl_legacy_va_layout; |
| 228 | #endif |
| 229 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | /* The default sysctl tables: */ |
| 231 | |
Eric W. Biederman | de4e83bd | 2012-01-06 03:34:20 -0800 | [diff] [blame] | 232 | static struct ctl_table sysctl_base_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | .procname = "kernel", |
| 235 | .mode = 0555, |
| 236 | .child = kern_table, |
| 237 | }, |
| 238 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | .procname = "vm", |
| 240 | .mode = 0555, |
| 241 | .child = vm_table, |
| 242 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | .procname = "fs", |
| 245 | .mode = 0555, |
| 246 | .child = fs_table, |
| 247 | }, |
| 248 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | .procname = "debug", |
| 250 | .mode = 0555, |
| 251 | .child = debug_table, |
| 252 | }, |
| 253 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | .procname = "dev", |
| 255 | .mode = 0555, |
| 256 | .child = dev_table, |
| 257 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 258 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | }; |
| 260 | |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 261 | #ifdef CONFIG_SCHED_DEBUG |
Eric Dumazet | 73c4efd | 2007-12-18 15:21:13 +0100 | [diff] [blame] | 262 | static int min_sched_granularity_ns = 100000; /* 100 usecs */ |
| 263 | static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
| 264 | static int min_wakeup_granularity_ns; /* 0 usecs */ |
| 265 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 266 | #ifdef CONFIG_SMP |
Christian Ehrhardt | 1983a92 | 2009-11-30 12:16:47 +0100 | [diff] [blame] | 267 | static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; |
| 268 | static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 269 | #endif /* CONFIG_SMP */ |
| 270 | #endif /* CONFIG_SCHED_DEBUG */ |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 271 | |
Mel Gorman | 5e77190 | 2010-05-24 14:32:31 -0700 | [diff] [blame] | 272 | #ifdef CONFIG_COMPACTION |
| 273 | static int min_extfrag_threshold; |
| 274 | static int max_extfrag_threshold = 1000; |
| 275 | #endif |
| 276 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 277 | static struct ctl_table kern_table[] = { |
Mike Galbraith | 2bba22c | 2009-09-09 15:41:37 +0200 | [diff] [blame] | 278 | { |
Mike Galbraith | 2bba22c | 2009-09-09 15:41:37 +0200 | [diff] [blame] | 279 | .procname = "sched_child_runs_first", |
| 280 | .data = &sysctl_sched_child_runs_first, |
| 281 | .maxlen = sizeof(unsigned int), |
| 282 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 283 | .proc_handler = proc_dointvec, |
Mike Galbraith | 2bba22c | 2009-09-09 15:41:37 +0200 | [diff] [blame] | 284 | }, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 285 | #ifdef CONFIG_SCHED_DEBUG |
| 286 | { |
Peter Zijlstra | b2be5e9 | 2007-11-09 22:39:37 +0100 | [diff] [blame] | 287 | .procname = "sched_min_granularity_ns", |
| 288 | .data = &sysctl_sched_min_granularity, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 289 | .maxlen = sizeof(unsigned int), |
| 290 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 291 | .proc_handler = sched_proc_update_handler, |
Peter Zijlstra | b2be5e9 | 2007-11-09 22:39:37 +0100 | [diff] [blame] | 292 | .extra1 = &min_sched_granularity_ns, |
| 293 | .extra2 = &max_sched_granularity_ns, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 294 | }, |
| 295 | { |
Peter Zijlstra | 2180508 | 2007-08-25 18:41:53 +0200 | [diff] [blame] | 296 | .procname = "sched_latency_ns", |
| 297 | .data = &sysctl_sched_latency, |
| 298 | .maxlen = sizeof(unsigned int), |
| 299 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 300 | .proc_handler = sched_proc_update_handler, |
Peter Zijlstra | 2180508 | 2007-08-25 18:41:53 +0200 | [diff] [blame] | 301 | .extra1 = &min_sched_granularity_ns, |
| 302 | .extra2 = &max_sched_granularity_ns, |
| 303 | }, |
| 304 | { |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 305 | .procname = "sched_wakeup_granularity_ns", |
| 306 | .data = &sysctl_sched_wakeup_granularity, |
| 307 | .maxlen = sizeof(unsigned int), |
| 308 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 309 | .proc_handler = sched_proc_update_handler, |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 310 | .extra1 = &min_wakeup_granularity_ns, |
| 311 | .extra2 = &max_wakeup_granularity_ns, |
| 312 | }, |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 313 | #ifdef CONFIG_SMP |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 314 | { |
Christian Ehrhardt | 1983a92 | 2009-11-30 12:16:47 +0100 | [diff] [blame] | 315 | .procname = "sched_tunable_scaling", |
| 316 | .data = &sysctl_sched_tunable_scaling, |
| 317 | .maxlen = sizeof(enum sched_tunable_scaling), |
| 318 | .mode = 0644, |
Linus Torvalds | 702a7c7 | 2009-12-12 11:34:10 -0800 | [diff] [blame] | 319 | .proc_handler = sched_proc_update_handler, |
Christian Ehrhardt | 1983a92 | 2009-11-30 12:16:47 +0100 | [diff] [blame] | 320 | .extra1 = &min_sched_tunable_scaling, |
| 321 | .extra2 = &max_sched_tunable_scaling, |
Peter Zijlstra | 2398f2c | 2008-06-27 13:41:35 +0200 | [diff] [blame] | 322 | }, |
| 323 | { |
Namhyung Kim | d00535d | 2012-08-16 11:15:30 +0900 | [diff] [blame] | 324 | .procname = "sched_migration_cost_ns", |
Ingo Molnar | da84d96 | 2007-10-15 17:00:18 +0200 | [diff] [blame] | 325 | .data = &sysctl_sched_migration_cost, |
| 326 | .maxlen = sizeof(unsigned int), |
| 327 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 328 | .proc_handler = proc_dointvec, |
Ingo Molnar | da84d96 | 2007-10-15 17:00:18 +0200 | [diff] [blame] | 329 | }, |
Peter Zijlstra | b82d9fd | 2007-11-09 22:39:39 +0100 | [diff] [blame] | 330 | { |
Peter Zijlstra | b82d9fd | 2007-11-09 22:39:39 +0100 | [diff] [blame] | 331 | .procname = "sched_nr_migrate", |
| 332 | .data = &sysctl_sched_nr_migrate, |
| 333 | .maxlen = sizeof(unsigned int), |
Peter Zijlstra | fa85ae2 | 2008-01-25 21:08:29 +0100 | [diff] [blame] | 334 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 335 | .proc_handler = proc_dointvec, |
Peter Zijlstra | fa85ae2 | 2008-01-25 21:08:29 +0100 | [diff] [blame] | 336 | }, |
Arun R Bharadwaj | cd1bb94 | 2009-04-16 12:15:34 +0530 | [diff] [blame] | 337 | { |
Namhyung Kim | d00535d | 2012-08-16 11:15:30 +0900 | [diff] [blame] | 338 | .procname = "sched_time_avg_ms", |
Peter Zijlstra | e9e9250 | 2009-09-01 10:34:37 +0200 | [diff] [blame] | 339 | .data = &sysctl_sched_time_avg, |
| 340 | .maxlen = sizeof(unsigned int), |
| 341 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 342 | .proc_handler = proc_dointvec, |
Peter Zijlstra | e9e9250 | 2009-09-01 10:34:37 +0200 | [diff] [blame] | 343 | }, |
| 344 | { |
Namhyung Kim | d00535d | 2012-08-16 11:15:30 +0900 | [diff] [blame] | 345 | .procname = "sched_shares_window_ns", |
Paul Turner | a7a4f8a | 2010-11-15 15:47:06 -0800 | [diff] [blame] | 346 | .data = &sysctl_sched_shares_window, |
| 347 | .maxlen = sizeof(unsigned int), |
| 348 | .mode = 0644, |
| 349 | .proc_handler = proc_dointvec, |
| 350 | }, |
| 351 | { |
Arun R Bharadwaj | cd1bb94 | 2009-04-16 12:15:34 +0530 | [diff] [blame] | 352 | .procname = "timer_migration", |
| 353 | .data = &sysctl_timer_migration, |
| 354 | .maxlen = sizeof(unsigned int), |
| 355 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 356 | .proc_handler = proc_dointvec_minmax, |
Arun R Bharadwaj | bfdb4d9 | 2009-06-23 10:00:58 +0530 | [diff] [blame] | 357 | .extra1 = &zero, |
| 358 | .extra2 = &one, |
Arun R Bharadwaj | cd1bb94 | 2009-04-16 12:15:34 +0530 | [diff] [blame] | 359 | }, |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 360 | #endif /* CONFIG_SMP */ |
| 361 | #ifdef CONFIG_NUMA_BALANCING |
| 362 | { |
Peter Zijlstra | 4b96a29 | 2012-10-25 14:16:47 +0200 | [diff] [blame] | 363 | .procname = "numa_balancing_scan_delay_ms", |
| 364 | .data = &sysctl_numa_balancing_scan_delay, |
| 365 | .maxlen = sizeof(unsigned int), |
| 366 | .mode = 0644, |
| 367 | .proc_handler = proc_dointvec, |
| 368 | }, |
| 369 | { |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 370 | .procname = "numa_balancing_scan_period_min_ms", |
| 371 | .data = &sysctl_numa_balancing_scan_period_min, |
| 372 | .maxlen = sizeof(unsigned int), |
| 373 | .mode = 0644, |
| 374 | .proc_handler = proc_dointvec, |
| 375 | }, |
| 376 | { |
| 377 | .procname = "numa_balancing_scan_period_max_ms", |
| 378 | .data = &sysctl_numa_balancing_scan_period_max, |
| 379 | .maxlen = sizeof(unsigned int), |
| 380 | .mode = 0644, |
| 381 | .proc_handler = proc_dointvec, |
| 382 | }, |
Peter Zijlstra | 6e5fb22 | 2012-10-25 14:16:45 +0200 | [diff] [blame] | 383 | { |
| 384 | .procname = "numa_balancing_scan_size_mb", |
| 385 | .data = &sysctl_numa_balancing_scan_size, |
| 386 | .maxlen = sizeof(unsigned int), |
| 387 | .mode = 0644, |
| 388 | .proc_handler = proc_dointvec, |
| 389 | }, |
Mel Gorman | 3a7053b | 2013-10-07 11:29:00 +0100 | [diff] [blame] | 390 | { |
Andi Kleen | 54a43d5 | 2014-01-23 15:53:13 -0800 | [diff] [blame] | 391 | .procname = "numa_balancing", |
| 392 | .data = NULL, /* filled in by handler */ |
| 393 | .maxlen = sizeof(unsigned int), |
| 394 | .mode = 0644, |
| 395 | .proc_handler = sysctl_numa_balancing, |
| 396 | .extra1 = &zero, |
| 397 | .extra2 = &one, |
| 398 | }, |
Peter Zijlstra | cbee9f8 | 2012-10-25 14:16:43 +0200 | [diff] [blame] | 399 | #endif /* CONFIG_NUMA_BALANCING */ |
| 400 | #endif /* CONFIG_SCHED_DEBUG */ |
Ingo Molnar | 1799e35 | 2007-09-19 23:34:46 +0200 | [diff] [blame] | 401 | { |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 402 | .procname = "sched_rt_period_us", |
| 403 | .data = &sysctl_sched_rt_period, |
| 404 | .maxlen = sizeof(unsigned int), |
| 405 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 406 | .proc_handler = sched_rt_handler, |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 407 | }, |
| 408 | { |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 409 | .procname = "sched_rt_runtime_us", |
| 410 | .data = &sysctl_sched_rt_runtime, |
| 411 | .maxlen = sizeof(int), |
| 412 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 413 | .proc_handler = sched_rt_handler, |
Peter Zijlstra | 9f0c1e5 | 2008-02-13 15:45:39 +0100 | [diff] [blame] | 414 | }, |
Clark Williams | ce0dbbb | 2013-02-07 09:47:04 -0600 | [diff] [blame] | 415 | { |
| 416 | .procname = "sched_rr_timeslice_ms", |
| 417 | .data = &sched_rr_timeslice, |
| 418 | .maxlen = sizeof(int), |
| 419 | .mode = 0644, |
| 420 | .proc_handler = sched_rr_handler, |
| 421 | }, |
Mike Galbraith | 5091faa | 2010-11-30 14:18:03 +0100 | [diff] [blame] | 422 | #ifdef CONFIG_SCHED_AUTOGROUP |
| 423 | { |
| 424 | .procname = "sched_autogroup_enabled", |
| 425 | .data = &sysctl_sched_autogroup_enabled, |
| 426 | .maxlen = sizeof(unsigned int), |
| 427 | .mode = 0644, |
Yong Zhang | 1747b21 | 2011-02-20 15:08:12 +0800 | [diff] [blame] | 428 | .proc_handler = proc_dointvec_minmax, |
Mike Galbraith | 5091faa | 2010-11-30 14:18:03 +0100 | [diff] [blame] | 429 | .extra1 = &zero, |
| 430 | .extra2 = &one, |
| 431 | }, |
| 432 | #endif |
Paul Turner | ec12cb7 | 2011-07-21 09:43:30 -0700 | [diff] [blame] | 433 | #ifdef CONFIG_CFS_BANDWIDTH |
| 434 | { |
| 435 | .procname = "sched_cfs_bandwidth_slice_us", |
| 436 | .data = &sysctl_sched_cfs_bandwidth_slice, |
| 437 | .maxlen = sizeof(unsigned int), |
| 438 | .mode = 0644, |
| 439 | .proc_handler = proc_dointvec_minmax, |
| 440 | .extra1 = &one, |
| 441 | }, |
| 442 | #endif |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 443 | #ifdef CONFIG_PROVE_LOCKING |
| 444 | { |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 445 | .procname = "prove_locking", |
| 446 | .data = &prove_locking, |
| 447 | .maxlen = sizeof(int), |
| 448 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 449 | .proc_handler = proc_dointvec, |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 450 | }, |
| 451 | #endif |
| 452 | #ifdef CONFIG_LOCK_STAT |
| 453 | { |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 454 | .procname = "lock_stat", |
| 455 | .data = &lock_stat, |
| 456 | .maxlen = sizeof(int), |
| 457 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 458 | .proc_handler = proc_dointvec, |
Peter Zijlstra | f20786f | 2007-07-19 01:48:56 -0700 | [diff] [blame] | 459 | }, |
| 460 | #endif |
Ingo Molnar | 77e54a1 | 2007-07-09 18:52:00 +0200 | [diff] [blame] | 461 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | .procname = "panic", |
| 463 | .data = &panic_timeout, |
| 464 | .maxlen = sizeof(int), |
| 465 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 466 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | }, |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 468 | #ifdef CONFIG_COREDUMP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | .procname = "core_uses_pid", |
| 471 | .data = &core_uses_pid, |
| 472 | .maxlen = sizeof(int), |
| 473 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 474 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | }, |
| 476 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | .procname = "core_pattern", |
| 478 | .data = core_pattern, |
Dan Aloni | 71ce92f | 2007-05-16 22:11:16 -0700 | [diff] [blame] | 479 | .maxlen = CORENAME_MAX_SIZE, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | .mode = 0644, |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 481 | .proc_handler = proc_dostring_coredump, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | }, |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 483 | { |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 484 | .procname = "core_pipe_limit", |
| 485 | .data = &core_pipe_limit, |
| 486 | .maxlen = sizeof(unsigned int), |
| 487 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 488 | .proc_handler = proc_dointvec, |
Neil Horman | a293980 | 2009-09-23 15:56:56 -0700 | [diff] [blame] | 489 | }, |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 490 | #endif |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 491 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | .procname = "tainted", |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 494 | .maxlen = sizeof(long), |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 495 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 496 | .proc_handler = proc_taint, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | }, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 498 | #endif |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 499 | #ifdef CONFIG_LATENCYTOP |
| 500 | { |
| 501 | .procname = "latencytop", |
| 502 | .data = &latencytop_enabled, |
| 503 | .maxlen = sizeof(int), |
| 504 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 505 | .proc_handler = proc_dointvec, |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 506 | }, |
| 507 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | #ifdef CONFIG_BLK_DEV_INITRD |
| 509 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | .procname = "real-root-dev", |
| 511 | .data = &real_root_dev, |
| 512 | .maxlen = sizeof(int), |
| 513 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 514 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | }, |
| 516 | #endif |
Ingo Molnar | 45807a1 | 2007-07-15 23:40:10 -0700 | [diff] [blame] | 517 | { |
Ingo Molnar | 45807a1 | 2007-07-15 23:40:10 -0700 | [diff] [blame] | 518 | .procname = "print-fatal-signals", |
| 519 | .data = &print_fatal_signals, |
| 520 | .maxlen = sizeof(int), |
| 521 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 522 | .proc_handler = proc_dointvec, |
Ingo Molnar | 45807a1 | 2007-07-15 23:40:10 -0700 | [diff] [blame] | 523 | }, |
David S. Miller | 72c57ed | 2008-09-11 23:29:54 -0700 | [diff] [blame] | 524 | #ifdef CONFIG_SPARC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | .procname = "reboot-cmd", |
| 527 | .data = reboot_command, |
| 528 | .maxlen = 256, |
| 529 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 530 | .proc_handler = proc_dostring, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | }, |
| 532 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | .procname = "stop-a", |
| 534 | .data = &stop_a_enabled, |
| 535 | .maxlen = sizeof (int), |
| 536 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 537 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | }, |
| 539 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | .procname = "scons-poweroff", |
| 541 | .data = &scons_pwroff, |
| 542 | .maxlen = sizeof (int), |
| 543 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 544 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | }, |
| 546 | #endif |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 547 | #ifdef CONFIG_SPARC64 |
| 548 | { |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 549 | .procname = "tsb-ratio", |
| 550 | .data = &sysctl_tsb_ratio, |
| 551 | .maxlen = sizeof (int), |
| 552 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 553 | .proc_handler = proc_dointvec, |
David S. Miller | 0871420 | 2008-11-16 23:49:24 -0800 | [diff] [blame] | 554 | }, |
| 555 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | #ifdef __hppa__ |
| 557 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | .procname = "soft-power", |
| 559 | .data = &pwrsw_enabled, |
| 560 | .maxlen = sizeof (int), |
| 561 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 562 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | }, |
Vineet Gupta | bf14e3b | 2013-01-18 15:12:24 +0530 | [diff] [blame] | 564 | #endif |
| 565 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | .procname = "unaligned-trap", |
| 568 | .data = &unaligned_enabled, |
| 569 | .maxlen = sizeof (int), |
| 570 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 571 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | }, |
| 573 | #endif |
| 574 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | .procname = "ctrl-alt-del", |
| 576 | .data = &C_A_D, |
| 577 | .maxlen = sizeof(int), |
| 578 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 579 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | }, |
Steven Rostedt | 606576c | 2008-10-06 19:06:12 -0400 | [diff] [blame] | 581 | #ifdef CONFIG_FUNCTION_TRACER |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 582 | { |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 583 | .procname = "ftrace_enabled", |
| 584 | .data = &ftrace_enabled, |
| 585 | .maxlen = sizeof(int), |
| 586 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 587 | .proc_handler = ftrace_enable_sysctl, |
Steven Rostedt | b0fc494 | 2008-05-12 21:20:43 +0200 | [diff] [blame] | 588 | }, |
| 589 | #endif |
Steven Rostedt | f38f1d2 | 2008-12-16 23:06:40 -0500 | [diff] [blame] | 590 | #ifdef CONFIG_STACK_TRACER |
| 591 | { |
Steven Rostedt | f38f1d2 | 2008-12-16 23:06:40 -0500 | [diff] [blame] | 592 | .procname = "stack_tracer_enabled", |
| 593 | .data = &stack_tracer_enabled, |
| 594 | .maxlen = sizeof(int), |
| 595 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 596 | .proc_handler = stack_trace_sysctl, |
Steven Rostedt | f38f1d2 | 2008-12-16 23:06:40 -0500 | [diff] [blame] | 597 | }, |
| 598 | #endif |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 599 | #ifdef CONFIG_TRACING |
| 600 | { |
Peter Zijlstra | 3299b4d | 2008-11-04 11:58:21 +0100 | [diff] [blame] | 601 | .procname = "ftrace_dump_on_oops", |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 602 | .data = &ftrace_dump_on_oops, |
| 603 | .maxlen = sizeof(int), |
| 604 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 605 | .proc_handler = proc_dointvec, |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 606 | }, |
Steven Rostedt (Red Hat) | de7edd3 | 2013-06-14 16:21:43 -0400 | [diff] [blame] | 607 | { |
| 608 | .procname = "traceoff_on_warning", |
| 609 | .data = &__disable_trace_on_warning, |
| 610 | .maxlen = sizeof(__disable_trace_on_warning), |
| 611 | .mode = 0644, |
| 612 | .proc_handler = proc_dointvec, |
| 613 | }, |
Steven Rostedt | 944ac42 | 2008-10-23 19:26:08 -0400 | [diff] [blame] | 614 | #endif |
Kees Cook | 7984754 | 2014-01-23 15:55:59 -0800 | [diff] [blame] | 615 | #ifdef CONFIG_KEXEC |
| 616 | { |
| 617 | .procname = "kexec_load_disabled", |
| 618 | .data = &kexec_load_disabled, |
| 619 | .maxlen = sizeof(int), |
| 620 | .mode = 0644, |
| 621 | /* only handle a transition from default "0" to "1" */ |
| 622 | .proc_handler = proc_dointvec_minmax, |
| 623 | .extra1 = &one, |
| 624 | .extra2 = &one, |
| 625 | }, |
| 626 | #endif |
Johannes Berg | a1ef5ad | 2008-07-08 19:00:17 +0200 | [diff] [blame] | 627 | #ifdef CONFIG_MODULES |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | .procname = "modprobe", |
| 630 | .data = &modprobe_path, |
| 631 | .maxlen = KMOD_PATH_LEN, |
| 632 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 633 | .proc_handler = proc_dostring, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | }, |
Kees Cook | 3d43321 | 2009-04-02 15:49:29 -0700 | [diff] [blame] | 635 | { |
Kees Cook | 3d43321 | 2009-04-02 15:49:29 -0700 | [diff] [blame] | 636 | .procname = "modules_disabled", |
| 637 | .data = &modules_disabled, |
| 638 | .maxlen = sizeof(int), |
| 639 | .mode = 0644, |
| 640 | /* only handle a transition from default "0" to "1" */ |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 641 | .proc_handler = proc_dointvec_minmax, |
Kees Cook | 3d43321 | 2009-04-02 15:49:29 -0700 | [diff] [blame] | 642 | .extra1 = &one, |
| 643 | .extra2 = &one, |
| 644 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | #endif |
Bill Pemberton | 3b572b5 | 2012-11-19 13:19:29 -0500 | [diff] [blame] | 646 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 647 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | .procname = "hotplug", |
Kay Sievers | 312c004 | 2005-11-16 09:00:00 +0100 | [diff] [blame] | 649 | .data = &uevent_helper, |
| 650 | .maxlen = UEVENT_HELPER_PATH_LEN, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 652 | .proc_handler = proc_dostring, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 653 | }, |
Bill Pemberton | 3b572b5 | 2012-11-19 13:19:29 -0500 | [diff] [blame] | 654 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | #ifdef CONFIG_CHR_DEV_SG |
| 656 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | .procname = "sg-big-buff", |
| 658 | .data = &sg_big_buff, |
| 659 | .maxlen = sizeof (int), |
| 660 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 661 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | }, |
| 663 | #endif |
| 664 | #ifdef CONFIG_BSD_PROCESS_ACCT |
| 665 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | .procname = "acct", |
| 667 | .data = &acct_parm, |
| 668 | .maxlen = 3*sizeof(int), |
| 669 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 670 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | }, |
| 672 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 673 | #ifdef CONFIG_MAGIC_SYSRQ |
| 674 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | .procname = "sysrq", |
Ingo Molnar | 5d6f647 | 2006-12-13 00:34:36 -0800 | [diff] [blame] | 676 | .data = &__sysrq_enabled, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | .maxlen = sizeof (int), |
| 678 | .mode = 0644, |
Dmitry Torokhov | 97f5f0c | 2010-03-21 22:31:26 -0700 | [diff] [blame] | 679 | .proc_handler = sysrq_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 680 | }, |
| 681 | #endif |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 682 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | .procname = "cad_pid", |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 685 | .data = NULL, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | .maxlen = sizeof (int), |
| 687 | .mode = 0600, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 688 | .proc_handler = proc_do_cad_pid, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | }, |
Randy Dunlap | d6f8ff7 | 2006-10-19 23:28:34 -0700 | [diff] [blame] | 690 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 692 | .procname = "threads-max", |
| 693 | .data = &max_threads, |
| 694 | .maxlen = sizeof(int), |
| 695 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 696 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | }, |
| 698 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | .procname = "random", |
| 700 | .mode = 0555, |
| 701 | .child = random_table, |
| 702 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | { |
Eric Paris | 17f60a7 | 2011-04-01 17:07:50 -0400 | [diff] [blame] | 704 | .procname = "usermodehelper", |
| 705 | .mode = 0555, |
| 706 | .child = usermodehelper_table, |
| 707 | }, |
| 708 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | .procname = "overflowuid", |
| 710 | .data = &overflowuid, |
| 711 | .maxlen = sizeof(int), |
| 712 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 713 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | .extra1 = &minolduid, |
| 715 | .extra2 = &maxolduid, |
| 716 | }, |
| 717 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 718 | .procname = "overflowgid", |
| 719 | .data = &overflowgid, |
| 720 | .maxlen = sizeof(int), |
| 721 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 722 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 723 | .extra1 = &minolduid, |
| 724 | .extra2 = &maxolduid, |
| 725 | }, |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 726 | #ifdef CONFIG_S390 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | #ifdef CONFIG_MATHEMU |
| 728 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | .procname = "ieee_emulation_warnings", |
| 730 | .data = &sysctl_ieee_emulation_warnings, |
| 731 | .maxlen = sizeof(int), |
| 732 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 733 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 734 | }, |
| 735 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 737 | .procname = "userprocess_debug", |
Heiko Carstens | ab3c68e | 2010-05-17 10:00:21 +0200 | [diff] [blame] | 738 | .data = &show_unhandled_signals, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 739 | .maxlen = sizeof(int), |
| 740 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 741 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 742 | }, |
| 743 | #endif |
| 744 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 745 | .procname = "pid_max", |
| 746 | .data = &pid_max, |
| 747 | .maxlen = sizeof (int), |
| 748 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 749 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 750 | .extra1 = &pid_max_min, |
| 751 | .extra2 = &pid_max_max, |
| 752 | }, |
| 753 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 754 | .procname = "panic_on_oops", |
| 755 | .data = &panic_on_oops, |
| 756 | .maxlen = sizeof(int), |
| 757 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 758 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 759 | }, |
Joe Perches | 7ef3d2f | 2008-02-08 04:21:25 -0800 | [diff] [blame] | 760 | #if defined CONFIG_PRINTK |
| 761 | { |
Joe Perches | 7ef3d2f | 2008-02-08 04:21:25 -0800 | [diff] [blame] | 762 | .procname = "printk", |
| 763 | .data = &console_loglevel, |
| 764 | .maxlen = 4*sizeof(int), |
| 765 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 766 | .proc_handler = proc_dointvec, |
Joe Perches | 7ef3d2f | 2008-02-08 04:21:25 -0800 | [diff] [blame] | 767 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 769 | .procname = "printk_ratelimit", |
Dave Young | 717115e | 2008-07-25 01:45:58 -0700 | [diff] [blame] | 770 | .data = &printk_ratelimit_state.interval, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | .maxlen = sizeof(int), |
| 772 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 773 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 774 | }, |
| 775 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 776 | .procname = "printk_ratelimit_burst", |
Dave Young | 717115e | 2008-07-25 01:45:58 -0700 | [diff] [blame] | 777 | .data = &printk_ratelimit_state.burst, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 778 | .maxlen = sizeof(int), |
| 779 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 780 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 781 | }, |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 782 | { |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 783 | .procname = "printk_delay", |
| 784 | .data = &printk_delay_msec, |
| 785 | .maxlen = sizeof(int), |
| 786 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 787 | .proc_handler = proc_dointvec_minmax, |
Dave Young | af91322 | 2009-09-22 16:43:33 -0700 | [diff] [blame] | 788 | .extra1 = &zero, |
| 789 | .extra2 = &ten_thousand, |
| 790 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 791 | { |
Dan Rosenberg | eaf06b2 | 2010-11-11 14:05:18 -0800 | [diff] [blame] | 792 | .procname = "dmesg_restrict", |
| 793 | .data = &dmesg_restrict, |
| 794 | .maxlen = sizeof(int), |
| 795 | .mode = 0644, |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 796 | .proc_handler = proc_dointvec_minmax_sysadmin, |
Dan Rosenberg | eaf06b2 | 2010-11-11 14:05:18 -0800 | [diff] [blame] | 797 | .extra1 = &zero, |
| 798 | .extra2 = &one, |
| 799 | }, |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 800 | { |
| 801 | .procname = "kptr_restrict", |
| 802 | .data = &kptr_restrict, |
| 803 | .maxlen = sizeof(int), |
| 804 | .mode = 0644, |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 805 | .proc_handler = proc_dointvec_minmax_sysadmin, |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 806 | .extra1 = &zero, |
| 807 | .extra2 = &two, |
| 808 | }, |
Joe Perches | df6e61d | 2010-11-15 21:17:27 -0800 | [diff] [blame] | 809 | #endif |
Dan Rosenberg | eaf06b2 | 2010-11-11 14:05:18 -0800 | [diff] [blame] | 810 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 811 | .procname = "ngroups_max", |
| 812 | .data = &ngroups_max, |
| 813 | .maxlen = sizeof (int), |
| 814 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 815 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 816 | }, |
Dan Ballard | 73efc03 | 2011-10-31 17:11:20 -0700 | [diff] [blame] | 817 | { |
| 818 | .procname = "cap_last_cap", |
| 819 | .data = (void *)&cap_last_cap, |
| 820 | .maxlen = sizeof(int), |
| 821 | .mode = 0444, |
| 822 | .proc_handler = proc_dointvec, |
| 823 | }, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 824 | #if defined(CONFIG_LOCKUP_DETECTOR) |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 825 | { |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 826 | .procname = "watchdog", |
Frederic Weisbecker | 3c00ea8 | 2013-05-19 20:45:15 +0200 | [diff] [blame] | 827 | .data = &watchdog_user_enabled, |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 828 | .maxlen = sizeof (int), |
| 829 | .mode = 0644, |
Mandeep Singh Baines | 586692a | 2011-05-22 22:10:22 -0700 | [diff] [blame] | 830 | .proc_handler = proc_dowatchdog, |
| 831 | .extra1 = &zero, |
| 832 | .extra2 = &one, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 833 | }, |
| 834 | { |
| 835 | .procname = "watchdog_thresh", |
Mandeep Singh Baines | 586692a | 2011-05-22 22:10:22 -0700 | [diff] [blame] | 836 | .data = &watchdog_thresh, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 837 | .maxlen = sizeof(int), |
| 838 | .mode = 0644, |
Mandeep Singh Baines | 586692a | 2011-05-22 22:10:22 -0700 | [diff] [blame] | 839 | .proc_handler = proc_dowatchdog, |
Li Zefan | a6572f8 | 2013-05-17 10:31:04 +0800 | [diff] [blame] | 840 | .extra1 = &zero, |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 841 | .extra2 = &sixty, |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 842 | }, |
Don Zickus | 2508ce1 | 2010-05-07 17:11:46 -0400 | [diff] [blame] | 843 | { |
| 844 | .procname = "softlockup_panic", |
| 845 | .data = &softlockup_panic, |
| 846 | .maxlen = sizeof(int), |
| 847 | .mode = 0644, |
| 848 | .proc_handler = proc_dointvec_minmax, |
| 849 | .extra1 = &zero, |
| 850 | .extra2 = &one, |
| 851 | }, |
Don Zickus | 5dc3055 | 2010-11-29 17:07:17 -0500 | [diff] [blame] | 852 | { |
| 853 | .procname = "nmi_watchdog", |
Frederic Weisbecker | 3c00ea8 | 2013-05-19 20:45:15 +0200 | [diff] [blame] | 854 | .data = &watchdog_user_enabled, |
Don Zickus | 5dc3055 | 2010-11-29 17:07:17 -0500 | [diff] [blame] | 855 | .maxlen = sizeof (int), |
| 856 | .mode = 0644, |
Mandeep Singh Baines | 586692a | 2011-05-22 22:10:22 -0700 | [diff] [blame] | 857 | .proc_handler = proc_dowatchdog, |
| 858 | .extra1 = &zero, |
| 859 | .extra2 = &one, |
Don Zickus | 5dc3055 | 2010-11-29 17:07:17 -0500 | [diff] [blame] | 860 | }, |
| 861 | #endif |
| 862 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) |
| 863 | { |
| 864 | .procname = "unknown_nmi_panic", |
| 865 | .data = &unknown_nmi_panic, |
| 866 | .maxlen = sizeof (int), |
| 867 | .mode = 0644, |
| 868 | .proc_handler = proc_dointvec, |
| 869 | }, |
Don Zickus | 504d7cf | 2010-02-12 17:19:19 -0500 | [diff] [blame] | 870 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 871 | #if defined(CONFIG_X86) |
| 872 | { |
Don Zickus | 8da5add | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 873 | .procname = "panic_on_unrecovered_nmi", |
| 874 | .data = &panic_on_unrecovered_nmi, |
| 875 | .maxlen = sizeof(int), |
| 876 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 877 | .proc_handler = proc_dointvec, |
Don Zickus | 8da5add | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 878 | }, |
| 879 | { |
Kurt Garloff | 5211a24 | 2009-06-24 14:32:11 -0700 | [diff] [blame] | 880 | .procname = "panic_on_io_nmi", |
| 881 | .data = &panic_on_io_nmi, |
| 882 | .maxlen = sizeof(int), |
| 883 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 884 | .proc_handler = proc_dointvec, |
Kurt Garloff | 5211a24 | 2009-06-24 14:32:11 -0700 | [diff] [blame] | 885 | }, |
Mitsuo Hayasaka | 55af779 | 2011-11-29 15:08:36 +0900 | [diff] [blame] | 886 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 887 | { |
| 888 | .procname = "panic_on_stackoverflow", |
| 889 | .data = &sysctl_panic_on_stackoverflow, |
| 890 | .maxlen = sizeof(int), |
| 891 | .mode = 0644, |
| 892 | .proc_handler = proc_dointvec, |
| 893 | }, |
| 894 | #endif |
Kurt Garloff | 5211a24 | 2009-06-24 14:32:11 -0700 | [diff] [blame] | 895 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | .procname = "bootloader_type", |
| 897 | .data = &bootloader_type, |
| 898 | .maxlen = sizeof (int), |
| 899 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 900 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 901 | }, |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 902 | { |
H. Peter Anvin | 5031296 | 2009-05-07 16:54:11 -0700 | [diff] [blame] | 903 | .procname = "bootloader_version", |
| 904 | .data = &bootloader_version, |
| 905 | .maxlen = sizeof (int), |
| 906 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 907 | .proc_handler = proc_dointvec, |
H. Peter Anvin | 5031296 | 2009-05-07 16:54:11 -0700 | [diff] [blame] | 908 | }, |
| 909 | { |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 910 | .procname = "kstack_depth_to_print", |
| 911 | .data = &kstack_depth_to_print, |
| 912 | .maxlen = sizeof(int), |
| 913 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 914 | .proc_handler = proc_dointvec, |
Chuck Ebbert | 0741f4d | 2006-12-07 02:14:11 +0100 | [diff] [blame] | 915 | }, |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 916 | { |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 917 | .procname = "io_delay_type", |
| 918 | .data = &io_delay_type, |
| 919 | .maxlen = sizeof(int), |
| 920 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 921 | .proc_handler = proc_dointvec, |
Ingo Molnar | 6e7c402 | 2008-01-30 13:30:05 +0100 | [diff] [blame] | 922 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 923 | #endif |
Luke Yang | 7a9166e | 2006-02-20 18:28:07 -0800 | [diff] [blame] | 924 | #if defined(CONFIG_MMU) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 925 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 926 | .procname = "randomize_va_space", |
| 927 | .data = &randomize_va_space, |
| 928 | .maxlen = sizeof(int), |
| 929 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 930 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 931 | }, |
Luke Yang | 7a9166e | 2006-02-20 18:28:07 -0800 | [diff] [blame] | 932 | #endif |
Martin Schwidefsky | 0152fb3 | 2006-01-14 13:21:00 -0800 | [diff] [blame] | 933 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) |
Martin Schwidefsky | 951f22d | 2005-07-27 11:44:57 -0700 | [diff] [blame] | 934 | { |
Martin Schwidefsky | 951f22d | 2005-07-27 11:44:57 -0700 | [diff] [blame] | 935 | .procname = "spin_retry", |
| 936 | .data = &spin_retry, |
| 937 | .maxlen = sizeof (int), |
| 938 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 939 | .proc_handler = proc_dointvec, |
Martin Schwidefsky | 951f22d | 2005-07-27 11:44:57 -0700 | [diff] [blame] | 940 | }, |
| 941 | #endif |
Len Brown | 673d5b4 | 2007-07-28 03:33:16 -0400 | [diff] [blame] | 942 | #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 943 | { |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 944 | .procname = "acpi_video_flags", |
Pavel Machek | 77afcf7 | 2007-07-19 01:47:41 -0700 | [diff] [blame] | 945 | .data = &acpi_realmode_flags, |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 946 | .maxlen = sizeof (unsigned long), |
| 947 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 948 | .proc_handler = proc_doulongvec_minmax, |
Pavel Machek | c255d84 | 2006-02-20 18:27:58 -0800 | [diff] [blame] | 949 | }, |
| 950 | #endif |
Vineet Gupta | b6fca72 | 2013-01-09 20:06:28 +0530 | [diff] [blame] | 951 | #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 952 | { |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 953 | .procname = "ignore-unaligned-usertrap", |
| 954 | .data = &no_unaligned_warning, |
| 955 | .maxlen = sizeof (int), |
| 956 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 957 | .proc_handler = proc_dointvec, |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 958 | }, |
Vineet Gupta | b6fca72 | 2013-01-09 20:06:28 +0530 | [diff] [blame] | 959 | #endif |
| 960 | #ifdef CONFIG_IA64 |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 961 | { |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 962 | .procname = "unaligned-dump-stack", |
| 963 | .data = &unaligned_dump_stack, |
| 964 | .maxlen = sizeof (int), |
| 965 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 966 | .proc_handler = proc_dointvec, |
Doug Chapman | 88fc241 | 2009-01-15 10:38:56 -0800 | [diff] [blame] | 967 | }, |
Jes Sorensen | d2b176e | 2006-02-28 09:42:23 -0800 | [diff] [blame] | 968 | #endif |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 969 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 970 | { |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 971 | .procname = "hung_task_panic", |
| 972 | .data = &sysctl_hung_task_panic, |
| 973 | .maxlen = sizeof(int), |
| 974 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 975 | .proc_handler = proc_dointvec_minmax, |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 976 | .extra1 = &zero, |
| 977 | .extra2 = &one, |
| 978 | }, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 979 | { |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 980 | .procname = "hung_task_check_count", |
| 981 | .data = &sysctl_hung_task_check_count, |
Li Zefan | cd64647 | 2013-09-23 16:43:58 +0800 | [diff] [blame] | 982 | .maxlen = sizeof(int), |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 983 | .mode = 0644, |
Li Zefan | cd64647 | 2013-09-23 16:43:58 +0800 | [diff] [blame] | 984 | .proc_handler = proc_dointvec_minmax, |
| 985 | .extra1 = &zero, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 986 | }, |
| 987 | { |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 988 | .procname = "hung_task_timeout_secs", |
| 989 | .data = &sysctl_hung_task_timeout_secs, |
Ingo Molnar | 9073908 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 990 | .maxlen = sizeof(unsigned long), |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 991 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 992 | .proc_handler = proc_dohung_task_timeout_secs, |
Liu Hua | 80df284 | 2014-04-07 15:38:57 -0700 | [diff] [blame] | 993 | .extra2 = &hung_task_timeout_max, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 994 | }, |
| 995 | { |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 996 | .procname = "hung_task_warnings", |
| 997 | .data = &sysctl_hung_task_warnings, |
Aaron Tomlin | 270750db | 2014-01-20 17:34:13 +0000 | [diff] [blame] | 998 | .maxlen = sizeof(int), |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 999 | .mode = 0644, |
Aaron Tomlin | 270750db | 2014-01-20 17:34:13 +0000 | [diff] [blame] | 1000 | .proc_handler = proc_dointvec_minmax, |
| 1001 | .extra1 = &neg_one, |
Ingo Molnar | 82a1fcb | 2008-01-25 21:08:02 +0100 | [diff] [blame] | 1002 | }, |
Ravikiran G Thirumalai | c4f3b63 | 2007-10-16 23:26:09 -0700 | [diff] [blame] | 1003 | #endif |
Andi Kleen | bebfa10 | 2006-06-26 13:56:52 +0200 | [diff] [blame] | 1004 | #ifdef CONFIG_COMPAT |
| 1005 | { |
Andi Kleen | bebfa10 | 2006-06-26 13:56:52 +0200 | [diff] [blame] | 1006 | .procname = "compat-log", |
| 1007 | .data = &compat_log, |
| 1008 | .maxlen = sizeof (int), |
| 1009 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1010 | .proc_handler = proc_dointvec, |
Andi Kleen | bebfa10 | 2006-06-26 13:56:52 +0200 | [diff] [blame] | 1011 | }, |
| 1012 | #endif |
Ingo Molnar | 23f78d4a | 2006-06-27 02:54:53 -0700 | [diff] [blame] | 1013 | #ifdef CONFIG_RT_MUTEXES |
| 1014 | { |
Ingo Molnar | 23f78d4a | 2006-06-27 02:54:53 -0700 | [diff] [blame] | 1015 | .procname = "max_lock_depth", |
| 1016 | .data = &max_lock_depth, |
| 1017 | .maxlen = sizeof(int), |
| 1018 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1019 | .proc_handler = proc_dointvec, |
Ingo Molnar | 23f78d4a | 2006-06-27 02:54:53 -0700 | [diff] [blame] | 1020 | }, |
| 1021 | #endif |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 1022 | { |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 1023 | .procname = "poweroff_cmd", |
| 1024 | .data = &poweroff_cmd, |
| 1025 | .maxlen = POWEROFF_CMD_PATH_LEN, |
| 1026 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1027 | .proc_handler = proc_dostring, |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 1028 | }, |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 1029 | #ifdef CONFIG_KEYS |
| 1030 | { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 1031 | .procname = "keys", |
| 1032 | .mode = 0555, |
| 1033 | .child = key_sysctls, |
| 1034 | }, |
| 1035 | #endif |
Paul E. McKenney | 31a72bc | 2008-06-18 09:26:49 -0700 | [diff] [blame] | 1036 | #ifdef CONFIG_RCU_TORTURE_TEST |
| 1037 | { |
Paul E. McKenney | 31a72bc | 2008-06-18 09:26:49 -0700 | [diff] [blame] | 1038 | .procname = "rcutorture_runnable", |
| 1039 | .data = &rcutorture_runnable, |
| 1040 | .maxlen = sizeof(int), |
| 1041 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1042 | .proc_handler = proc_dointvec, |
Paul E. McKenney | 31a72bc | 2008-06-18 09:26:49 -0700 | [diff] [blame] | 1043 | }, |
| 1044 | #endif |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1045 | #ifdef CONFIG_PERF_EVENTS |
Vince Weaver | aa4a221 | 2011-06-03 17:54:40 -0400 | [diff] [blame] | 1046 | /* |
| 1047 | * User-space scripts rely on the existence of this file |
| 1048 | * as a feature check for perf_events being enabled. |
| 1049 | * |
| 1050 | * So it's an ABI, do not remove! |
| 1051 | */ |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1052 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1053 | .procname = "perf_event_paranoid", |
| 1054 | .data = &sysctl_perf_event_paranoid, |
| 1055 | .maxlen = sizeof(sysctl_perf_event_paranoid), |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1056 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1057 | .proc_handler = proc_dointvec, |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1058 | }, |
Peter Zijlstra | c5078f7 | 2009-05-05 17:50:24 +0200 | [diff] [blame] | 1059 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1060 | .procname = "perf_event_mlock_kb", |
| 1061 | .data = &sysctl_perf_event_mlock, |
| 1062 | .maxlen = sizeof(sysctl_perf_event_mlock), |
Peter Zijlstra | c5078f7 | 2009-05-05 17:50:24 +0200 | [diff] [blame] | 1063 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1064 | .proc_handler = proc_dointvec, |
Peter Zijlstra | c5078f7 | 2009-05-05 17:50:24 +0200 | [diff] [blame] | 1065 | }, |
Peter Zijlstra | a78ac32 | 2009-05-25 17:39:05 +0200 | [diff] [blame] | 1066 | { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1067 | .procname = "perf_event_max_sample_rate", |
| 1068 | .data = &sysctl_perf_event_sample_rate, |
| 1069 | .maxlen = sizeof(sysctl_perf_event_sample_rate), |
Peter Zijlstra | a78ac32 | 2009-05-25 17:39:05 +0200 | [diff] [blame] | 1070 | .mode = 0644, |
Peter Zijlstra | 163ec43 | 2011-02-16 11:22:34 +0100 | [diff] [blame] | 1071 | .proc_handler = perf_proc_update_handler, |
Knut Petersen | 723478c | 2013-09-25 14:29:37 +0200 | [diff] [blame] | 1072 | .extra1 = &one, |
Peter Zijlstra | a78ac32 | 2009-05-25 17:39:05 +0200 | [diff] [blame] | 1073 | }, |
Dave Hansen | 14c63f1 | 2013-06-21 08:51:36 -0700 | [diff] [blame] | 1074 | { |
| 1075 | .procname = "perf_cpu_time_max_percent", |
| 1076 | .data = &sysctl_perf_cpu_time_max_percent, |
| 1077 | .maxlen = sizeof(sysctl_perf_cpu_time_max_percent), |
| 1078 | .mode = 0644, |
| 1079 | .proc_handler = perf_cpu_time_max_percent_handler, |
| 1080 | .extra1 = &zero, |
| 1081 | .extra2 = &one_hundred, |
| 1082 | }, |
Peter Zijlstra | 1ccd154 | 2009-04-09 10:53:45 +0200 | [diff] [blame] | 1083 | #endif |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1084 | #ifdef CONFIG_KMEMCHECK |
| 1085 | { |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1086 | .procname = "kmemcheck", |
| 1087 | .data = &kmemcheck_enabled, |
| 1088 | .maxlen = sizeof(int), |
| 1089 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1090 | .proc_handler = proc_dointvec, |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1091 | }, |
| 1092 | #endif |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1093 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1094 | }; |
| 1095 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1096 | static struct ctl_table vm_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1097 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | .procname = "overcommit_memory", |
| 1099 | .data = &sysctl_overcommit_memory, |
| 1100 | .maxlen = sizeof(sysctl_overcommit_memory), |
| 1101 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1102 | .proc_handler = proc_dointvec_minmax, |
| 1103 | .extra1 = &zero, |
| 1104 | .extra2 = &two, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1105 | }, |
| 1106 | { |
KAMEZAWA Hiroyuki | fadd8fb | 2006-06-23 02:03:13 -0700 | [diff] [blame] | 1107 | .procname = "panic_on_oom", |
| 1108 | .data = &sysctl_panic_on_oom, |
| 1109 | .maxlen = sizeof(sysctl_panic_on_oom), |
| 1110 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1111 | .proc_handler = proc_dointvec_minmax, |
| 1112 | .extra1 = &zero, |
| 1113 | .extra2 = &two, |
KAMEZAWA Hiroyuki | fadd8fb | 2006-06-23 02:03:13 -0700 | [diff] [blame] | 1114 | }, |
| 1115 | { |
David Rientjes | fe071d7 | 2007-10-16 23:25:56 -0700 | [diff] [blame] | 1116 | .procname = "oom_kill_allocating_task", |
| 1117 | .data = &sysctl_oom_kill_allocating_task, |
| 1118 | .maxlen = sizeof(sysctl_oom_kill_allocating_task), |
| 1119 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1120 | .proc_handler = proc_dointvec, |
David Rientjes | fe071d7 | 2007-10-16 23:25:56 -0700 | [diff] [blame] | 1121 | }, |
| 1122 | { |
David Rientjes | fef1bdd | 2008-02-07 00:14:07 -0800 | [diff] [blame] | 1123 | .procname = "oom_dump_tasks", |
| 1124 | .data = &sysctl_oom_dump_tasks, |
| 1125 | .maxlen = sizeof(sysctl_oom_dump_tasks), |
| 1126 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1127 | .proc_handler = proc_dointvec, |
David Rientjes | fef1bdd | 2008-02-07 00:14:07 -0800 | [diff] [blame] | 1128 | }, |
| 1129 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1130 | .procname = "overcommit_ratio", |
| 1131 | .data = &sysctl_overcommit_ratio, |
| 1132 | .maxlen = sizeof(sysctl_overcommit_ratio), |
| 1133 | .mode = 0644, |
Jerome Marchand | 49f0ce5 | 2014-01-21 15:49:14 -0800 | [diff] [blame] | 1134 | .proc_handler = overcommit_ratio_handler, |
| 1135 | }, |
| 1136 | { |
| 1137 | .procname = "overcommit_kbytes", |
| 1138 | .data = &sysctl_overcommit_kbytes, |
| 1139 | .maxlen = sizeof(sysctl_overcommit_kbytes), |
| 1140 | .mode = 0644, |
| 1141 | .proc_handler = overcommit_kbytes_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1142 | }, |
| 1143 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1144 | .procname = "page-cluster", |
| 1145 | .data = &page_cluster, |
| 1146 | .maxlen = sizeof(int), |
| 1147 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1148 | .proc_handler = proc_dointvec_minmax, |
| 1149 | .extra1 = &zero, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1150 | }, |
| 1151 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1152 | .procname = "dirty_background_ratio", |
| 1153 | .data = &dirty_background_ratio, |
| 1154 | .maxlen = sizeof(dirty_background_ratio), |
| 1155 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1156 | .proc_handler = dirty_background_ratio_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1157 | .extra1 = &zero, |
| 1158 | .extra2 = &one_hundred, |
| 1159 | }, |
| 1160 | { |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1161 | .procname = "dirty_background_bytes", |
| 1162 | .data = &dirty_background_bytes, |
| 1163 | .maxlen = sizeof(dirty_background_bytes), |
| 1164 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1165 | .proc_handler = dirty_background_bytes_handler, |
Sven Wegener | fc3501d | 2009-02-11 13:04:23 -0800 | [diff] [blame] | 1166 | .extra1 = &one_ul, |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1167 | }, |
| 1168 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1169 | .procname = "dirty_ratio", |
| 1170 | .data = &vm_dirty_ratio, |
| 1171 | .maxlen = sizeof(vm_dirty_ratio), |
| 1172 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1173 | .proc_handler = dirty_ratio_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1174 | .extra1 = &zero, |
| 1175 | .extra2 = &one_hundred, |
| 1176 | }, |
| 1177 | { |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1178 | .procname = "dirty_bytes", |
| 1179 | .data = &vm_dirty_bytes, |
| 1180 | .maxlen = sizeof(vm_dirty_bytes), |
| 1181 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1182 | .proc_handler = dirty_bytes_handler, |
Andrea Righi | 9e4a5bd | 2009-04-30 15:08:57 -0700 | [diff] [blame] | 1183 | .extra1 = &dirty_bytes_min, |
David Rientjes | 2da0299 | 2009-01-06 14:39:31 -0800 | [diff] [blame] | 1184 | }, |
| 1185 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1186 | .procname = "dirty_writeback_centisecs", |
Bart Samwel | f6ef943 | 2006-03-24 03:15:48 -0800 | [diff] [blame] | 1187 | .data = &dirty_writeback_interval, |
| 1188 | .maxlen = sizeof(dirty_writeback_interval), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1189 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1190 | .proc_handler = dirty_writeback_centisecs_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1191 | }, |
| 1192 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1193 | .procname = "dirty_expire_centisecs", |
Bart Samwel | f6ef943 | 2006-03-24 03:15:48 -0800 | [diff] [blame] | 1194 | .data = &dirty_expire_interval, |
| 1195 | .maxlen = sizeof(dirty_expire_interval), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1196 | .mode = 0644, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1197 | .proc_handler = proc_dointvec_minmax, |
| 1198 | .extra1 = &zero, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1199 | }, |
| 1200 | { |
Wanpeng Li | 3965c9a | 2012-07-31 16:41:52 -0700 | [diff] [blame] | 1201 | .procname = "nr_pdflush_threads", |
| 1202 | .mode = 0444 /* read-only */, |
| 1203 | .proc_handler = pdflush_proc_obsolete, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1204 | }, |
| 1205 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1206 | .procname = "swappiness", |
| 1207 | .data = &vm_swappiness, |
| 1208 | .maxlen = sizeof(vm_swappiness), |
| 1209 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1210 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1211 | .extra1 = &zero, |
| 1212 | .extra2 = &one_hundred, |
| 1213 | }, |
| 1214 | #ifdef CONFIG_HUGETLB_PAGE |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 1215 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1216 | .procname = "nr_hugepages", |
Andi Kleen | e5ff215 | 2008-07-23 21:27:42 -0700 | [diff] [blame] | 1217 | .data = NULL, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1218 | .maxlen = sizeof(unsigned long), |
| 1219 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1220 | .proc_handler = hugetlb_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1221 | .extra1 = (void *)&hugetlb_zero, |
| 1222 | .extra2 = (void *)&hugetlb_infinity, |
Lee Schermerhorn | 06808b0 | 2009-12-14 17:58:21 -0800 | [diff] [blame] | 1223 | }, |
| 1224 | #ifdef CONFIG_NUMA |
| 1225 | { |
| 1226 | .procname = "nr_hugepages_mempolicy", |
| 1227 | .data = NULL, |
| 1228 | .maxlen = sizeof(unsigned long), |
| 1229 | .mode = 0644, |
| 1230 | .proc_handler = &hugetlb_mempolicy_sysctl_handler, |
| 1231 | .extra1 = (void *)&hugetlb_zero, |
| 1232 | .extra2 = (void *)&hugetlb_infinity, |
| 1233 | }, |
| 1234 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1235 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1236 | .procname = "hugetlb_shm_group", |
| 1237 | .data = &sysctl_hugetlb_shm_group, |
| 1238 | .maxlen = sizeof(gid_t), |
| 1239 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1240 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1241 | }, |
Mel Gorman | 396faf0 | 2007-07-17 04:03:13 -0700 | [diff] [blame] | 1242 | { |
Mel Gorman | 396faf0 | 2007-07-17 04:03:13 -0700 | [diff] [blame] | 1243 | .procname = "hugepages_treat_as_movable", |
| 1244 | .data = &hugepages_treat_as_movable, |
| 1245 | .maxlen = sizeof(int), |
| 1246 | .mode = 0644, |
Naoya Horiguchi | 86cdb46 | 2013-09-11 14:22:13 -0700 | [diff] [blame] | 1247 | .proc_handler = proc_dointvec, |
Mel Gorman | 396faf0 | 2007-07-17 04:03:13 -0700 | [diff] [blame] | 1248 | }, |
Adam Litke | 54f9f80 | 2007-10-16 01:26:20 -0700 | [diff] [blame] | 1249 | { |
Nishanth Aravamudan | d1c3fb1 | 2007-12-17 16:20:12 -0800 | [diff] [blame] | 1250 | .procname = "nr_overcommit_hugepages", |
Andi Kleen | e5ff215 | 2008-07-23 21:27:42 -0700 | [diff] [blame] | 1251 | .data = NULL, |
| 1252 | .maxlen = sizeof(unsigned long), |
Nishanth Aravamudan | d1c3fb1 | 2007-12-17 16:20:12 -0800 | [diff] [blame] | 1253 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1254 | .proc_handler = hugetlb_overcommit_handler, |
Andi Kleen | e5ff215 | 2008-07-23 21:27:42 -0700 | [diff] [blame] | 1255 | .extra1 = (void *)&hugetlb_zero, |
| 1256 | .extra2 = (void *)&hugetlb_infinity, |
Nishanth Aravamudan | d1c3fb1 | 2007-12-17 16:20:12 -0800 | [diff] [blame] | 1257 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1258 | #endif |
| 1259 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1260 | .procname = "lowmem_reserve_ratio", |
| 1261 | .data = &sysctl_lowmem_reserve_ratio, |
| 1262 | .maxlen = sizeof(sysctl_lowmem_reserve_ratio), |
| 1263 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1264 | .proc_handler = lowmem_reserve_ratio_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1265 | }, |
| 1266 | { |
Andrew Morton | 9d0243b | 2006-01-08 01:00:39 -0800 | [diff] [blame] | 1267 | .procname = "drop_caches", |
| 1268 | .data = &sysctl_drop_caches, |
| 1269 | .maxlen = sizeof(int), |
| 1270 | .mode = 0644, |
| 1271 | .proc_handler = drop_caches_sysctl_handler, |
Petr Holasek | cb16e95 | 2011-03-23 16:43:09 -0700 | [diff] [blame] | 1272 | .extra1 = &one, |
Dave Hansen | 5509a5d | 2014-04-03 14:48:19 -0700 | [diff] [blame] | 1273 | .extra2 = &four, |
Andrew Morton | 9d0243b | 2006-01-08 01:00:39 -0800 | [diff] [blame] | 1274 | }, |
Mel Gorman | 76ab0f5 | 2010-05-24 14:32:28 -0700 | [diff] [blame] | 1275 | #ifdef CONFIG_COMPACTION |
| 1276 | { |
| 1277 | .procname = "compact_memory", |
| 1278 | .data = &sysctl_compact_memory, |
| 1279 | .maxlen = sizeof(int), |
| 1280 | .mode = 0200, |
| 1281 | .proc_handler = sysctl_compaction_handler, |
| 1282 | }, |
Mel Gorman | 5e77190 | 2010-05-24 14:32:31 -0700 | [diff] [blame] | 1283 | { |
| 1284 | .procname = "extfrag_threshold", |
| 1285 | .data = &sysctl_extfrag_threshold, |
| 1286 | .maxlen = sizeof(int), |
| 1287 | .mode = 0644, |
| 1288 | .proc_handler = sysctl_extfrag_handler, |
| 1289 | .extra1 = &min_extfrag_threshold, |
| 1290 | .extra2 = &max_extfrag_threshold, |
| 1291 | }, |
| 1292 | |
Mel Gorman | 76ab0f5 | 2010-05-24 14:32:28 -0700 | [diff] [blame] | 1293 | #endif /* CONFIG_COMPACTION */ |
Andrew Morton | 9d0243b | 2006-01-08 01:00:39 -0800 | [diff] [blame] | 1294 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1295 | .procname = "min_free_kbytes", |
| 1296 | .data = &min_free_kbytes, |
| 1297 | .maxlen = sizeof(min_free_kbytes), |
| 1298 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1299 | .proc_handler = min_free_kbytes_sysctl_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1300 | .extra1 = &zero, |
| 1301 | }, |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 1302 | { |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 1303 | .procname = "percpu_pagelist_fraction", |
| 1304 | .data = &percpu_pagelist_fraction, |
| 1305 | .maxlen = sizeof(percpu_pagelist_fraction), |
| 1306 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1307 | .proc_handler = percpu_pagelist_fraction_sysctl_handler, |
Rohit Seth | 8ad4b1f | 2006-01-08 01:00:40 -0800 | [diff] [blame] | 1308 | .extra1 = &min_percpu_pagelist_fract, |
| 1309 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1310 | #ifdef CONFIG_MMU |
| 1311 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1312 | .procname = "max_map_count", |
| 1313 | .data = &sysctl_max_map_count, |
| 1314 | .maxlen = sizeof(sysctl_max_map_count), |
| 1315 | .mode = 0644, |
WANG Cong | 3e26120 | 2009-12-17 15:27:05 -0800 | [diff] [blame] | 1316 | .proc_handler = proc_dointvec_minmax, |
Amerigo Wang | 70da234 | 2009-12-14 17:59:52 -0800 | [diff] [blame] | 1317 | .extra1 = &zero, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1318 | }, |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 1319 | #else |
| 1320 | { |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 1321 | .procname = "nr_trim_pages", |
| 1322 | .data = &sysctl_nr_trim_pages, |
| 1323 | .maxlen = sizeof(sysctl_nr_trim_pages), |
| 1324 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1325 | .proc_handler = proc_dointvec_minmax, |
Paul Mundt | dd8632a | 2009-01-08 12:04:47 +0000 | [diff] [blame] | 1326 | .extra1 = &zero, |
| 1327 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1328 | #endif |
| 1329 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1330 | .procname = "laptop_mode", |
| 1331 | .data = &laptop_mode, |
| 1332 | .maxlen = sizeof(laptop_mode), |
| 1333 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1334 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1335 | }, |
| 1336 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1337 | .procname = "block_dump", |
| 1338 | .data = &block_dump, |
| 1339 | .maxlen = sizeof(block_dump), |
| 1340 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1341 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1342 | .extra1 = &zero, |
| 1343 | }, |
| 1344 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1345 | .procname = "vfs_cache_pressure", |
| 1346 | .data = &sysctl_vfs_cache_pressure, |
| 1347 | .maxlen = sizeof(sysctl_vfs_cache_pressure), |
| 1348 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1349 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1350 | .extra1 = &zero, |
| 1351 | }, |
| 1352 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
| 1353 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1354 | .procname = "legacy_va_layout", |
| 1355 | .data = &sysctl_legacy_va_layout, |
| 1356 | .maxlen = sizeof(sysctl_legacy_va_layout), |
| 1357 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1358 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1359 | .extra1 = &zero, |
| 1360 | }, |
| 1361 | #endif |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1362 | #ifdef CONFIG_NUMA |
| 1363 | { |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1364 | .procname = "zone_reclaim_mode", |
| 1365 | .data = &zone_reclaim_mode, |
| 1366 | .maxlen = sizeof(zone_reclaim_mode), |
| 1367 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1368 | .proc_handler = proc_dointvec, |
Christoph Lameter | c84db23 | 2006-02-01 03:05:29 -0800 | [diff] [blame] | 1369 | .extra1 = &zero, |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1370 | }, |
Christoph Lameter | 9614634 | 2006-07-03 00:24:13 -0700 | [diff] [blame] | 1371 | { |
Christoph Lameter | 9614634 | 2006-07-03 00:24:13 -0700 | [diff] [blame] | 1372 | .procname = "min_unmapped_ratio", |
| 1373 | .data = &sysctl_min_unmapped_ratio, |
| 1374 | .maxlen = sizeof(sysctl_min_unmapped_ratio), |
| 1375 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1376 | .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, |
Christoph Lameter | 9614634 | 2006-07-03 00:24:13 -0700 | [diff] [blame] | 1377 | .extra1 = &zero, |
| 1378 | .extra2 = &one_hundred, |
| 1379 | }, |
Christoph Lameter | 0ff3849 | 2006-09-25 23:31:52 -0700 | [diff] [blame] | 1380 | { |
Christoph Lameter | 0ff3849 | 2006-09-25 23:31:52 -0700 | [diff] [blame] | 1381 | .procname = "min_slab_ratio", |
| 1382 | .data = &sysctl_min_slab_ratio, |
| 1383 | .maxlen = sizeof(sysctl_min_slab_ratio), |
| 1384 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1385 | .proc_handler = sysctl_min_slab_ratio_sysctl_handler, |
Christoph Lameter | 0ff3849 | 2006-09-25 23:31:52 -0700 | [diff] [blame] | 1386 | .extra1 = &zero, |
| 1387 | .extra2 = &one_hundred, |
| 1388 | }, |
Christoph Lameter | 1743660 | 2006-01-18 17:42:32 -0800 | [diff] [blame] | 1389 | #endif |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1390 | #ifdef CONFIG_SMP |
| 1391 | { |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1392 | .procname = "stat_interval", |
| 1393 | .data = &sysctl_stat_interval, |
| 1394 | .maxlen = sizeof(sysctl_stat_interval), |
| 1395 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1396 | .proc_handler = proc_dointvec_jiffies, |
Christoph Lameter | 77461ab | 2007-05-09 02:35:13 -0700 | [diff] [blame] | 1397 | }, |
| 1398 | #endif |
David Howells | 6e14154 | 2009-12-15 19:27:45 +0000 | [diff] [blame] | 1399 | #ifdef CONFIG_MMU |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1400 | { |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1401 | .procname = "mmap_min_addr", |
Eric Paris | 788084a | 2009-07-31 12:54:11 -0400 | [diff] [blame] | 1402 | .data = &dac_mmap_min_addr, |
| 1403 | .maxlen = sizeof(unsigned long), |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1404 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1405 | .proc_handler = mmap_min_addr_handler, |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1406 | }, |
David Howells | 6e14154 | 2009-12-15 19:27:45 +0000 | [diff] [blame] | 1407 | #endif |
KAMEZAWA Hiroyuki | f0c0b2b | 2007-07-15 23:38:01 -0700 | [diff] [blame] | 1408 | #ifdef CONFIG_NUMA |
| 1409 | { |
KAMEZAWA Hiroyuki | f0c0b2b | 2007-07-15 23:38:01 -0700 | [diff] [blame] | 1410 | .procname = "numa_zonelist_order", |
| 1411 | .data = &numa_zonelist_order, |
| 1412 | .maxlen = NUMA_ZONELIST_ORDER_LEN, |
| 1413 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1414 | .proc_handler = numa_zonelist_order_handler, |
KAMEZAWA Hiroyuki | f0c0b2b | 2007-07-15 23:38:01 -0700 | [diff] [blame] | 1415 | }, |
| 1416 | #endif |
Al Viro | 2b8232c | 2007-10-13 08:16:04 +0100 | [diff] [blame] | 1417 | #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ |
Paul Mundt | 5c36e65 | 2007-03-01 10:07:42 +0900 | [diff] [blame] | 1418 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1419 | { |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1420 | .procname = "vdso_enabled", |
| 1421 | .data = &vdso_enabled, |
| 1422 | .maxlen = sizeof(vdso_enabled), |
| 1423 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1424 | .proc_handler = proc_dointvec, |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1425 | .extra1 = &zero, |
| 1426 | }, |
| 1427 | #endif |
Bron Gondwana | 195cf453 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1428 | #ifdef CONFIG_HIGHMEM |
| 1429 | { |
Bron Gondwana | 195cf453 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1430 | .procname = "highmem_is_dirtyable", |
| 1431 | .data = &vm_highmem_is_dirtyable, |
| 1432 | .maxlen = sizeof(vm_highmem_is_dirtyable), |
| 1433 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1434 | .proc_handler = proc_dointvec_minmax, |
Bron Gondwana | 195cf453 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1435 | .extra1 = &zero, |
| 1436 | .extra2 = &one, |
| 1437 | }, |
| 1438 | #endif |
Peter Zijlstra | 4be6f6b | 2009-04-13 14:39:33 -0700 | [diff] [blame] | 1439 | { |
Peter Zijlstra | 4be6f6b | 2009-04-13 14:39:33 -0700 | [diff] [blame] | 1440 | .procname = "scan_unevictable_pages", |
| 1441 | .data = &scan_unevictable_pages, |
| 1442 | .maxlen = sizeof(scan_unevictable_pages), |
| 1443 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1444 | .proc_handler = scan_unevictable_handler, |
Peter Zijlstra | 4be6f6b | 2009-04-13 14:39:33 -0700 | [diff] [blame] | 1445 | }, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1446 | #ifdef CONFIG_MEMORY_FAILURE |
| 1447 | { |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1448 | .procname = "memory_failure_early_kill", |
| 1449 | .data = &sysctl_memory_failure_early_kill, |
| 1450 | .maxlen = sizeof(sysctl_memory_failure_early_kill), |
| 1451 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1452 | .proc_handler = proc_dointvec_minmax, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1453 | .extra1 = &zero, |
| 1454 | .extra2 = &one, |
| 1455 | }, |
| 1456 | { |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1457 | .procname = "memory_failure_recovery", |
| 1458 | .data = &sysctl_memory_failure_recovery, |
| 1459 | .maxlen = sizeof(sysctl_memory_failure_recovery), |
| 1460 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1461 | .proc_handler = proc_dointvec_minmax, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1462 | .extra1 = &zero, |
| 1463 | .extra2 = &one, |
| 1464 | }, |
| 1465 | #endif |
Andrew Shewmaker | c9b1d09 | 2013-04-29 15:08:10 -0700 | [diff] [blame] | 1466 | { |
| 1467 | .procname = "user_reserve_kbytes", |
| 1468 | .data = &sysctl_user_reserve_kbytes, |
| 1469 | .maxlen = sizeof(sysctl_user_reserve_kbytes), |
| 1470 | .mode = 0644, |
| 1471 | .proc_handler = proc_doulongvec_minmax, |
| 1472 | }, |
Andrew Shewmaker | 4eeab4f | 2013-04-29 15:08:11 -0700 | [diff] [blame] | 1473 | { |
| 1474 | .procname = "admin_reserve_kbytes", |
| 1475 | .data = &sysctl_admin_reserve_kbytes, |
| 1476 | .maxlen = sizeof(sysctl_admin_reserve_kbytes), |
| 1477 | .mode = 0644, |
| 1478 | .proc_handler = proc_doulongvec_minmax, |
| 1479 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1480 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1481 | }; |
| 1482 | |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1483 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1484 | static struct ctl_table binfmt_misc_table[] = { |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1485 | { } |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1486 | }; |
| 1487 | #endif |
| 1488 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1489 | static struct ctl_table fs_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1490 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1491 | .procname = "inode-nr", |
| 1492 | .data = &inodes_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1493 | .maxlen = 2*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1494 | .mode = 0444, |
Dave Chinner | cffbc8a | 2010-10-23 05:03:02 -0400 | [diff] [blame] | 1495 | .proc_handler = proc_nr_inodes, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1496 | }, |
| 1497 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1498 | .procname = "inode-state", |
| 1499 | .data = &inodes_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1500 | .maxlen = 7*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1501 | .mode = 0444, |
Dave Chinner | cffbc8a | 2010-10-23 05:03:02 -0400 | [diff] [blame] | 1502 | .proc_handler = proc_nr_inodes, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1503 | }, |
| 1504 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1505 | .procname = "file-nr", |
| 1506 | .data = &files_stat, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1507 | .maxlen = sizeof(files_stat), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1508 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1509 | .proc_handler = proc_nr_files, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | }, |
| 1511 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1512 | .procname = "file-max", |
| 1513 | .data = &files_stat.max_files, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1514 | .maxlen = sizeof(files_stat.max_files), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1515 | .mode = 0644, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1516 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1517 | }, |
| 1518 | { |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1519 | .procname = "nr_open", |
| 1520 | .data = &sysctl_nr_open, |
| 1521 | .maxlen = sizeof(int), |
| 1522 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1523 | .proc_handler = proc_dointvec_minmax, |
Al Viro | eceea0b | 2008-05-10 10:08:32 -0400 | [diff] [blame] | 1524 | .extra1 = &sysctl_nr_open_min, |
| 1525 | .extra2 = &sysctl_nr_open_max, |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1526 | }, |
| 1527 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1528 | .procname = "dentry-state", |
| 1529 | .data = &dentry_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1530 | .maxlen = 6*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1531 | .mode = 0444, |
Christoph Hellwig | 312d3ca | 2010-10-10 05:36:23 -0400 | [diff] [blame] | 1532 | .proc_handler = proc_nr_dentry, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1533 | }, |
| 1534 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1535 | .procname = "overflowuid", |
| 1536 | .data = &fs_overflowuid, |
| 1537 | .maxlen = sizeof(int), |
| 1538 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1539 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1540 | .extra1 = &minolduid, |
| 1541 | .extra2 = &maxolduid, |
| 1542 | }, |
| 1543 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1544 | .procname = "overflowgid", |
| 1545 | .data = &fs_overflowgid, |
| 1546 | .maxlen = sizeof(int), |
| 1547 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1548 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1549 | .extra1 = &minolduid, |
| 1550 | .extra2 = &maxolduid, |
| 1551 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1552 | #ifdef CONFIG_FILE_LOCKING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1553 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1554 | .procname = "leases-enable", |
| 1555 | .data = &leases_enable, |
| 1556 | .maxlen = sizeof(int), |
| 1557 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1558 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1559 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1560 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1561 | #ifdef CONFIG_DNOTIFY |
| 1562 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1563 | .procname = "dir-notify-enable", |
| 1564 | .data = &dir_notify_enable, |
| 1565 | .maxlen = sizeof(int), |
| 1566 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1567 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1568 | }, |
| 1569 | #endif |
| 1570 | #ifdef CONFIG_MMU |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1571 | #ifdef CONFIG_FILE_LOCKING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1572 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1573 | .procname = "lease-break-time", |
| 1574 | .data = &lease_break_time, |
| 1575 | .maxlen = sizeof(int), |
| 1576 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1577 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1578 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1579 | #endif |
Thomas Petazzoni | ebf3f09 | 2008-10-15 22:05:12 -0700 | [diff] [blame] | 1580 | #ifdef CONFIG_AIO |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1581 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1582 | .procname = "aio-nr", |
| 1583 | .data = &aio_nr, |
| 1584 | .maxlen = sizeof(aio_nr), |
| 1585 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1586 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1587 | }, |
| 1588 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1589 | .procname = "aio-max-nr", |
| 1590 | .data = &aio_max_nr, |
| 1591 | .maxlen = sizeof(aio_max_nr), |
| 1592 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1593 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1594 | }, |
Thomas Petazzoni | ebf3f09 | 2008-10-15 22:05:12 -0700 | [diff] [blame] | 1595 | #endif /* CONFIG_AIO */ |
Amy Griffis | 2d9048e | 2006-06-01 13:10:59 -0700 | [diff] [blame] | 1596 | #ifdef CONFIG_INOTIFY_USER |
Robert Love | 0399cb0 | 2005-07-13 12:38:18 -0400 | [diff] [blame] | 1597 | { |
Robert Love | 0399cb0 | 2005-07-13 12:38:18 -0400 | [diff] [blame] | 1598 | .procname = "inotify", |
| 1599 | .mode = 0555, |
| 1600 | .child = inotify_table, |
| 1601 | }, |
| 1602 | #endif |
Davide Libenzi | 7ef9964 | 2008-12-01 13:13:55 -0800 | [diff] [blame] | 1603 | #ifdef CONFIG_EPOLL |
| 1604 | { |
| 1605 | .procname = "epoll", |
| 1606 | .mode = 0555, |
| 1607 | .child = epoll_table, |
| 1608 | }, |
| 1609 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1610 | #endif |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1611 | { |
Kees Cook | 800179c | 2012-07-25 17:29:07 -0700 | [diff] [blame] | 1612 | .procname = "protected_symlinks", |
| 1613 | .data = &sysctl_protected_symlinks, |
| 1614 | .maxlen = sizeof(int), |
| 1615 | .mode = 0600, |
| 1616 | .proc_handler = proc_dointvec_minmax, |
| 1617 | .extra1 = &zero, |
| 1618 | .extra2 = &one, |
| 1619 | }, |
| 1620 | { |
| 1621 | .procname = "protected_hardlinks", |
| 1622 | .data = &sysctl_protected_hardlinks, |
| 1623 | .maxlen = sizeof(int), |
| 1624 | .mode = 0600, |
| 1625 | .proc_handler = proc_dointvec_minmax, |
| 1626 | .extra1 = &zero, |
| 1627 | .extra2 = &one, |
| 1628 | }, |
| 1629 | { |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1630 | .procname = "suid_dumpable", |
| 1631 | .data = &suid_dumpable, |
| 1632 | .maxlen = sizeof(int), |
| 1633 | .mode = 0644, |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 1634 | .proc_handler = proc_dointvec_minmax_coredump, |
Matthew Wilcox | 8e654fb | 2009-04-02 16:58:33 -0700 | [diff] [blame] | 1635 | .extra1 = &zero, |
| 1636 | .extra2 = &two, |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1637 | }, |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1638 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
| 1639 | { |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1640 | .procname = "binfmt_misc", |
| 1641 | .mode = 0555, |
| 1642 | .child = binfmt_misc_table, |
| 1643 | }, |
| 1644 | #endif |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1645 | { |
Jens Axboe | ff9da69 | 2010-06-03 14:54:39 +0200 | [diff] [blame] | 1646 | .procname = "pipe-max-size", |
| 1647 | .data = &pipe_max_size, |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1648 | .maxlen = sizeof(int), |
| 1649 | .mode = 0644, |
Jens Axboe | ff9da69 | 2010-06-03 14:54:39 +0200 | [diff] [blame] | 1650 | .proc_handler = &pipe_proc_fn, |
| 1651 | .extra1 = &pipe_min_size, |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1652 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1653 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1654 | }; |
| 1655 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1656 | static struct ctl_table debug_table[] = { |
Catalin Marinas | 7ac57a8 | 2012-10-08 16:28:16 -0700 | [diff] [blame] | 1657 | #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE |
Masoud Asgharifard Sharbiani | abd4f75 | 2007-07-22 11:12:28 +0200 | [diff] [blame] | 1658 | { |
Masoud Asgharifard Sharbiani | abd4f75 | 2007-07-22 11:12:28 +0200 | [diff] [blame] | 1659 | .procname = "exception-trace", |
| 1660 | .data = &show_unhandled_signals, |
| 1661 | .maxlen = sizeof(int), |
| 1662 | .mode = 0644, |
| 1663 | .proc_handler = proc_dointvec |
| 1664 | }, |
| 1665 | #endif |
Masami Hiramatsu | b2be84d | 2010-02-25 08:34:15 -0500 | [diff] [blame] | 1666 | #if defined(CONFIG_OPTPROBES) |
| 1667 | { |
| 1668 | .procname = "kprobes-optimization", |
| 1669 | .data = &sysctl_kprobes_optimization, |
| 1670 | .maxlen = sizeof(int), |
| 1671 | .mode = 0644, |
| 1672 | .proc_handler = proc_kprobes_optimization_handler, |
| 1673 | .extra1 = &zero, |
| 1674 | .extra2 = &one, |
| 1675 | }, |
| 1676 | #endif |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1677 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1678 | }; |
| 1679 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1680 | static struct ctl_table dev_table[] = { |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1681 | { } |
Robert Love | 0eeca28 | 2005-07-12 17:06:03 -0400 | [diff] [blame] | 1682 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | |
Eric W. Biederman | de4e83bd | 2012-01-06 03:34:20 -0800 | [diff] [blame] | 1684 | int __init sysctl_init(void) |
Al Viro | 330d57f | 2005-11-04 10:18:40 +0000 | [diff] [blame] | 1685 | { |
Steven Rostedt | fd4b616 | 2012-07-30 14:42:48 -0700 | [diff] [blame] | 1686 | struct ctl_table_header *hdr; |
| 1687 | |
| 1688 | hdr = register_sysctl_table(sysctl_base_table); |
| 1689 | kmemleak_not_leak(hdr); |
Eric W. Biederman | d912b0c | 2007-02-14 00:34:13 -0800 | [diff] [blame] | 1690 | return 0; |
| 1691 | } |
| 1692 | |
Eric W. Biederman | b89a817 | 2006-09-27 01:51:04 -0700 | [diff] [blame] | 1693 | #endif /* CONFIG_SYSCTL */ |
| 1694 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1695 | /* |
| 1696 | * /proc/sys support |
| 1697 | */ |
| 1698 | |
Eric W. Biederman | b89a817 | 2006-09-27 01:51:04 -0700 | [diff] [blame] | 1699 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1700 | |
Adrian Bunk | b1ba4dd | 2006-10-02 02:18:05 -0700 | [diff] [blame] | 1701 | static int _proc_do_string(void* data, int maxlen, int write, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 1702 | void __user *buffer, |
Adrian Bunk | b1ba4dd | 2006-10-02 02:18:05 -0700 | [diff] [blame] | 1703 | size_t *lenp, loff_t *ppos) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1704 | { |
| 1705 | size_t len; |
| 1706 | char __user *p; |
| 1707 | char c; |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1708 | |
| 1709 | if (!data || !maxlen || !*lenp) { |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1710 | *lenp = 0; |
| 1711 | return 0; |
| 1712 | } |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1713 | |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1714 | if (write) { |
| 1715 | len = 0; |
| 1716 | p = buffer; |
| 1717 | while (len < *lenp) { |
| 1718 | if (get_user(c, p++)) |
| 1719 | return -EFAULT; |
| 1720 | if (c == 0 || c == '\n') |
| 1721 | break; |
| 1722 | len++; |
| 1723 | } |
| 1724 | if (len >= maxlen) |
| 1725 | len = maxlen-1; |
| 1726 | if(copy_from_user(data, buffer, len)) |
| 1727 | return -EFAULT; |
| 1728 | ((char *) data)[len] = 0; |
| 1729 | *ppos += *lenp; |
| 1730 | } else { |
| 1731 | len = strlen(data); |
| 1732 | if (len > maxlen) |
| 1733 | len = maxlen; |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1734 | |
| 1735 | if (*ppos > len) { |
| 1736 | *lenp = 0; |
| 1737 | return 0; |
| 1738 | } |
| 1739 | |
| 1740 | data += *ppos; |
| 1741 | len -= *ppos; |
| 1742 | |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1743 | if (len > *lenp) |
| 1744 | len = *lenp; |
| 1745 | if (len) |
| 1746 | if(copy_to_user(buffer, data, len)) |
| 1747 | return -EFAULT; |
| 1748 | if (len < *lenp) { |
| 1749 | if(put_user('\n', ((char __user *) buffer) + len)) |
| 1750 | return -EFAULT; |
| 1751 | len++; |
| 1752 | } |
| 1753 | *lenp = len; |
| 1754 | *ppos += len; |
| 1755 | } |
| 1756 | return 0; |
| 1757 | } |
| 1758 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1759 | /** |
| 1760 | * proc_dostring - read a string sysctl |
| 1761 | * @table: the sysctl table |
| 1762 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1763 | * @buffer: the user buffer |
| 1764 | * @lenp: the size of the user buffer |
| 1765 | * @ppos: file position |
| 1766 | * |
| 1767 | * Reads/writes a string from/to the user buffer. If the kernel |
| 1768 | * buffer provided is not large enough to hold the string, the |
| 1769 | * string is truncated. The copied string is %NULL-terminated. |
| 1770 | * If the string is being read by the user process, it is copied |
| 1771 | * and a newline '\n' is added. It is truncated if the buffer is |
| 1772 | * not large enough. |
| 1773 | * |
| 1774 | * Returns 0 on success. |
| 1775 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 1776 | int proc_dostring(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1777 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 1778 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 1779 | return _proc_do_string(table->data, table->maxlen, write, |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1780 | buffer, lenp, ppos); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1781 | } |
| 1782 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1783 | static size_t proc_skip_spaces(char **buf) |
| 1784 | { |
| 1785 | size_t ret; |
| 1786 | char *tmp = skip_spaces(*buf); |
| 1787 | ret = tmp - *buf; |
| 1788 | *buf = tmp; |
| 1789 | return ret; |
| 1790 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1791 | |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 1792 | static void proc_skip_char(char **buf, size_t *size, const char v) |
| 1793 | { |
| 1794 | while (*size) { |
| 1795 | if (**buf != v) |
| 1796 | break; |
| 1797 | (*size)--; |
| 1798 | (*buf)++; |
| 1799 | } |
| 1800 | } |
| 1801 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1802 | #define TMPBUFLEN 22 |
| 1803 | /** |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1804 | * proc_get_long - reads an ASCII formatted integer from a user buffer |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1805 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1806 | * @buf: a kernel buffer |
| 1807 | * @size: size of the kernel buffer |
| 1808 | * @val: this is where the number will be stored |
| 1809 | * @neg: set to %TRUE if number is negative |
| 1810 | * @perm_tr: a vector which contains the allowed trailers |
| 1811 | * @perm_tr_len: size of the perm_tr vector |
| 1812 | * @tr: pointer to store the trailer character |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1813 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1814 | * In case of success %0 is returned and @buf and @size are updated with |
| 1815 | * the amount of bytes read. If @tr is non-NULL and a trailing |
| 1816 | * character exists (size is non-zero after returning from this |
| 1817 | * function), @tr is updated with the trailing character. |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1818 | */ |
| 1819 | static int proc_get_long(char **buf, size_t *size, |
| 1820 | unsigned long *val, bool *neg, |
| 1821 | const char *perm_tr, unsigned perm_tr_len, char *tr) |
| 1822 | { |
| 1823 | int len; |
| 1824 | char *p, tmp[TMPBUFLEN]; |
| 1825 | |
| 1826 | if (!*size) |
| 1827 | return -EINVAL; |
| 1828 | |
| 1829 | len = *size; |
| 1830 | if (len > TMPBUFLEN - 1) |
| 1831 | len = TMPBUFLEN - 1; |
| 1832 | |
| 1833 | memcpy(tmp, *buf, len); |
| 1834 | |
| 1835 | tmp[len] = 0; |
| 1836 | p = tmp; |
| 1837 | if (*p == '-' && *size > 1) { |
| 1838 | *neg = true; |
| 1839 | p++; |
| 1840 | } else |
| 1841 | *neg = false; |
| 1842 | if (!isdigit(*p)) |
| 1843 | return -EINVAL; |
| 1844 | |
| 1845 | *val = simple_strtoul(p, &p, 0); |
| 1846 | |
| 1847 | len = p - tmp; |
| 1848 | |
| 1849 | /* We don't know if the next char is whitespace thus we may accept |
| 1850 | * invalid integers (e.g. 1234...a) or two integers instead of one |
| 1851 | * (e.g. 123...1). So lets not allow such large numbers. */ |
| 1852 | if (len == TMPBUFLEN - 1) |
| 1853 | return -EINVAL; |
| 1854 | |
| 1855 | if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len)) |
| 1856 | return -EINVAL; |
| 1857 | |
| 1858 | if (tr && (len < *size)) |
| 1859 | *tr = *p; |
| 1860 | |
| 1861 | *buf += len; |
| 1862 | *size -= len; |
| 1863 | |
| 1864 | return 0; |
| 1865 | } |
| 1866 | |
| 1867 | /** |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1868 | * proc_put_long - converts an integer to a decimal ASCII formatted string |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1869 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1870 | * @buf: the user buffer |
| 1871 | * @size: the size of the user buffer |
| 1872 | * @val: the integer to be converted |
| 1873 | * @neg: sign of the number, %TRUE for negative |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1874 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1875 | * In case of success %0 is returned and @buf and @size are updated with |
| 1876 | * the amount of bytes written. |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1877 | */ |
| 1878 | static int proc_put_long(void __user **buf, size_t *size, unsigned long val, |
| 1879 | bool neg) |
| 1880 | { |
| 1881 | int len; |
| 1882 | char tmp[TMPBUFLEN], *p = tmp; |
| 1883 | |
| 1884 | sprintf(p, "%s%lu", neg ? "-" : "", val); |
| 1885 | len = strlen(tmp); |
| 1886 | if (len > *size) |
| 1887 | len = *size; |
| 1888 | if (copy_to_user(*buf, tmp, len)) |
| 1889 | return -EFAULT; |
| 1890 | *size -= len; |
| 1891 | *buf += len; |
| 1892 | return 0; |
| 1893 | } |
| 1894 | #undef TMPBUFLEN |
| 1895 | |
| 1896 | static int proc_put_char(void __user **buf, size_t *size, char c) |
| 1897 | { |
| 1898 | if (*size) { |
| 1899 | char __user **buffer = (char __user **)buf; |
| 1900 | if (put_user(c, *buffer)) |
| 1901 | return -EFAULT; |
| 1902 | (*size)--, (*buffer)++; |
| 1903 | *buf = *buffer; |
| 1904 | } |
| 1905 | return 0; |
| 1906 | } |
| 1907 | |
| 1908 | static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1909 | int *valp, |
| 1910 | int write, void *data) |
| 1911 | { |
| 1912 | if (write) { |
| 1913 | *valp = *negp ? -*lvalp : *lvalp; |
| 1914 | } else { |
| 1915 | int val = *valp; |
| 1916 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1917 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1918 | *lvalp = (unsigned long)-val; |
| 1919 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1920 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1921 | *lvalp = (unsigned long)val; |
| 1922 | } |
| 1923 | } |
| 1924 | return 0; |
| 1925 | } |
| 1926 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1927 | static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; |
| 1928 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1929 | static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 1930 | int write, void __user *buffer, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 1931 | size_t *lenp, loff_t *ppos, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1932 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1933 | int write, void *data), |
| 1934 | void *data) |
| 1935 | { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1936 | int *i, vleft, first = 1, err = 0; |
| 1937 | unsigned long page = 0; |
| 1938 | size_t left; |
| 1939 | char *kbuf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1940 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1941 | if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1942 | *lenp = 0; |
| 1943 | return 0; |
| 1944 | } |
| 1945 | |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 1946 | i = (int *) tbl_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1947 | vleft = table->maxlen / sizeof(*i); |
| 1948 | left = *lenp; |
| 1949 | |
| 1950 | if (!conv) |
| 1951 | conv = do_proc_dointvec_conv; |
| 1952 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1953 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1954 | if (left > PAGE_SIZE - 1) |
| 1955 | left = PAGE_SIZE - 1; |
| 1956 | page = __get_free_page(GFP_TEMPORARY); |
| 1957 | kbuf = (char *) page; |
| 1958 | if (!kbuf) |
| 1959 | return -ENOMEM; |
| 1960 | if (copy_from_user(kbuf, buffer, left)) { |
| 1961 | err = -EFAULT; |
| 1962 | goto free; |
| 1963 | } |
| 1964 | kbuf[left] = 0; |
| 1965 | } |
| 1966 | |
| 1967 | for (; left && vleft--; i++, first=0) { |
| 1968 | unsigned long lval; |
| 1969 | bool neg; |
| 1970 | |
| 1971 | if (write) { |
| 1972 | left -= proc_skip_spaces(&kbuf); |
| 1973 | |
J. R. Okajima | 563b046 | 2010-05-25 16:10:14 -0700 | [diff] [blame] | 1974 | if (!left) |
| 1975 | break; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1976 | err = proc_get_long(&kbuf, &left, &lval, &neg, |
| 1977 | proc_wspace_sep, |
| 1978 | sizeof(proc_wspace_sep), NULL); |
| 1979 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1980 | break; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1981 | if (conv(&neg, &lval, i, 1, data)) { |
| 1982 | err = -EINVAL; |
| 1983 | break; |
| 1984 | } |
| 1985 | } else { |
| 1986 | if (conv(&neg, &lval, i, 0, data)) { |
| 1987 | err = -EINVAL; |
| 1988 | break; |
| 1989 | } |
| 1990 | if (!first) |
| 1991 | err = proc_put_char(&buffer, &left, '\t'); |
| 1992 | if (err) |
| 1993 | break; |
| 1994 | err = proc_put_long(&buffer, &left, lval, neg); |
| 1995 | if (err) |
| 1996 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1997 | } |
| 1998 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1999 | |
| 2000 | if (!write && !first && left && !err) |
| 2001 | err = proc_put_char(&buffer, &left, '\n'); |
J. R. Okajima | 563b046 | 2010-05-25 16:10:14 -0700 | [diff] [blame] | 2002 | if (write && !err && left) |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2003 | left -= proc_skip_spaces(&kbuf); |
| 2004 | free: |
| 2005 | if (write) { |
| 2006 | free_page(page); |
| 2007 | if (first) |
| 2008 | return err ? : -EINVAL; |
| 2009 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2010 | *lenp -= left; |
| 2011 | *ppos += *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2012 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2013 | } |
| 2014 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2015 | static int do_proc_dointvec(struct ctl_table *table, int write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2016 | void __user *buffer, size_t *lenp, loff_t *ppos, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2017 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2018 | int write, void *data), |
| 2019 | void *data) |
| 2020 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2021 | return __do_proc_dointvec(table->data, table, write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2022 | buffer, lenp, ppos, conv, data); |
| 2023 | } |
| 2024 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2025 | /** |
| 2026 | * proc_dointvec - read a vector of integers |
| 2027 | * @table: the sysctl table |
| 2028 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2029 | * @buffer: the user buffer |
| 2030 | * @lenp: the size of the user buffer |
| 2031 | * @ppos: file position |
| 2032 | * |
| 2033 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2034 | * values from/to the user buffer, treated as an ASCII string. |
| 2035 | * |
| 2036 | * Returns 0 on success. |
| 2037 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2038 | int proc_dointvec(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2039 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2040 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2041 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2042 | NULL,NULL); |
| 2043 | } |
| 2044 | |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2045 | /* |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2046 | * Taint values can only be increased |
| 2047 | * This means we can safely use a temporary. |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2048 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2049 | static int proc_taint(struct ctl_table *table, int write, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2050 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2051 | { |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2052 | struct ctl_table t; |
| 2053 | unsigned long tmptaint = get_taint(); |
| 2054 | int err; |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2055 | |
Bastian Blank | 91fcd41 | 2007-04-23 14:41:14 -0700 | [diff] [blame] | 2056 | if (write && !capable(CAP_SYS_ADMIN)) |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2057 | return -EPERM; |
| 2058 | |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2059 | t = *table; |
| 2060 | t.data = &tmptaint; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2061 | err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2062 | if (err < 0) |
| 2063 | return err; |
| 2064 | |
| 2065 | if (write) { |
| 2066 | /* |
| 2067 | * Poor man's atomic or. Not worth adding a primitive |
| 2068 | * to everyone's atomic.h for this |
| 2069 | */ |
| 2070 | int i; |
| 2071 | for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { |
| 2072 | if ((tmptaint >> i) & 1) |
Rusty Russell | 373d4d0 | 2013-01-21 17:17:39 +1030 | [diff] [blame] | 2073 | add_taint(i, LOCKDEP_STILL_OK); |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2074 | } |
| 2075 | } |
| 2076 | |
| 2077 | return err; |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2078 | } |
| 2079 | |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 2080 | #ifdef CONFIG_PRINTK |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 2081 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 2082 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2083 | { |
| 2084 | if (write && !capable(CAP_SYS_ADMIN)) |
| 2085 | return -EPERM; |
| 2086 | |
| 2087 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 2088 | } |
| 2089 | #endif |
| 2090 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2091 | struct do_proc_dointvec_minmax_conv_param { |
| 2092 | int *min; |
| 2093 | int *max; |
| 2094 | }; |
| 2095 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2096 | static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, |
| 2097 | int *valp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2098 | int write, void *data) |
| 2099 | { |
| 2100 | struct do_proc_dointvec_minmax_conv_param *param = data; |
| 2101 | if (write) { |
| 2102 | int val = *negp ? -*lvalp : *lvalp; |
| 2103 | if ((param->min && *param->min > val) || |
| 2104 | (param->max && *param->max < val)) |
| 2105 | return -EINVAL; |
| 2106 | *valp = val; |
| 2107 | } else { |
| 2108 | int val = *valp; |
| 2109 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2110 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2111 | *lvalp = (unsigned long)-val; |
| 2112 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2113 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2114 | *lvalp = (unsigned long)val; |
| 2115 | } |
| 2116 | } |
| 2117 | return 0; |
| 2118 | } |
| 2119 | |
| 2120 | /** |
| 2121 | * proc_dointvec_minmax - read a vector of integers with min/max values |
| 2122 | * @table: the sysctl table |
| 2123 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2124 | * @buffer: the user buffer |
| 2125 | * @lenp: the size of the user buffer |
| 2126 | * @ppos: file position |
| 2127 | * |
| 2128 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2129 | * values from/to the user buffer, treated as an ASCII string. |
| 2130 | * |
| 2131 | * This routine will ensure the values are within the range specified by |
| 2132 | * table->extra1 (min) and table->extra2 (max). |
| 2133 | * |
| 2134 | * Returns 0 on success. |
| 2135 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2136 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2137 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2138 | { |
| 2139 | struct do_proc_dointvec_minmax_conv_param param = { |
| 2140 | .min = (int *) table->extra1, |
| 2141 | .max = (int *) table->extra2, |
| 2142 | }; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2143 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2144 | do_proc_dointvec_minmax_conv, ¶m); |
| 2145 | } |
| 2146 | |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2147 | static void validate_coredump_safety(void) |
| 2148 | { |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2149 | #ifdef CONFIG_COREDUMP |
Kees Cook | e579d2c | 2013-02-27 17:03:15 -0800 | [diff] [blame] | 2150 | if (suid_dumpable == SUID_DUMP_ROOT && |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2151 | core_pattern[0] != '/' && core_pattern[0] != '|') { |
| 2152 | printk(KERN_WARNING "Unsafe core_pattern used with "\ |
| 2153 | "suid_dumpable=2. Pipe handler or fully qualified "\ |
| 2154 | "core dump path required.\n"); |
| 2155 | } |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2156 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2157 | } |
| 2158 | |
| 2159 | static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, |
| 2160 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2161 | { |
| 2162 | int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 2163 | if (!error) |
| 2164 | validate_coredump_safety(); |
| 2165 | return error; |
| 2166 | } |
| 2167 | |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2168 | #ifdef CONFIG_COREDUMP |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2169 | static int proc_dostring_coredump(struct ctl_table *table, int write, |
| 2170 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2171 | { |
| 2172 | int error = proc_dostring(table, write, buffer, lenp, ppos); |
| 2173 | if (!error) |
| 2174 | validate_coredump_safety(); |
| 2175 | return error; |
| 2176 | } |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2177 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2178 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2179 | static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2180 | void __user *buffer, |
| 2181 | size_t *lenp, loff_t *ppos, |
| 2182 | unsigned long convmul, |
| 2183 | unsigned long convdiv) |
| 2184 | { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2185 | unsigned long *i, *min, *max; |
| 2186 | int vleft, first = 1, err = 0; |
| 2187 | unsigned long page = 0; |
| 2188 | size_t left; |
| 2189 | char *kbuf; |
| 2190 | |
| 2191 | if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2192 | *lenp = 0; |
| 2193 | return 0; |
| 2194 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2195 | |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2196 | i = (unsigned long *) data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2197 | min = (unsigned long *) table->extra1; |
| 2198 | max = (unsigned long *) table->extra2; |
| 2199 | vleft = table->maxlen / sizeof(unsigned long); |
| 2200 | left = *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2201 | |
| 2202 | if (write) { |
| 2203 | if (left > PAGE_SIZE - 1) |
| 2204 | left = PAGE_SIZE - 1; |
| 2205 | page = __get_free_page(GFP_TEMPORARY); |
| 2206 | kbuf = (char *) page; |
| 2207 | if (!kbuf) |
| 2208 | return -ENOMEM; |
| 2209 | if (copy_from_user(kbuf, buffer, left)) { |
| 2210 | err = -EFAULT; |
| 2211 | goto free; |
| 2212 | } |
| 2213 | kbuf[left] = 0; |
| 2214 | } |
| 2215 | |
Eric Dumazet | 27b3d80 | 2010-10-07 12:59:29 -0700 | [diff] [blame] | 2216 | for (; left && vleft--; i++, first = 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2217 | unsigned long val; |
| 2218 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2219 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2220 | bool neg; |
| 2221 | |
| 2222 | left -= proc_skip_spaces(&kbuf); |
| 2223 | |
| 2224 | err = proc_get_long(&kbuf, &left, &val, &neg, |
| 2225 | proc_wspace_sep, |
| 2226 | sizeof(proc_wspace_sep), NULL); |
| 2227 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | break; |
| 2229 | if (neg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2230 | continue; |
| 2231 | if ((min && val < *min) || (max && val > *max)) |
| 2232 | continue; |
| 2233 | *i = val; |
| 2234 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2235 | val = convdiv * (*i) / convmul; |
Chen Gang | 7833819 | 2013-11-12 15:11:21 -0800 | [diff] [blame] | 2236 | if (!first) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2237 | err = proc_put_char(&buffer, &left, '\t'); |
Chen Gang | 7833819 | 2013-11-12 15:11:21 -0800 | [diff] [blame] | 2238 | if (err) |
| 2239 | break; |
| 2240 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2241 | err = proc_put_long(&buffer, &left, val, false); |
| 2242 | if (err) |
| 2243 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2244 | } |
| 2245 | } |
| 2246 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2247 | if (!write && !first && left && !err) |
| 2248 | err = proc_put_char(&buffer, &left, '\n'); |
| 2249 | if (write && !err) |
| 2250 | left -= proc_skip_spaces(&kbuf); |
| 2251 | free: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2252 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2253 | free_page(page); |
| 2254 | if (first) |
| 2255 | return err ? : -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2256 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2257 | *lenp -= left; |
| 2258 | *ppos += *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2259 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2260 | } |
| 2261 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2262 | static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2263 | void __user *buffer, |
| 2264 | size_t *lenp, loff_t *ppos, |
| 2265 | unsigned long convmul, |
| 2266 | unsigned long convdiv) |
| 2267 | { |
| 2268 | return __do_proc_doulongvec_minmax(table->data, table, write, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2269 | buffer, lenp, ppos, convmul, convdiv); |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2270 | } |
| 2271 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2272 | /** |
| 2273 | * proc_doulongvec_minmax - read a vector of long integers with min/max values |
| 2274 | * @table: the sysctl table |
| 2275 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2276 | * @buffer: the user buffer |
| 2277 | * @lenp: the size of the user buffer |
| 2278 | * @ppos: file position |
| 2279 | * |
| 2280 | * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long |
| 2281 | * values from/to the user buffer, treated as an ASCII string. |
| 2282 | * |
| 2283 | * This routine will ensure the values are within the range specified by |
| 2284 | * table->extra1 (min) and table->extra2 (max). |
| 2285 | * |
| 2286 | * Returns 0 on success. |
| 2287 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2288 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2289 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2290 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2291 | return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2292 | } |
| 2293 | |
| 2294 | /** |
| 2295 | * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values |
| 2296 | * @table: the sysctl table |
| 2297 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | * @buffer: the user buffer |
| 2299 | * @lenp: the size of the user buffer |
| 2300 | * @ppos: file position |
| 2301 | * |
| 2302 | * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long |
| 2303 | * values from/to the user buffer, treated as an ASCII string. The values |
| 2304 | * are treated as milliseconds, and converted to jiffies when they are stored. |
| 2305 | * |
| 2306 | * This routine will ensure the values are within the range specified by |
| 2307 | * table->extra1 (min) and table->extra2 (max). |
| 2308 | * |
| 2309 | * Returns 0 on success. |
| 2310 | */ |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2311 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2312 | void __user *buffer, |
| 2313 | size_t *lenp, loff_t *ppos) |
| 2314 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2315 | return do_proc_doulongvec_minmax(table, write, buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2316 | lenp, ppos, HZ, 1000l); |
| 2317 | } |
| 2318 | |
| 2319 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2320 | static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | int *valp, |
| 2322 | int write, void *data) |
| 2323 | { |
| 2324 | if (write) { |
Bart Samwel | cba9f33 | 2006-03-24 03:15:50 -0800 | [diff] [blame] | 2325 | if (*lvalp > LONG_MAX / HZ) |
| 2326 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2327 | *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); |
| 2328 | } else { |
| 2329 | int val = *valp; |
| 2330 | unsigned long lval; |
| 2331 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2332 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2333 | lval = (unsigned long)-val; |
| 2334 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2335 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2336 | lval = (unsigned long)val; |
| 2337 | } |
| 2338 | *lvalp = lval / HZ; |
| 2339 | } |
| 2340 | return 0; |
| 2341 | } |
| 2342 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2343 | static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2344 | int *valp, |
| 2345 | int write, void *data) |
| 2346 | { |
| 2347 | if (write) { |
Bart Samwel | cba9f33 | 2006-03-24 03:15:50 -0800 | [diff] [blame] | 2348 | if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) |
| 2349 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2350 | *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); |
| 2351 | } else { |
| 2352 | int val = *valp; |
| 2353 | unsigned long lval; |
| 2354 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2355 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | lval = (unsigned long)-val; |
| 2357 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2358 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2359 | lval = (unsigned long)val; |
| 2360 | } |
| 2361 | *lvalp = jiffies_to_clock_t(lval); |
| 2362 | } |
| 2363 | return 0; |
| 2364 | } |
| 2365 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2366 | static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2367 | int *valp, |
| 2368 | int write, void *data) |
| 2369 | { |
| 2370 | if (write) { |
Francesco Fusco | d738ce8 | 2013-07-24 10:39:07 +0200 | [diff] [blame] | 2371 | unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); |
| 2372 | |
| 2373 | if (jif > INT_MAX) |
| 2374 | return 1; |
| 2375 | *valp = (int)jif; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2376 | } else { |
| 2377 | int val = *valp; |
| 2378 | unsigned long lval; |
| 2379 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2380 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2381 | lval = (unsigned long)-val; |
| 2382 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2383 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2384 | lval = (unsigned long)val; |
| 2385 | } |
| 2386 | *lvalp = jiffies_to_msecs(lval); |
| 2387 | } |
| 2388 | return 0; |
| 2389 | } |
| 2390 | |
| 2391 | /** |
| 2392 | * proc_dointvec_jiffies - read a vector of integers as seconds |
| 2393 | * @table: the sysctl table |
| 2394 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2395 | * @buffer: the user buffer |
| 2396 | * @lenp: the size of the user buffer |
| 2397 | * @ppos: file position |
| 2398 | * |
| 2399 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2400 | * values from/to the user buffer, treated as an ASCII string. |
| 2401 | * The values read are assumed to be in seconds, and are converted into |
| 2402 | * jiffies. |
| 2403 | * |
| 2404 | * Returns 0 on success. |
| 2405 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2406 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2407 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2408 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2409 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | do_proc_dointvec_jiffies_conv,NULL); |
| 2411 | } |
| 2412 | |
| 2413 | /** |
| 2414 | * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds |
| 2415 | * @table: the sysctl table |
| 2416 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2417 | * @buffer: the user buffer |
| 2418 | * @lenp: the size of the user buffer |
Randy Dunlap | 1e5d533 | 2005-11-07 01:01:06 -0800 | [diff] [blame] | 2419 | * @ppos: pointer to the file position |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2420 | * |
| 2421 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2422 | * values from/to the user buffer, treated as an ASCII string. |
| 2423 | * The values read are assumed to be in 1/USER_HZ seconds, and |
| 2424 | * are converted into jiffies. |
| 2425 | * |
| 2426 | * Returns 0 on success. |
| 2427 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2428 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2429 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2430 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2431 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2432 | do_proc_dointvec_userhz_jiffies_conv,NULL); |
| 2433 | } |
| 2434 | |
| 2435 | /** |
| 2436 | * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds |
| 2437 | * @table: the sysctl table |
| 2438 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2439 | * @buffer: the user buffer |
| 2440 | * @lenp: the size of the user buffer |
Martin Waitz | 67be2dd | 2005-05-01 08:59:26 -0700 | [diff] [blame] | 2441 | * @ppos: file position |
| 2442 | * @ppos: the current position in the file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2443 | * |
| 2444 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2445 | * values from/to the user buffer, treated as an ASCII string. |
| 2446 | * The values read are assumed to be in 1/1000 seconds, and |
| 2447 | * are converted into jiffies. |
| 2448 | * |
| 2449 | * Returns 0 on success. |
| 2450 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2451 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2452 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2453 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2454 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2455 | do_proc_dointvec_ms_jiffies_conv, NULL); |
| 2456 | } |
| 2457 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2458 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2459 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2460 | { |
| 2461 | struct pid *new_pid; |
| 2462 | pid_t tmp; |
| 2463 | int r; |
| 2464 | |
Pavel Emelyanov | 6c5f3e7 | 2008-02-08 04:19:20 -0800 | [diff] [blame] | 2465 | tmp = pid_vnr(cad_pid); |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2466 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2467 | r = __do_proc_dointvec(&tmp, table, write, buffer, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2468 | lenp, ppos, NULL, NULL); |
| 2469 | if (r || !write) |
| 2470 | return r; |
| 2471 | |
| 2472 | new_pid = find_get_pid(tmp); |
| 2473 | if (!new_pid) |
| 2474 | return -ESRCH; |
| 2475 | |
| 2476 | put_pid(xchg(&cad_pid, new_pid)); |
| 2477 | return 0; |
| 2478 | } |
| 2479 | |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2480 | /** |
| 2481 | * proc_do_large_bitmap - read/write from/to a large bitmap |
| 2482 | * @table: the sysctl table |
| 2483 | * @write: %TRUE if this is a write to the sysctl file |
| 2484 | * @buffer: the user buffer |
| 2485 | * @lenp: the size of the user buffer |
| 2486 | * @ppos: file position |
| 2487 | * |
| 2488 | * The bitmap is stored at table->data and the bitmap length (in bits) |
| 2489 | * in table->maxlen. |
| 2490 | * |
| 2491 | * We use a range comma separated format (e.g. 1,3-4,10-10) so that |
| 2492 | * large bitmaps may be represented in a compact manner. Writing into |
| 2493 | * the file will clear the bitmap then update it with the given input. |
| 2494 | * |
| 2495 | * Returns 0 on success. |
| 2496 | */ |
| 2497 | int proc_do_large_bitmap(struct ctl_table *table, int write, |
| 2498 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2499 | { |
| 2500 | int err = 0; |
| 2501 | bool first = 1; |
| 2502 | size_t left = *lenp; |
| 2503 | unsigned long bitmap_len = table->maxlen; |
| 2504 | unsigned long *bitmap = (unsigned long *) table->data; |
| 2505 | unsigned long *tmp_bitmap = NULL; |
| 2506 | char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c; |
| 2507 | |
| 2508 | if (!bitmap_len || !left || (*ppos && !write)) { |
| 2509 | *lenp = 0; |
| 2510 | return 0; |
| 2511 | } |
| 2512 | |
| 2513 | if (write) { |
| 2514 | unsigned long page = 0; |
| 2515 | char *kbuf; |
| 2516 | |
| 2517 | if (left > PAGE_SIZE - 1) |
| 2518 | left = PAGE_SIZE - 1; |
| 2519 | |
| 2520 | page = __get_free_page(GFP_TEMPORARY); |
| 2521 | kbuf = (char *) page; |
| 2522 | if (!kbuf) |
| 2523 | return -ENOMEM; |
| 2524 | if (copy_from_user(kbuf, buffer, left)) { |
| 2525 | free_page(page); |
| 2526 | return -EFAULT; |
| 2527 | } |
| 2528 | kbuf[left] = 0; |
| 2529 | |
| 2530 | tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long), |
| 2531 | GFP_KERNEL); |
| 2532 | if (!tmp_bitmap) { |
| 2533 | free_page(page); |
| 2534 | return -ENOMEM; |
| 2535 | } |
| 2536 | proc_skip_char(&kbuf, &left, '\n'); |
| 2537 | while (!err && left) { |
| 2538 | unsigned long val_a, val_b; |
| 2539 | bool neg; |
| 2540 | |
| 2541 | err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a, |
| 2542 | sizeof(tr_a), &c); |
| 2543 | if (err) |
| 2544 | break; |
| 2545 | if (val_a >= bitmap_len || neg) { |
| 2546 | err = -EINVAL; |
| 2547 | break; |
| 2548 | } |
| 2549 | |
| 2550 | val_b = val_a; |
| 2551 | if (left) { |
| 2552 | kbuf++; |
| 2553 | left--; |
| 2554 | } |
| 2555 | |
| 2556 | if (c == '-') { |
| 2557 | err = proc_get_long(&kbuf, &left, &val_b, |
| 2558 | &neg, tr_b, sizeof(tr_b), |
| 2559 | &c); |
| 2560 | if (err) |
| 2561 | break; |
| 2562 | if (val_b >= bitmap_len || neg || |
| 2563 | val_a > val_b) { |
| 2564 | err = -EINVAL; |
| 2565 | break; |
| 2566 | } |
| 2567 | if (left) { |
| 2568 | kbuf++; |
| 2569 | left--; |
| 2570 | } |
| 2571 | } |
| 2572 | |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 2573 | bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2574 | first = 0; |
| 2575 | proc_skip_char(&kbuf, &left, '\n'); |
| 2576 | } |
| 2577 | free_page(page); |
| 2578 | } else { |
| 2579 | unsigned long bit_a, bit_b = 0; |
| 2580 | |
| 2581 | while (left) { |
| 2582 | bit_a = find_next_bit(bitmap, bitmap_len, bit_b); |
| 2583 | if (bit_a >= bitmap_len) |
| 2584 | break; |
| 2585 | bit_b = find_next_zero_bit(bitmap, bitmap_len, |
| 2586 | bit_a + 1) - 1; |
| 2587 | |
| 2588 | if (!first) { |
| 2589 | err = proc_put_char(&buffer, &left, ','); |
| 2590 | if (err) |
| 2591 | break; |
| 2592 | } |
| 2593 | err = proc_put_long(&buffer, &left, bit_a, false); |
| 2594 | if (err) |
| 2595 | break; |
| 2596 | if (bit_a != bit_b) { |
| 2597 | err = proc_put_char(&buffer, &left, '-'); |
| 2598 | if (err) |
| 2599 | break; |
| 2600 | err = proc_put_long(&buffer, &left, bit_b, false); |
| 2601 | if (err) |
| 2602 | break; |
| 2603 | } |
| 2604 | |
| 2605 | first = 0; bit_b++; |
| 2606 | } |
| 2607 | if (!err) |
| 2608 | err = proc_put_char(&buffer, &left, '\n'); |
| 2609 | } |
| 2610 | |
| 2611 | if (!err) { |
| 2612 | if (write) { |
| 2613 | if (*ppos) |
| 2614 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); |
| 2615 | else |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 2616 | bitmap_copy(bitmap, tmp_bitmap, bitmap_len); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2617 | } |
| 2618 | kfree(tmp_bitmap); |
| 2619 | *lenp -= left; |
| 2620 | *ppos += *lenp; |
| 2621 | return 0; |
| 2622 | } else { |
| 2623 | kfree(tmp_bitmap); |
| 2624 | return err; |
| 2625 | } |
| 2626 | } |
| 2627 | |
Jovi Zhang | 5561050 | 2011-01-12 17:00:45 -0800 | [diff] [blame] | 2628 | #else /* CONFIG_PROC_SYSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2629 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2630 | int proc_dostring(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2631 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2632 | { |
| 2633 | return -ENOSYS; |
| 2634 | } |
| 2635 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2636 | int proc_dointvec(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2637 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2638 | { |
| 2639 | return -ENOSYS; |
| 2640 | } |
| 2641 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2642 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2643 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2644 | { |
| 2645 | return -ENOSYS; |
| 2646 | } |
| 2647 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2648 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2649 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2650 | { |
| 2651 | return -ENOSYS; |
| 2652 | } |
| 2653 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2654 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2655 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2656 | { |
| 2657 | return -ENOSYS; |
| 2658 | } |
| 2659 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2660 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2661 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2662 | { |
| 2663 | return -ENOSYS; |
| 2664 | } |
| 2665 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2666 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2667 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2668 | { |
| 2669 | return -ENOSYS; |
| 2670 | } |
| 2671 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2672 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2673 | void __user *buffer, |
| 2674 | size_t *lenp, loff_t *ppos) |
| 2675 | { |
| 2676 | return -ENOSYS; |
| 2677 | } |
| 2678 | |
| 2679 | |
Jovi Zhang | 5561050 | 2011-01-12 17:00:45 -0800 | [diff] [blame] | 2680 | #endif /* CONFIG_PROC_SYSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2681 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2682 | /* |
| 2683 | * No sense putting this after each symbol definition, twice, |
| 2684 | * exception granted :-) |
| 2685 | */ |
| 2686 | EXPORT_SYMBOL(proc_dointvec); |
| 2687 | EXPORT_SYMBOL(proc_dointvec_jiffies); |
| 2688 | EXPORT_SYMBOL(proc_dointvec_minmax); |
| 2689 | EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); |
| 2690 | EXPORT_SYMBOL(proc_dointvec_ms_jiffies); |
| 2691 | EXPORT_SYMBOL(proc_dostring); |
| 2692 | EXPORT_SYMBOL(proc_doulongvec_minmax); |
| 2693 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); |