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 |
Michael Marineau | 86d5613 | 2014-04-10 14:09:31 -0700 | [diff] [blame] | 646 | #ifdef CONFIG_UEVENT_HELPER |
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 | }, |
Michael Marineau | 86d5613 | 2014-04-10 14:09:31 -0700 | [diff] [blame] | 654 | #endif |
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", |
Andy Lutomirski | 3d7ee96 | 2014-05-05 12:19:32 -0700 | [diff] [blame] | 1421 | #ifdef CONFIG_X86_32 |
| 1422 | .data = &vdso32_enabled, |
| 1423 | .maxlen = sizeof(vdso32_enabled), |
| 1424 | #else |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1425 | .data = &vdso_enabled, |
| 1426 | .maxlen = sizeof(vdso_enabled), |
Andy Lutomirski | 3d7ee96 | 2014-05-05 12:19:32 -0700 | [diff] [blame] | 1427 | #endif |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1428 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1429 | .proc_handler = proc_dointvec, |
Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 1430 | .extra1 = &zero, |
| 1431 | }, |
| 1432 | #endif |
Bron Gondwana | 195cf453 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1433 | #ifdef CONFIG_HIGHMEM |
| 1434 | { |
Bron Gondwana | 195cf453 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1435 | .procname = "highmem_is_dirtyable", |
| 1436 | .data = &vm_highmem_is_dirtyable, |
| 1437 | .maxlen = sizeof(vm_highmem_is_dirtyable), |
| 1438 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1439 | .proc_handler = proc_dointvec_minmax, |
Bron Gondwana | 195cf453 | 2008-02-04 22:29:20 -0800 | [diff] [blame] | 1440 | .extra1 = &zero, |
| 1441 | .extra2 = &one, |
| 1442 | }, |
| 1443 | #endif |
Peter Zijlstra | 4be6f6b | 2009-04-13 14:39:33 -0700 | [diff] [blame] | 1444 | { |
Peter Zijlstra | 4be6f6b | 2009-04-13 14:39:33 -0700 | [diff] [blame] | 1445 | .procname = "scan_unevictable_pages", |
| 1446 | .data = &scan_unevictable_pages, |
| 1447 | .maxlen = sizeof(scan_unevictable_pages), |
| 1448 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1449 | .proc_handler = scan_unevictable_handler, |
Peter Zijlstra | 4be6f6b | 2009-04-13 14:39:33 -0700 | [diff] [blame] | 1450 | }, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1451 | #ifdef CONFIG_MEMORY_FAILURE |
| 1452 | { |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1453 | .procname = "memory_failure_early_kill", |
| 1454 | .data = &sysctl_memory_failure_early_kill, |
| 1455 | .maxlen = sizeof(sysctl_memory_failure_early_kill), |
| 1456 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1457 | .proc_handler = proc_dointvec_minmax, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1458 | .extra1 = &zero, |
| 1459 | .extra2 = &one, |
| 1460 | }, |
| 1461 | { |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1462 | .procname = "memory_failure_recovery", |
| 1463 | .data = &sysctl_memory_failure_recovery, |
| 1464 | .maxlen = sizeof(sysctl_memory_failure_recovery), |
| 1465 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1466 | .proc_handler = proc_dointvec_minmax, |
Andi Kleen | 6a46079 | 2009-09-16 11:50:15 +0200 | [diff] [blame] | 1467 | .extra1 = &zero, |
| 1468 | .extra2 = &one, |
| 1469 | }, |
| 1470 | #endif |
Andrew Shewmaker | c9b1d09 | 2013-04-29 15:08:10 -0700 | [diff] [blame] | 1471 | { |
| 1472 | .procname = "user_reserve_kbytes", |
| 1473 | .data = &sysctl_user_reserve_kbytes, |
| 1474 | .maxlen = sizeof(sysctl_user_reserve_kbytes), |
| 1475 | .mode = 0644, |
| 1476 | .proc_handler = proc_doulongvec_minmax, |
| 1477 | }, |
Andrew Shewmaker | 4eeab4f | 2013-04-29 15:08:11 -0700 | [diff] [blame] | 1478 | { |
| 1479 | .procname = "admin_reserve_kbytes", |
| 1480 | .data = &sysctl_admin_reserve_kbytes, |
| 1481 | .maxlen = sizeof(sysctl_admin_reserve_kbytes), |
| 1482 | .mode = 0644, |
| 1483 | .proc_handler = proc_doulongvec_minmax, |
| 1484 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1485 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1486 | }; |
| 1487 | |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1488 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1489 | static struct ctl_table binfmt_misc_table[] = { |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1490 | { } |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1491 | }; |
| 1492 | #endif |
| 1493 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1494 | static struct ctl_table fs_table[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1495 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1496 | .procname = "inode-nr", |
| 1497 | .data = &inodes_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1498 | .maxlen = 2*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1499 | .mode = 0444, |
Dave Chinner | cffbc8a | 2010-10-23 05:03:02 -0400 | [diff] [blame] | 1500 | .proc_handler = proc_nr_inodes, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1501 | }, |
| 1502 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1503 | .procname = "inode-state", |
| 1504 | .data = &inodes_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1505 | .maxlen = 7*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1506 | .mode = 0444, |
Dave Chinner | cffbc8a | 2010-10-23 05:03:02 -0400 | [diff] [blame] | 1507 | .proc_handler = proc_nr_inodes, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1508 | }, |
| 1509 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | .procname = "file-nr", |
| 1511 | .data = &files_stat, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1512 | .maxlen = sizeof(files_stat), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1513 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1514 | .proc_handler = proc_nr_files, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1515 | }, |
| 1516 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1517 | .procname = "file-max", |
| 1518 | .data = &files_stat.max_files, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1519 | .maxlen = sizeof(files_stat.max_files), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1520 | .mode = 0644, |
Eric Dumazet | 518de9b | 2010-10-26 14:22:44 -0700 | [diff] [blame] | 1521 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1522 | }, |
| 1523 | { |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1524 | .procname = "nr_open", |
| 1525 | .data = &sysctl_nr_open, |
| 1526 | .maxlen = sizeof(int), |
| 1527 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1528 | .proc_handler = proc_dointvec_minmax, |
Al Viro | eceea0b | 2008-05-10 10:08:32 -0400 | [diff] [blame] | 1529 | .extra1 = &sysctl_nr_open_min, |
| 1530 | .extra2 = &sysctl_nr_open_max, |
Eric Dumazet | 9cfe015 | 2008-02-06 01:37:16 -0800 | [diff] [blame] | 1531 | }, |
| 1532 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1533 | .procname = "dentry-state", |
| 1534 | .data = &dentry_stat, |
Glauber Costa | 3942c07 | 2013-08-28 10:17:53 +1000 | [diff] [blame] | 1535 | .maxlen = 6*sizeof(long), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1536 | .mode = 0444, |
Christoph Hellwig | 312d3ca | 2010-10-10 05:36:23 -0400 | [diff] [blame] | 1537 | .proc_handler = proc_nr_dentry, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1538 | }, |
| 1539 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1540 | .procname = "overflowuid", |
| 1541 | .data = &fs_overflowuid, |
| 1542 | .maxlen = sizeof(int), |
| 1543 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1544 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1545 | .extra1 = &minolduid, |
| 1546 | .extra2 = &maxolduid, |
| 1547 | }, |
| 1548 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1549 | .procname = "overflowgid", |
| 1550 | .data = &fs_overflowgid, |
| 1551 | .maxlen = sizeof(int), |
| 1552 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1553 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1554 | .extra1 = &minolduid, |
| 1555 | .extra2 = &maxolduid, |
| 1556 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1557 | #ifdef CONFIG_FILE_LOCKING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1558 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1559 | .procname = "leases-enable", |
| 1560 | .data = &leases_enable, |
| 1561 | .maxlen = sizeof(int), |
| 1562 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1563 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1564 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1565 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1566 | #ifdef CONFIG_DNOTIFY |
| 1567 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1568 | .procname = "dir-notify-enable", |
| 1569 | .data = &dir_notify_enable, |
| 1570 | .maxlen = sizeof(int), |
| 1571 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1572 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1573 | }, |
| 1574 | #endif |
| 1575 | #ifdef CONFIG_MMU |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1576 | #ifdef CONFIG_FILE_LOCKING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1577 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1578 | .procname = "lease-break-time", |
| 1579 | .data = &lease_break_time, |
| 1580 | .maxlen = sizeof(int), |
| 1581 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1582 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1583 | }, |
Thomas Petazzoni | bfcd17a | 2008-08-06 15:12:22 +0200 | [diff] [blame] | 1584 | #endif |
Thomas Petazzoni | ebf3f09 | 2008-10-15 22:05:12 -0700 | [diff] [blame] | 1585 | #ifdef CONFIG_AIO |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1586 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1587 | .procname = "aio-nr", |
| 1588 | .data = &aio_nr, |
| 1589 | .maxlen = sizeof(aio_nr), |
| 1590 | .mode = 0444, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1591 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1592 | }, |
| 1593 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1594 | .procname = "aio-max-nr", |
| 1595 | .data = &aio_max_nr, |
| 1596 | .maxlen = sizeof(aio_max_nr), |
| 1597 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 1598 | .proc_handler = proc_doulongvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1599 | }, |
Thomas Petazzoni | ebf3f09 | 2008-10-15 22:05:12 -0700 | [diff] [blame] | 1600 | #endif /* CONFIG_AIO */ |
Amy Griffis | 2d9048e | 2006-06-01 13:10:59 -0700 | [diff] [blame] | 1601 | #ifdef CONFIG_INOTIFY_USER |
Robert Love | 0399cb0 | 2005-07-13 12:38:18 -0400 | [diff] [blame] | 1602 | { |
Robert Love | 0399cb0 | 2005-07-13 12:38:18 -0400 | [diff] [blame] | 1603 | .procname = "inotify", |
| 1604 | .mode = 0555, |
| 1605 | .child = inotify_table, |
| 1606 | }, |
| 1607 | #endif |
Davide Libenzi | 7ef9964 | 2008-12-01 13:13:55 -0800 | [diff] [blame] | 1608 | #ifdef CONFIG_EPOLL |
| 1609 | { |
| 1610 | .procname = "epoll", |
| 1611 | .mode = 0555, |
| 1612 | .child = epoll_table, |
| 1613 | }, |
| 1614 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1615 | #endif |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1616 | { |
Kees Cook | 800179c | 2012-07-25 17:29:07 -0700 | [diff] [blame] | 1617 | .procname = "protected_symlinks", |
| 1618 | .data = &sysctl_protected_symlinks, |
| 1619 | .maxlen = sizeof(int), |
| 1620 | .mode = 0600, |
| 1621 | .proc_handler = proc_dointvec_minmax, |
| 1622 | .extra1 = &zero, |
| 1623 | .extra2 = &one, |
| 1624 | }, |
| 1625 | { |
| 1626 | .procname = "protected_hardlinks", |
| 1627 | .data = &sysctl_protected_hardlinks, |
| 1628 | .maxlen = sizeof(int), |
| 1629 | .mode = 0600, |
| 1630 | .proc_handler = proc_dointvec_minmax, |
| 1631 | .extra1 = &zero, |
| 1632 | .extra2 = &one, |
| 1633 | }, |
| 1634 | { |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1635 | .procname = "suid_dumpable", |
| 1636 | .data = &suid_dumpable, |
| 1637 | .maxlen = sizeof(int), |
| 1638 | .mode = 0644, |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 1639 | .proc_handler = proc_dointvec_minmax_coredump, |
Matthew Wilcox | 8e654fb | 2009-04-02 16:58:33 -0700 | [diff] [blame] | 1640 | .extra1 = &zero, |
| 1641 | .extra2 = &two, |
Alan Cox | d6e7114 | 2005-06-23 00:09:43 -0700 | [diff] [blame] | 1642 | }, |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1643 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
| 1644 | { |
Eric W. Biederman | 2abc26f | 2007-02-14 00:34:07 -0800 | [diff] [blame] | 1645 | .procname = "binfmt_misc", |
| 1646 | .mode = 0555, |
| 1647 | .child = binfmt_misc_table, |
| 1648 | }, |
| 1649 | #endif |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1650 | { |
Jens Axboe | ff9da69 | 2010-06-03 14:54:39 +0200 | [diff] [blame] | 1651 | .procname = "pipe-max-size", |
| 1652 | .data = &pipe_max_size, |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1653 | .maxlen = sizeof(int), |
| 1654 | .mode = 0644, |
Jens Axboe | ff9da69 | 2010-06-03 14:54:39 +0200 | [diff] [blame] | 1655 | .proc_handler = &pipe_proc_fn, |
| 1656 | .extra1 = &pipe_min_size, |
Jens Axboe | b492e95 | 2010-05-19 21:03:16 +0200 | [diff] [blame] | 1657 | }, |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1658 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1659 | }; |
| 1660 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1661 | static struct ctl_table debug_table[] = { |
Catalin Marinas | 7ac57a8 | 2012-10-08 16:28:16 -0700 | [diff] [blame] | 1662 | #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE |
Masoud Asgharifard Sharbiani | abd4f75 | 2007-07-22 11:12:28 +0200 | [diff] [blame] | 1663 | { |
Masoud Asgharifard Sharbiani | abd4f75 | 2007-07-22 11:12:28 +0200 | [diff] [blame] | 1664 | .procname = "exception-trace", |
| 1665 | .data = &show_unhandled_signals, |
| 1666 | .maxlen = sizeof(int), |
| 1667 | .mode = 0644, |
| 1668 | .proc_handler = proc_dointvec |
| 1669 | }, |
| 1670 | #endif |
Masami Hiramatsu | b2be84d | 2010-02-25 08:34:15 -0500 | [diff] [blame] | 1671 | #if defined(CONFIG_OPTPROBES) |
| 1672 | { |
| 1673 | .procname = "kprobes-optimization", |
| 1674 | .data = &sysctl_kprobes_optimization, |
| 1675 | .maxlen = sizeof(int), |
| 1676 | .mode = 0644, |
| 1677 | .proc_handler = proc_kprobes_optimization_handler, |
| 1678 | .extra1 = &zero, |
| 1679 | .extra2 = &one, |
| 1680 | }, |
| 1681 | #endif |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1682 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | }; |
| 1684 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1685 | static struct ctl_table dev_table[] = { |
Eric W. Biederman | 6fce56e | 2009-04-03 02:30:53 -0700 | [diff] [blame] | 1686 | { } |
Robert Love | 0eeca28 | 2005-07-12 17:06:03 -0400 | [diff] [blame] | 1687 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1688 | |
Eric W. Biederman | de4e83bd | 2012-01-06 03:34:20 -0800 | [diff] [blame] | 1689 | int __init sysctl_init(void) |
Al Viro | 330d57f | 2005-11-04 10:18:40 +0000 | [diff] [blame] | 1690 | { |
Steven Rostedt | fd4b616 | 2012-07-30 14:42:48 -0700 | [diff] [blame] | 1691 | struct ctl_table_header *hdr; |
| 1692 | |
| 1693 | hdr = register_sysctl_table(sysctl_base_table); |
| 1694 | kmemleak_not_leak(hdr); |
Eric W. Biederman | d912b0c | 2007-02-14 00:34:13 -0800 | [diff] [blame] | 1695 | return 0; |
| 1696 | } |
| 1697 | |
Eric W. Biederman | b89a817 | 2006-09-27 01:51:04 -0700 | [diff] [blame] | 1698 | #endif /* CONFIG_SYSCTL */ |
| 1699 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1700 | /* |
| 1701 | * /proc/sys support |
| 1702 | */ |
| 1703 | |
Eric W. Biederman | b89a817 | 2006-09-27 01:51:04 -0700 | [diff] [blame] | 1704 | #ifdef CONFIG_PROC_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1705 | |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame^] | 1706 | static int _proc_do_string(char *data, int maxlen, int write, |
| 1707 | char __user *buffer, |
Adrian Bunk | b1ba4dd | 2006-10-02 02:18:05 -0700 | [diff] [blame] | 1708 | size_t *lenp, loff_t *ppos) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1709 | { |
| 1710 | size_t len; |
| 1711 | char __user *p; |
| 1712 | char c; |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1713 | |
| 1714 | if (!data || !maxlen || !*lenp) { |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1715 | *lenp = 0; |
| 1716 | return 0; |
| 1717 | } |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1718 | |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1719 | if (write) { |
| 1720 | len = 0; |
| 1721 | p = buffer; |
| 1722 | while (len < *lenp) { |
| 1723 | if (get_user(c, p++)) |
| 1724 | return -EFAULT; |
| 1725 | if (c == 0 || c == '\n') |
| 1726 | break; |
| 1727 | len++; |
| 1728 | } |
| 1729 | if (len >= maxlen) |
| 1730 | len = maxlen-1; |
| 1731 | if(copy_from_user(data, buffer, len)) |
| 1732 | return -EFAULT; |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame^] | 1733 | data[len] = 0; |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1734 | *ppos += *lenp; |
| 1735 | } else { |
| 1736 | len = strlen(data); |
| 1737 | if (len > maxlen) |
| 1738 | len = maxlen; |
Oleg Nesterov | 8d06087 | 2007-02-10 01:46:38 -0800 | [diff] [blame] | 1739 | |
| 1740 | if (*ppos > len) { |
| 1741 | *lenp = 0; |
| 1742 | return 0; |
| 1743 | } |
| 1744 | |
| 1745 | data += *ppos; |
| 1746 | len -= *ppos; |
| 1747 | |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1748 | if (len > *lenp) |
| 1749 | len = *lenp; |
| 1750 | if (len) |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame^] | 1751 | if (copy_to_user(buffer, data, len)) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1752 | return -EFAULT; |
| 1753 | if (len < *lenp) { |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame^] | 1754 | if (put_user('\n', buffer + len)) |
Sam Vilain | f5dd3d6 | 2006-10-02 02:18:04 -0700 | [diff] [blame] | 1755 | return -EFAULT; |
| 1756 | len++; |
| 1757 | } |
| 1758 | *lenp = len; |
| 1759 | *ppos += len; |
| 1760 | } |
| 1761 | return 0; |
| 1762 | } |
| 1763 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1764 | /** |
| 1765 | * proc_dostring - read a string sysctl |
| 1766 | * @table: the sysctl table |
| 1767 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1768 | * @buffer: the user buffer |
| 1769 | * @lenp: the size of the user buffer |
| 1770 | * @ppos: file position |
| 1771 | * |
| 1772 | * Reads/writes a string from/to the user buffer. If the kernel |
| 1773 | * buffer provided is not large enough to hold the string, the |
| 1774 | * string is truncated. The copied string is %NULL-terminated. |
| 1775 | * If the string is being read by the user process, it is copied |
| 1776 | * and a newline '\n' is added. It is truncated if the buffer is |
| 1777 | * not large enough. |
| 1778 | * |
| 1779 | * Returns 0 on success. |
| 1780 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 1781 | int proc_dostring(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1782 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 1783 | { |
Kees Cook | f880830 | 2014-06-06 14:37:17 -0700 | [diff] [blame^] | 1784 | return _proc_do_string((char *)(table->data), table->maxlen, write, |
| 1785 | (char __user *)buffer, lenp, ppos); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1786 | } |
| 1787 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1788 | static size_t proc_skip_spaces(char **buf) |
| 1789 | { |
| 1790 | size_t ret; |
| 1791 | char *tmp = skip_spaces(*buf); |
| 1792 | ret = tmp - *buf; |
| 1793 | *buf = tmp; |
| 1794 | return ret; |
| 1795 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1796 | |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 1797 | static void proc_skip_char(char **buf, size_t *size, const char v) |
| 1798 | { |
| 1799 | while (*size) { |
| 1800 | if (**buf != v) |
| 1801 | break; |
| 1802 | (*size)--; |
| 1803 | (*buf)++; |
| 1804 | } |
| 1805 | } |
| 1806 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1807 | #define TMPBUFLEN 22 |
| 1808 | /** |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1809 | * proc_get_long - reads an ASCII formatted integer from a user buffer |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1810 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1811 | * @buf: a kernel buffer |
| 1812 | * @size: size of the kernel buffer |
| 1813 | * @val: this is where the number will be stored |
| 1814 | * @neg: set to %TRUE if number is negative |
| 1815 | * @perm_tr: a vector which contains the allowed trailers |
| 1816 | * @perm_tr_len: size of the perm_tr vector |
| 1817 | * @tr: pointer to store the trailer character |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1818 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1819 | * In case of success %0 is returned and @buf and @size are updated with |
| 1820 | * the amount of bytes read. If @tr is non-NULL and a trailing |
| 1821 | * character exists (size is non-zero after returning from this |
| 1822 | * function), @tr is updated with the trailing character. |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1823 | */ |
| 1824 | static int proc_get_long(char **buf, size_t *size, |
| 1825 | unsigned long *val, bool *neg, |
| 1826 | const char *perm_tr, unsigned perm_tr_len, char *tr) |
| 1827 | { |
| 1828 | int len; |
| 1829 | char *p, tmp[TMPBUFLEN]; |
| 1830 | |
| 1831 | if (!*size) |
| 1832 | return -EINVAL; |
| 1833 | |
| 1834 | len = *size; |
| 1835 | if (len > TMPBUFLEN - 1) |
| 1836 | len = TMPBUFLEN - 1; |
| 1837 | |
| 1838 | memcpy(tmp, *buf, len); |
| 1839 | |
| 1840 | tmp[len] = 0; |
| 1841 | p = tmp; |
| 1842 | if (*p == '-' && *size > 1) { |
| 1843 | *neg = true; |
| 1844 | p++; |
| 1845 | } else |
| 1846 | *neg = false; |
| 1847 | if (!isdigit(*p)) |
| 1848 | return -EINVAL; |
| 1849 | |
| 1850 | *val = simple_strtoul(p, &p, 0); |
| 1851 | |
| 1852 | len = p - tmp; |
| 1853 | |
| 1854 | /* We don't know if the next char is whitespace thus we may accept |
| 1855 | * invalid integers (e.g. 1234...a) or two integers instead of one |
| 1856 | * (e.g. 123...1). So lets not allow such large numbers. */ |
| 1857 | if (len == TMPBUFLEN - 1) |
| 1858 | return -EINVAL; |
| 1859 | |
| 1860 | if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len)) |
| 1861 | return -EINVAL; |
| 1862 | |
| 1863 | if (tr && (len < *size)) |
| 1864 | *tr = *p; |
| 1865 | |
| 1866 | *buf += len; |
| 1867 | *size -= len; |
| 1868 | |
| 1869 | return 0; |
| 1870 | } |
| 1871 | |
| 1872 | /** |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1873 | * proc_put_long - converts an integer to a decimal ASCII formatted string |
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 | * @buf: the user buffer |
| 1876 | * @size: the size of the user buffer |
| 1877 | * @val: the integer to be converted |
| 1878 | * @neg: sign of the number, %TRUE for negative |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1879 | * |
Randy Dunlap | 0fc377b | 2010-05-21 11:29:53 -0700 | [diff] [blame] | 1880 | * In case of success %0 is returned and @buf and @size are updated with |
| 1881 | * the amount of bytes written. |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1882 | */ |
| 1883 | static int proc_put_long(void __user **buf, size_t *size, unsigned long val, |
| 1884 | bool neg) |
| 1885 | { |
| 1886 | int len; |
| 1887 | char tmp[TMPBUFLEN], *p = tmp; |
| 1888 | |
| 1889 | sprintf(p, "%s%lu", neg ? "-" : "", val); |
| 1890 | len = strlen(tmp); |
| 1891 | if (len > *size) |
| 1892 | len = *size; |
| 1893 | if (copy_to_user(*buf, tmp, len)) |
| 1894 | return -EFAULT; |
| 1895 | *size -= len; |
| 1896 | *buf += len; |
| 1897 | return 0; |
| 1898 | } |
| 1899 | #undef TMPBUFLEN |
| 1900 | |
| 1901 | static int proc_put_char(void __user **buf, size_t *size, char c) |
| 1902 | { |
| 1903 | if (*size) { |
| 1904 | char __user **buffer = (char __user **)buf; |
| 1905 | if (put_user(c, *buffer)) |
| 1906 | return -EFAULT; |
| 1907 | (*size)--, (*buffer)++; |
| 1908 | *buf = *buffer; |
| 1909 | } |
| 1910 | return 0; |
| 1911 | } |
| 1912 | |
| 1913 | static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1914 | int *valp, |
| 1915 | int write, void *data) |
| 1916 | { |
| 1917 | if (write) { |
| 1918 | *valp = *negp ? -*lvalp : *lvalp; |
| 1919 | } else { |
| 1920 | int val = *valp; |
| 1921 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1922 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1923 | *lvalp = (unsigned long)-val; |
| 1924 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1925 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1926 | *lvalp = (unsigned long)val; |
| 1927 | } |
| 1928 | } |
| 1929 | return 0; |
| 1930 | } |
| 1931 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1932 | static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; |
| 1933 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 1934 | static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 1935 | int write, void __user *buffer, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 1936 | size_t *lenp, loff_t *ppos, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1937 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1938 | int write, void *data), |
| 1939 | void *data) |
| 1940 | { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1941 | int *i, vleft, first = 1, err = 0; |
| 1942 | unsigned long page = 0; |
| 1943 | size_t left; |
| 1944 | char *kbuf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1945 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1946 | if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1947 | *lenp = 0; |
| 1948 | return 0; |
| 1949 | } |
| 1950 | |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 1951 | i = (int *) tbl_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1952 | vleft = table->maxlen / sizeof(*i); |
| 1953 | left = *lenp; |
| 1954 | |
| 1955 | if (!conv) |
| 1956 | conv = do_proc_dointvec_conv; |
| 1957 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1958 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1959 | if (left > PAGE_SIZE - 1) |
| 1960 | left = PAGE_SIZE - 1; |
| 1961 | page = __get_free_page(GFP_TEMPORARY); |
| 1962 | kbuf = (char *) page; |
| 1963 | if (!kbuf) |
| 1964 | return -ENOMEM; |
| 1965 | if (copy_from_user(kbuf, buffer, left)) { |
| 1966 | err = -EFAULT; |
| 1967 | goto free; |
| 1968 | } |
| 1969 | kbuf[left] = 0; |
| 1970 | } |
| 1971 | |
| 1972 | for (; left && vleft--; i++, first=0) { |
| 1973 | unsigned long lval; |
| 1974 | bool neg; |
| 1975 | |
| 1976 | if (write) { |
| 1977 | left -= proc_skip_spaces(&kbuf); |
| 1978 | |
J. R. Okajima | 563b046 | 2010-05-25 16:10:14 -0700 | [diff] [blame] | 1979 | if (!left) |
| 1980 | break; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1981 | err = proc_get_long(&kbuf, &left, &lval, &neg, |
| 1982 | proc_wspace_sep, |
| 1983 | sizeof(proc_wspace_sep), NULL); |
| 1984 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1985 | break; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 1986 | if (conv(&neg, &lval, i, 1, data)) { |
| 1987 | err = -EINVAL; |
| 1988 | break; |
| 1989 | } |
| 1990 | } else { |
| 1991 | if (conv(&neg, &lval, i, 0, data)) { |
| 1992 | err = -EINVAL; |
| 1993 | break; |
| 1994 | } |
| 1995 | if (!first) |
| 1996 | err = proc_put_char(&buffer, &left, '\t'); |
| 1997 | if (err) |
| 1998 | break; |
| 1999 | err = proc_put_long(&buffer, &left, lval, neg); |
| 2000 | if (err) |
| 2001 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2002 | } |
| 2003 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2004 | |
| 2005 | if (!write && !first && left && !err) |
| 2006 | err = proc_put_char(&buffer, &left, '\n'); |
J. R. Okajima | 563b046 | 2010-05-25 16:10:14 -0700 | [diff] [blame] | 2007 | if (write && !err && left) |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2008 | left -= proc_skip_spaces(&kbuf); |
| 2009 | free: |
| 2010 | if (write) { |
| 2011 | free_page(page); |
| 2012 | if (first) |
| 2013 | return err ? : -EINVAL; |
| 2014 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2015 | *lenp -= left; |
| 2016 | *ppos += *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2017 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2018 | } |
| 2019 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2020 | static int do_proc_dointvec(struct ctl_table *table, int write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2021 | void __user *buffer, size_t *lenp, loff_t *ppos, |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2022 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2023 | int write, void *data), |
| 2024 | void *data) |
| 2025 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2026 | return __do_proc_dointvec(table->data, table, write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2027 | buffer, lenp, ppos, conv, data); |
| 2028 | } |
| 2029 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2030 | /** |
| 2031 | * proc_dointvec - read a vector of integers |
| 2032 | * @table: the sysctl table |
| 2033 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | * @buffer: the user buffer |
| 2035 | * @lenp: the size of the user buffer |
| 2036 | * @ppos: file position |
| 2037 | * |
| 2038 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2039 | * values from/to the user buffer, treated as an ASCII string. |
| 2040 | * |
| 2041 | * Returns 0 on success. |
| 2042 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2043 | int proc_dointvec(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2044 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2045 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2046 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2047 | NULL,NULL); |
| 2048 | } |
| 2049 | |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2050 | /* |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2051 | * Taint values can only be increased |
| 2052 | * This means we can safely use a temporary. |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2053 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2054 | static int proc_taint(struct ctl_table *table, int write, |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2055 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2056 | { |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2057 | struct ctl_table t; |
| 2058 | unsigned long tmptaint = get_taint(); |
| 2059 | int err; |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2060 | |
Bastian Blank | 91fcd41 | 2007-04-23 14:41:14 -0700 | [diff] [blame] | 2061 | if (write && !capable(CAP_SYS_ADMIN)) |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2062 | return -EPERM; |
| 2063 | |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2064 | t = *table; |
| 2065 | t.data = &tmptaint; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2066 | err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2067 | if (err < 0) |
| 2068 | return err; |
| 2069 | |
| 2070 | if (write) { |
| 2071 | /* |
| 2072 | * Poor man's atomic or. Not worth adding a primitive |
| 2073 | * to everyone's atomic.h for this |
| 2074 | */ |
| 2075 | int i; |
| 2076 | for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) { |
| 2077 | if ((tmptaint >> i) & 1) |
Rusty Russell | 373d4d0 | 2013-01-21 17:17:39 +1030 | [diff] [blame] | 2078 | add_taint(i, LOCKDEP_STILL_OK); |
Andi Kleen | 25ddbb1 | 2008-10-15 22:01:41 -0700 | [diff] [blame] | 2079 | } |
| 2080 | } |
| 2081 | |
| 2082 | return err; |
Theodore Ts'o | 34f5a39 | 2007-02-10 01:45:24 -0800 | [diff] [blame] | 2083 | } |
| 2084 | |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 2085 | #ifdef CONFIG_PRINTK |
Kees Cook | 620f6e8 | 2012-04-04 11:40:19 -0700 | [diff] [blame] | 2086 | static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, |
Richard Weinberger | bfdc0b4 | 2011-03-23 16:43:11 -0700 | [diff] [blame] | 2087 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2088 | { |
| 2089 | if (write && !capable(CAP_SYS_ADMIN)) |
| 2090 | return -EPERM; |
| 2091 | |
| 2092 | return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 2093 | } |
| 2094 | #endif |
| 2095 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2096 | struct do_proc_dointvec_minmax_conv_param { |
| 2097 | int *min; |
| 2098 | int *max; |
| 2099 | }; |
| 2100 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2101 | static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, |
| 2102 | int *valp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2103 | int write, void *data) |
| 2104 | { |
| 2105 | struct do_proc_dointvec_minmax_conv_param *param = data; |
| 2106 | if (write) { |
| 2107 | int val = *negp ? -*lvalp : *lvalp; |
| 2108 | if ((param->min && *param->min > val) || |
| 2109 | (param->max && *param->max < val)) |
| 2110 | return -EINVAL; |
| 2111 | *valp = val; |
| 2112 | } else { |
| 2113 | int val = *valp; |
| 2114 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2115 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2116 | *lvalp = (unsigned long)-val; |
| 2117 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2118 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2119 | *lvalp = (unsigned long)val; |
| 2120 | } |
| 2121 | } |
| 2122 | return 0; |
| 2123 | } |
| 2124 | |
| 2125 | /** |
| 2126 | * proc_dointvec_minmax - read a vector of integers with min/max values |
| 2127 | * @table: the sysctl table |
| 2128 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2129 | * @buffer: the user buffer |
| 2130 | * @lenp: the size of the user buffer |
| 2131 | * @ppos: file position |
| 2132 | * |
| 2133 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2134 | * values from/to the user buffer, treated as an ASCII string. |
| 2135 | * |
| 2136 | * This routine will ensure the values are within the range specified by |
| 2137 | * table->extra1 (min) and table->extra2 (max). |
| 2138 | * |
| 2139 | * Returns 0 on success. |
| 2140 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2141 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2142 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2143 | { |
| 2144 | struct do_proc_dointvec_minmax_conv_param param = { |
| 2145 | .min = (int *) table->extra1, |
| 2146 | .max = (int *) table->extra2, |
| 2147 | }; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2148 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2149 | do_proc_dointvec_minmax_conv, ¶m); |
| 2150 | } |
| 2151 | |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2152 | static void validate_coredump_safety(void) |
| 2153 | { |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2154 | #ifdef CONFIG_COREDUMP |
Kees Cook | e579d2c | 2013-02-27 17:03:15 -0800 | [diff] [blame] | 2155 | if (suid_dumpable == SUID_DUMP_ROOT && |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2156 | core_pattern[0] != '/' && core_pattern[0] != '|') { |
| 2157 | printk(KERN_WARNING "Unsafe core_pattern used with "\ |
| 2158 | "suid_dumpable=2. Pipe handler or fully qualified "\ |
| 2159 | "core dump path required.\n"); |
| 2160 | } |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2161 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2162 | } |
| 2163 | |
| 2164 | static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write, |
| 2165 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2166 | { |
| 2167 | int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 2168 | if (!error) |
| 2169 | validate_coredump_safety(); |
| 2170 | return error; |
| 2171 | } |
| 2172 | |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2173 | #ifdef CONFIG_COREDUMP |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2174 | static int proc_dostring_coredump(struct ctl_table *table, int write, |
| 2175 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2176 | { |
| 2177 | int error = proc_dostring(table, write, buffer, lenp, ppos); |
| 2178 | if (!error) |
| 2179 | validate_coredump_safety(); |
| 2180 | return error; |
| 2181 | } |
Alex Kelly | 046d662 | 2012-10-04 17:15:23 -0700 | [diff] [blame] | 2182 | #endif |
Kees Cook | 54b5019 | 2012-07-30 14:39:18 -0700 | [diff] [blame] | 2183 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2184 | 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] | 2185 | void __user *buffer, |
| 2186 | size_t *lenp, loff_t *ppos, |
| 2187 | unsigned long convmul, |
| 2188 | unsigned long convdiv) |
| 2189 | { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2190 | unsigned long *i, *min, *max; |
| 2191 | int vleft, first = 1, err = 0; |
| 2192 | unsigned long page = 0; |
| 2193 | size_t left; |
| 2194 | char *kbuf; |
| 2195 | |
| 2196 | if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2197 | *lenp = 0; |
| 2198 | return 0; |
| 2199 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2200 | |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2201 | i = (unsigned long *) data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2202 | min = (unsigned long *) table->extra1; |
| 2203 | max = (unsigned long *) table->extra2; |
| 2204 | vleft = table->maxlen / sizeof(unsigned long); |
| 2205 | left = *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2206 | |
| 2207 | if (write) { |
| 2208 | if (left > PAGE_SIZE - 1) |
| 2209 | left = PAGE_SIZE - 1; |
| 2210 | page = __get_free_page(GFP_TEMPORARY); |
| 2211 | kbuf = (char *) page; |
| 2212 | if (!kbuf) |
| 2213 | return -ENOMEM; |
| 2214 | if (copy_from_user(kbuf, buffer, left)) { |
| 2215 | err = -EFAULT; |
| 2216 | goto free; |
| 2217 | } |
| 2218 | kbuf[left] = 0; |
| 2219 | } |
| 2220 | |
Eric Dumazet | 27b3d80 | 2010-10-07 12:59:29 -0700 | [diff] [blame] | 2221 | for (; left && vleft--; i++, first = 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2222 | unsigned long val; |
| 2223 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2224 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2225 | bool neg; |
| 2226 | |
| 2227 | left -= proc_skip_spaces(&kbuf); |
| 2228 | |
| 2229 | err = proc_get_long(&kbuf, &left, &val, &neg, |
| 2230 | proc_wspace_sep, |
| 2231 | sizeof(proc_wspace_sep), NULL); |
| 2232 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2233 | break; |
| 2234 | if (neg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2235 | continue; |
| 2236 | if ((min && val < *min) || (max && val > *max)) |
| 2237 | continue; |
| 2238 | *i = val; |
| 2239 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2240 | val = convdiv * (*i) / convmul; |
Chen Gang | 7833819 | 2013-11-12 15:11:21 -0800 | [diff] [blame] | 2241 | if (!first) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2242 | err = proc_put_char(&buffer, &left, '\t'); |
Chen Gang | 7833819 | 2013-11-12 15:11:21 -0800 | [diff] [blame] | 2243 | if (err) |
| 2244 | break; |
| 2245 | } |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2246 | err = proc_put_long(&buffer, &left, val, false); |
| 2247 | if (err) |
| 2248 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2249 | } |
| 2250 | } |
| 2251 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2252 | if (!write && !first && left && !err) |
| 2253 | err = proc_put_char(&buffer, &left, '\n'); |
| 2254 | if (write && !err) |
| 2255 | left -= proc_skip_spaces(&kbuf); |
| 2256 | free: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2257 | if (write) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2258 | free_page(page); |
| 2259 | if (first) |
| 2260 | return err ? : -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2261 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2262 | *lenp -= left; |
| 2263 | *ppos += *lenp; |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2264 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2265 | } |
| 2266 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2267 | static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2268 | void __user *buffer, |
| 2269 | size_t *lenp, loff_t *ppos, |
| 2270 | unsigned long convmul, |
| 2271 | unsigned long convdiv) |
| 2272 | { |
| 2273 | return __do_proc_doulongvec_minmax(table->data, table, write, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2274 | buffer, lenp, ppos, convmul, convdiv); |
Kirill Korotaev | fcfbd54 | 2006-10-02 02:18:23 -0700 | [diff] [blame] | 2275 | } |
| 2276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2277 | /** |
| 2278 | * proc_doulongvec_minmax - read a vector of long integers with min/max values |
| 2279 | * @table: the sysctl table |
| 2280 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2281 | * @buffer: the user buffer |
| 2282 | * @lenp: the size of the user buffer |
| 2283 | * @ppos: file position |
| 2284 | * |
| 2285 | * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long |
| 2286 | * values from/to the user buffer, treated as an ASCII string. |
| 2287 | * |
| 2288 | * This routine will ensure the values are within the range specified by |
| 2289 | * table->extra1 (min) and table->extra2 (max). |
| 2290 | * |
| 2291 | * Returns 0 on success. |
| 2292 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2293 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2294 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2295 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2296 | return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2297 | } |
| 2298 | |
| 2299 | /** |
| 2300 | * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values |
| 2301 | * @table: the sysctl table |
| 2302 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2303 | * @buffer: the user buffer |
| 2304 | * @lenp: the size of the user buffer |
| 2305 | * @ppos: file position |
| 2306 | * |
| 2307 | * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long |
| 2308 | * values from/to the user buffer, treated as an ASCII string. The values |
| 2309 | * are treated as milliseconds, and converted to jiffies when they are stored. |
| 2310 | * |
| 2311 | * This routine will ensure the values are within the range specified by |
| 2312 | * table->extra1 (min) and table->extra2 (max). |
| 2313 | * |
| 2314 | * Returns 0 on success. |
| 2315 | */ |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2316 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2317 | void __user *buffer, |
| 2318 | size_t *lenp, loff_t *ppos) |
| 2319 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2320 | return do_proc_doulongvec_minmax(table, write, buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | lenp, ppos, HZ, 1000l); |
| 2322 | } |
| 2323 | |
| 2324 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2325 | static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2326 | int *valp, |
| 2327 | int write, void *data) |
| 2328 | { |
| 2329 | if (write) { |
Bart Samwel | cba9f33 | 2006-03-24 03:15:50 -0800 | [diff] [blame] | 2330 | if (*lvalp > LONG_MAX / HZ) |
| 2331 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2332 | *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); |
| 2333 | } else { |
| 2334 | int val = *valp; |
| 2335 | unsigned long lval; |
| 2336 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2337 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2338 | lval = (unsigned long)-val; |
| 2339 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2340 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2341 | lval = (unsigned long)val; |
| 2342 | } |
| 2343 | *lvalp = lval / HZ; |
| 2344 | } |
| 2345 | return 0; |
| 2346 | } |
| 2347 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2348 | 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] | 2349 | int *valp, |
| 2350 | int write, void *data) |
| 2351 | { |
| 2352 | if (write) { |
Bart Samwel | cba9f33 | 2006-03-24 03:15:50 -0800 | [diff] [blame] | 2353 | if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) |
| 2354 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2355 | *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); |
| 2356 | } else { |
| 2357 | int val = *valp; |
| 2358 | unsigned long lval; |
| 2359 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2360 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2361 | lval = (unsigned long)-val; |
| 2362 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2363 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2364 | lval = (unsigned long)val; |
| 2365 | } |
| 2366 | *lvalp = jiffies_to_clock_t(lval); |
| 2367 | } |
| 2368 | return 0; |
| 2369 | } |
| 2370 | |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2371 | 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] | 2372 | int *valp, |
| 2373 | int write, void *data) |
| 2374 | { |
| 2375 | if (write) { |
Francesco Fusco | d738ce8 | 2013-07-24 10:39:07 +0200 | [diff] [blame] | 2376 | unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp); |
| 2377 | |
| 2378 | if (jif > INT_MAX) |
| 2379 | return 1; |
| 2380 | *valp = (int)jif; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2381 | } else { |
| 2382 | int val = *valp; |
| 2383 | unsigned long lval; |
| 2384 | if (val < 0) { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2385 | *negp = true; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | lval = (unsigned long)-val; |
| 2387 | } else { |
Amerigo Wang | 00b7c33 | 2010-05-05 00:26:45 +0000 | [diff] [blame] | 2388 | *negp = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2389 | lval = (unsigned long)val; |
| 2390 | } |
| 2391 | *lvalp = jiffies_to_msecs(lval); |
| 2392 | } |
| 2393 | return 0; |
| 2394 | } |
| 2395 | |
| 2396 | /** |
| 2397 | * proc_dointvec_jiffies - read a vector of integers as seconds |
| 2398 | * @table: the sysctl table |
| 2399 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2400 | * @buffer: the user buffer |
| 2401 | * @lenp: the size of the user buffer |
| 2402 | * @ppos: file position |
| 2403 | * |
| 2404 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2405 | * values from/to the user buffer, treated as an ASCII string. |
| 2406 | * The values read are assumed to be in seconds, and are converted into |
| 2407 | * jiffies. |
| 2408 | * |
| 2409 | * Returns 0 on success. |
| 2410 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2411 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2413 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2414 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2415 | do_proc_dointvec_jiffies_conv,NULL); |
| 2416 | } |
| 2417 | |
| 2418 | /** |
| 2419 | * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds |
| 2420 | * @table: the sysctl table |
| 2421 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2422 | * @buffer: the user buffer |
| 2423 | * @lenp: the size of the user buffer |
Randy Dunlap | 1e5d533 | 2005-11-07 01:01:06 -0800 | [diff] [blame] | 2424 | * @ppos: pointer to the file position |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2425 | * |
| 2426 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2427 | * values from/to the user buffer, treated as an ASCII string. |
| 2428 | * The values read are assumed to be in 1/USER_HZ seconds, and |
| 2429 | * are converted into jiffies. |
| 2430 | * |
| 2431 | * Returns 0 on success. |
| 2432 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2433 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2434 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2435 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2436 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2437 | do_proc_dointvec_userhz_jiffies_conv,NULL); |
| 2438 | } |
| 2439 | |
| 2440 | /** |
| 2441 | * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds |
| 2442 | * @table: the sysctl table |
| 2443 | * @write: %TRUE if this is a write to the sysctl file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2444 | * @buffer: the user buffer |
| 2445 | * @lenp: the size of the user buffer |
Martin Waitz | 67be2dd | 2005-05-01 08:59:26 -0700 | [diff] [blame] | 2446 | * @ppos: file position |
| 2447 | * @ppos: the current position in the file |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2448 | * |
| 2449 | * Reads/writes up to table->maxlen/sizeof(unsigned int) integer |
| 2450 | * values from/to the user buffer, treated as an ASCII string. |
| 2451 | * The values read are assumed to be in 1/1000 seconds, and |
| 2452 | * are converted into jiffies. |
| 2453 | * |
| 2454 | * Returns 0 on success. |
| 2455 | */ |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2456 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2457 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2458 | { |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2459 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2460 | do_proc_dointvec_ms_jiffies_conv, NULL); |
| 2461 | } |
| 2462 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2463 | 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] | 2464 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2465 | { |
| 2466 | struct pid *new_pid; |
| 2467 | pid_t tmp; |
| 2468 | int r; |
| 2469 | |
Pavel Emelyanov | 6c5f3e7 | 2008-02-08 04:19:20 -0800 | [diff] [blame] | 2470 | tmp = pid_vnr(cad_pid); |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2471 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2472 | r = __do_proc_dointvec(&tmp, table, write, buffer, |
Cedric Le Goater | 9ec5209 | 2006-10-02 02:19:00 -0700 | [diff] [blame] | 2473 | lenp, ppos, NULL, NULL); |
| 2474 | if (r || !write) |
| 2475 | return r; |
| 2476 | |
| 2477 | new_pid = find_get_pid(tmp); |
| 2478 | if (!new_pid) |
| 2479 | return -ESRCH; |
| 2480 | |
| 2481 | put_pid(xchg(&cad_pid, new_pid)); |
| 2482 | return 0; |
| 2483 | } |
| 2484 | |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2485 | /** |
| 2486 | * proc_do_large_bitmap - read/write from/to a large bitmap |
| 2487 | * @table: the sysctl table |
| 2488 | * @write: %TRUE if this is a write to the sysctl file |
| 2489 | * @buffer: the user buffer |
| 2490 | * @lenp: the size of the user buffer |
| 2491 | * @ppos: file position |
| 2492 | * |
| 2493 | * The bitmap is stored at table->data and the bitmap length (in bits) |
| 2494 | * in table->maxlen. |
| 2495 | * |
| 2496 | * We use a range comma separated format (e.g. 1,3-4,10-10) so that |
| 2497 | * large bitmaps may be represented in a compact manner. Writing into |
| 2498 | * the file will clear the bitmap then update it with the given input. |
| 2499 | * |
| 2500 | * Returns 0 on success. |
| 2501 | */ |
| 2502 | int proc_do_large_bitmap(struct ctl_table *table, int write, |
| 2503 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2504 | { |
| 2505 | int err = 0; |
| 2506 | bool first = 1; |
| 2507 | size_t left = *lenp; |
| 2508 | unsigned long bitmap_len = table->maxlen; |
| 2509 | unsigned long *bitmap = (unsigned long *) table->data; |
| 2510 | unsigned long *tmp_bitmap = NULL; |
| 2511 | char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c; |
| 2512 | |
| 2513 | if (!bitmap_len || !left || (*ppos && !write)) { |
| 2514 | *lenp = 0; |
| 2515 | return 0; |
| 2516 | } |
| 2517 | |
| 2518 | if (write) { |
| 2519 | unsigned long page = 0; |
| 2520 | char *kbuf; |
| 2521 | |
| 2522 | if (left > PAGE_SIZE - 1) |
| 2523 | left = PAGE_SIZE - 1; |
| 2524 | |
| 2525 | page = __get_free_page(GFP_TEMPORARY); |
| 2526 | kbuf = (char *) page; |
| 2527 | if (!kbuf) |
| 2528 | return -ENOMEM; |
| 2529 | if (copy_from_user(kbuf, buffer, left)) { |
| 2530 | free_page(page); |
| 2531 | return -EFAULT; |
| 2532 | } |
| 2533 | kbuf[left] = 0; |
| 2534 | |
| 2535 | tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long), |
| 2536 | GFP_KERNEL); |
| 2537 | if (!tmp_bitmap) { |
| 2538 | free_page(page); |
| 2539 | return -ENOMEM; |
| 2540 | } |
| 2541 | proc_skip_char(&kbuf, &left, '\n'); |
| 2542 | while (!err && left) { |
| 2543 | unsigned long val_a, val_b; |
| 2544 | bool neg; |
| 2545 | |
| 2546 | err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a, |
| 2547 | sizeof(tr_a), &c); |
| 2548 | if (err) |
| 2549 | break; |
| 2550 | if (val_a >= bitmap_len || neg) { |
| 2551 | err = -EINVAL; |
| 2552 | break; |
| 2553 | } |
| 2554 | |
| 2555 | val_b = val_a; |
| 2556 | if (left) { |
| 2557 | kbuf++; |
| 2558 | left--; |
| 2559 | } |
| 2560 | |
| 2561 | if (c == '-') { |
| 2562 | err = proc_get_long(&kbuf, &left, &val_b, |
| 2563 | &neg, tr_b, sizeof(tr_b), |
| 2564 | &c); |
| 2565 | if (err) |
| 2566 | break; |
| 2567 | if (val_b >= bitmap_len || neg || |
| 2568 | val_a > val_b) { |
| 2569 | err = -EINVAL; |
| 2570 | break; |
| 2571 | } |
| 2572 | if (left) { |
| 2573 | kbuf++; |
| 2574 | left--; |
| 2575 | } |
| 2576 | } |
| 2577 | |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 2578 | bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2579 | first = 0; |
| 2580 | proc_skip_char(&kbuf, &left, '\n'); |
| 2581 | } |
| 2582 | free_page(page); |
| 2583 | } else { |
| 2584 | unsigned long bit_a, bit_b = 0; |
| 2585 | |
| 2586 | while (left) { |
| 2587 | bit_a = find_next_bit(bitmap, bitmap_len, bit_b); |
| 2588 | if (bit_a >= bitmap_len) |
| 2589 | break; |
| 2590 | bit_b = find_next_zero_bit(bitmap, bitmap_len, |
| 2591 | bit_a + 1) - 1; |
| 2592 | |
| 2593 | if (!first) { |
| 2594 | err = proc_put_char(&buffer, &left, ','); |
| 2595 | if (err) |
| 2596 | break; |
| 2597 | } |
| 2598 | err = proc_put_long(&buffer, &left, bit_a, false); |
| 2599 | if (err) |
| 2600 | break; |
| 2601 | if (bit_a != bit_b) { |
| 2602 | err = proc_put_char(&buffer, &left, '-'); |
| 2603 | if (err) |
| 2604 | break; |
| 2605 | err = proc_put_long(&buffer, &left, bit_b, false); |
| 2606 | if (err) |
| 2607 | break; |
| 2608 | } |
| 2609 | |
| 2610 | first = 0; bit_b++; |
| 2611 | } |
| 2612 | if (!err) |
| 2613 | err = proc_put_char(&buffer, &left, '\n'); |
| 2614 | } |
| 2615 | |
| 2616 | if (!err) { |
| 2617 | if (write) { |
| 2618 | if (*ppos) |
| 2619 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); |
| 2620 | else |
Akinobu Mita | 5a04cca | 2012-03-28 14:42:50 -0700 | [diff] [blame] | 2621 | bitmap_copy(bitmap, tmp_bitmap, bitmap_len); |
Octavian Purdila | 9f977fb | 2010-05-05 00:26:55 +0000 | [diff] [blame] | 2622 | } |
| 2623 | kfree(tmp_bitmap); |
| 2624 | *lenp -= left; |
| 2625 | *ppos += *lenp; |
| 2626 | return 0; |
| 2627 | } else { |
| 2628 | kfree(tmp_bitmap); |
| 2629 | return err; |
| 2630 | } |
| 2631 | } |
| 2632 | |
Jovi Zhang | 5561050 | 2011-01-12 17:00:45 -0800 | [diff] [blame] | 2633 | #else /* CONFIG_PROC_SYSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2634 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2635 | int proc_dostring(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2636 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2637 | { |
| 2638 | return -ENOSYS; |
| 2639 | } |
| 2640 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2641 | int proc_dointvec(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2642 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2643 | { |
| 2644 | return -ENOSYS; |
| 2645 | } |
| 2646 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2647 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2648 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2649 | { |
| 2650 | return -ENOSYS; |
| 2651 | } |
| 2652 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2653 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2654 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2655 | { |
| 2656 | return -ENOSYS; |
| 2657 | } |
| 2658 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2659 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2660 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2661 | { |
| 2662 | return -ENOSYS; |
| 2663 | } |
| 2664 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2665 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2666 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2667 | { |
| 2668 | return -ENOSYS; |
| 2669 | } |
| 2670 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 2671 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2672 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 2673 | { |
| 2674 | return -ENOSYS; |
| 2675 | } |
| 2676 | |
Eric W. Biederman | d8217f0 | 2007-10-18 03:05:22 -0700 | [diff] [blame] | 2677 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2678 | void __user *buffer, |
| 2679 | size_t *lenp, loff_t *ppos) |
| 2680 | { |
| 2681 | return -ENOSYS; |
| 2682 | } |
| 2683 | |
| 2684 | |
Jovi Zhang | 5561050 | 2011-01-12 17:00:45 -0800 | [diff] [blame] | 2685 | #endif /* CONFIG_PROC_SYSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2686 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2687 | /* |
| 2688 | * No sense putting this after each symbol definition, twice, |
| 2689 | * exception granted :-) |
| 2690 | */ |
| 2691 | EXPORT_SYMBOL(proc_dointvec); |
| 2692 | EXPORT_SYMBOL(proc_dointvec_jiffies); |
| 2693 | EXPORT_SYMBOL(proc_dointvec_minmax); |
| 2694 | EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); |
| 2695 | EXPORT_SYMBOL(proc_dointvec_ms_jiffies); |
| 2696 | EXPORT_SYMBOL(proc_dostring); |
| 2697 | EXPORT_SYMBOL(proc_doulongvec_minmax); |
| 2698 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); |