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