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