diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-13 01:06:28 -0500 |
commit | f43dc23d5ea91fca257be02138a255f02d98e806 (patch) | |
tree | b29722f6e965316e90ac97abf79923ced250dc21 /kernel/sysctl.c | |
parent | f8e53553f452dcbf67cb89c8cba63a1cd6eb4cc0 (diff) | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
Conflicts:
arch/sh/kernel/cpu/sh2/setup-sh7619.c
arch/sh/kernel/cpu/sh2a/setup-mxg.c
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
arch/sh/kernel/cpu/sh3/setup-sh7705.c
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh3/setup-sh7710.c
arch/sh/kernel/cpu/sh3/setup-sh7720.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-shx3.c
arch/sh/kernel/cpu/sh5/setup-sh5.c
drivers/serial/sh-sci.c
drivers/serial/sh-sci.h
include/linux/serial_sci.h
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 1857 |
1 files changed, 819 insertions, 1038 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 62e4ff9968b5..ae5cbb1e3ced 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -23,12 +23,11 @@ | |||
23 | #include <linux/swap.h> | 23 | #include <linux/swap.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/sysctl.h> | 25 | #include <linux/sysctl.h> |
26 | #include <linux/signal.h> | ||
26 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
27 | #include <linux/security.h> | 28 | #include <linux/security.h> |
28 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
29 | #include <linux/utsname.h> | ||
30 | #include <linux/kmemcheck.h> | 30 | #include <linux/kmemcheck.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
@@ -37,20 +36,25 @@ | |||
37 | #include <linux/sysrq.h> | 36 | #include <linux/sysrq.h> |
38 | #include <linux/highuid.h> | 37 | #include <linux/highuid.h> |
39 | #include <linux/writeback.h> | 38 | #include <linux/writeback.h> |
39 | #include <linux/ratelimit.h> | ||
40 | #include <linux/compaction.h> | ||
40 | #include <linux/hugetlb.h> | 41 | #include <linux/hugetlb.h> |
41 | #include <linux/initrd.h> | 42 | #include <linux/initrd.h> |
42 | #include <linux/key.h> | 43 | #include <linux/key.h> |
43 | #include <linux/times.h> | 44 | #include <linux/times.h> |
44 | #include <linux/limits.h> | 45 | #include <linux/limits.h> |
45 | #include <linux/dcache.h> | 46 | #include <linux/dcache.h> |
47 | #include <linux/dnotify.h> | ||
46 | #include <linux/syscalls.h> | 48 | #include <linux/syscalls.h> |
47 | #include <linux/vmstat.h> | 49 | #include <linux/vmstat.h> |
48 | #include <linux/nfs_fs.h> | 50 | #include <linux/nfs_fs.h> |
49 | #include <linux/acpi.h> | 51 | #include <linux/acpi.h> |
50 | #include <linux/reboot.h> | 52 | #include <linux/reboot.h> |
51 | #include <linux/ftrace.h> | 53 | #include <linux/ftrace.h> |
52 | #include <linux/slow-work.h> | 54 | #include <linux/perf_event.h> |
53 | #include <linux/perf_counter.h> | 55 | #include <linux/kprobes.h> |
56 | #include <linux/pipe_fs_i.h> | ||
57 | #include <linux/oom.h> | ||
54 | 58 | ||
55 | #include <asm/uaccess.h> | 59 | #include <asm/uaccess.h> |
56 | #include <asm/processor.h> | 60 | #include <asm/processor.h> |
@@ -60,23 +64,34 @@ | |||
60 | #include <asm/stacktrace.h> | 64 | #include <asm/stacktrace.h> |
61 | #include <asm/io.h> | 65 | #include <asm/io.h> |
62 | #endif | 66 | #endif |
67 | #ifdef CONFIG_BSD_PROCESS_ACCT | ||
68 | #include <linux/acct.h> | ||
69 | #endif | ||
70 | #ifdef CONFIG_RT_MUTEXES | ||
71 | #include <linux/rtmutex.h> | ||
72 | #endif | ||
73 | #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) | ||
74 | #include <linux/lockdep.h> | ||
75 | #endif | ||
76 | #ifdef CONFIG_CHR_DEV_SG | ||
77 | #include <scsi/sg.h> | ||
78 | #endif | ||
79 | |||
80 | #ifdef CONFIG_LOCKUP_DETECTOR | ||
81 | #include <linux/nmi.h> | ||
82 | #endif | ||
63 | 83 | ||
64 | static int deprecated_sysctl_warning(struct __sysctl_args *args); | ||
65 | 84 | ||
66 | #if defined(CONFIG_SYSCTL) | 85 | #if defined(CONFIG_SYSCTL) |
67 | 86 | ||
68 | /* External variables not in a header file. */ | 87 | /* External variables not in a header file. */ |
69 | extern int C_A_D; | ||
70 | extern int print_fatal_signals; | ||
71 | extern int sysctl_overcommit_memory; | 88 | extern int sysctl_overcommit_memory; |
72 | extern int sysctl_overcommit_ratio; | 89 | extern int sysctl_overcommit_ratio; |
73 | extern int sysctl_panic_on_oom; | ||
74 | extern int sysctl_oom_kill_allocating_task; | ||
75 | extern int sysctl_oom_dump_tasks; | ||
76 | extern int max_threads; | 90 | extern int max_threads; |
77 | extern int core_uses_pid; | 91 | extern int core_uses_pid; |
78 | extern int suid_dumpable; | 92 | extern int suid_dumpable; |
79 | extern char core_pattern[]; | 93 | extern char core_pattern[]; |
94 | extern unsigned int core_pipe_limit; | ||
80 | extern int pid_max; | 95 | extern int pid_max; |
81 | extern int min_free_kbytes; | 96 | extern int min_free_kbytes; |
82 | extern int pid_max_min, pid_max_max; | 97 | extern int pid_max_min, pid_max_max; |
@@ -88,12 +103,12 @@ extern int sysctl_nr_open_min, sysctl_nr_open_max; | |||
88 | #ifndef CONFIG_MMU | 103 | #ifndef CONFIG_MMU |
89 | extern int sysctl_nr_trim_pages; | 104 | extern int sysctl_nr_trim_pages; |
90 | #endif | 105 | #endif |
91 | #ifdef CONFIG_RCU_TORTURE_TEST | 106 | #ifdef CONFIG_BLOCK |
92 | extern int rcutorture_runnable; | 107 | extern int blk_iopoll_enabled; |
93 | #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ | 108 | #endif |
94 | 109 | ||
95 | /* Constants used for minimum and maximum */ | 110 | /* Constants used for minimum and maximum */ |
96 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 111 | #ifdef CONFIG_LOCKUP_DETECTOR |
97 | static int sixty = 60; | 112 | static int sixty = 60; |
98 | static int neg_one = -1; | 113 | static int neg_one = -1; |
99 | #endif | 114 | #endif |
@@ -103,6 +118,9 @@ static int __maybe_unused one = 1; | |||
103 | static int __maybe_unused two = 2; | 118 | static int __maybe_unused two = 2; |
104 | static unsigned long one_ul = 1; | 119 | static unsigned long one_ul = 1; |
105 | static int one_hundred = 100; | 120 | static int one_hundred = 100; |
121 | #ifdef CONFIG_PRINTK | ||
122 | static int ten_thousand = 10000; | ||
123 | #endif | ||
106 | 124 | ||
107 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ | 125 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ |
108 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; | 126 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; |
@@ -114,14 +132,9 @@ static int min_percpu_pagelist_fract = 8; | |||
114 | 132 | ||
115 | static int ngroups_max = NGROUPS_MAX; | 133 | static int ngroups_max = NGROUPS_MAX; |
116 | 134 | ||
117 | #ifdef CONFIG_MODULES | 135 | #ifdef CONFIG_INOTIFY_USER |
118 | extern char modprobe_path[]; | 136 | #include <linux/inotify.h> |
119 | extern int modules_disabled; | ||
120 | #endif | ||
121 | #ifdef CONFIG_CHR_DEV_SG | ||
122 | extern int sg_big_buff; | ||
123 | #endif | 137 | #endif |
124 | |||
125 | #ifdef CONFIG_SPARC | 138 | #ifdef CONFIG_SPARC |
126 | #include <asm/system.h> | 139 | #include <asm/system.h> |
127 | #endif | 140 | #endif |
@@ -143,26 +156,39 @@ extern int sysctl_userprocess_debug; | |||
143 | extern int spin_retry; | 156 | extern int spin_retry; |
144 | #endif | 157 | #endif |
145 | 158 | ||
146 | #ifdef CONFIG_BSD_PROCESS_ACCT | ||
147 | extern int acct_parm[]; | ||
148 | #endif | ||
149 | |||
150 | #ifdef CONFIG_IA64 | 159 | #ifdef CONFIG_IA64 |
151 | extern int no_unaligned_warning; | 160 | extern int no_unaligned_warning; |
152 | extern int unaligned_dump_stack; | 161 | extern int unaligned_dump_stack; |
153 | #endif | 162 | #endif |
154 | 163 | ||
155 | #ifdef CONFIG_RT_MUTEXES | ||
156 | extern int max_lock_depth; | ||
157 | #endif | ||
158 | |||
159 | #ifdef CONFIG_PROC_SYSCTL | 164 | #ifdef CONFIG_PROC_SYSCTL |
160 | static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, | 165 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
161 | void __user *buffer, size_t *lenp, loff_t *ppos); | 166 | void __user *buffer, size_t *lenp, loff_t *ppos); |
162 | static int proc_taint(struct ctl_table *table, int write, struct file *filp, | 167 | static int proc_taint(struct ctl_table *table, int write, |
163 | void __user *buffer, size_t *lenp, loff_t *ppos); | 168 | void __user *buffer, size_t *lenp, loff_t *ppos); |
164 | #endif | 169 | #endif |
165 | 170 | ||
171 | #ifdef CONFIG_MAGIC_SYSRQ | ||
172 | static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ | ||
173 | |||
174 | static int sysrq_sysctl_handler(ctl_table *table, int write, | ||
175 | void __user *buffer, size_t *lenp, | ||
176 | loff_t *ppos) | ||
177 | { | ||
178 | int error; | ||
179 | |||
180 | error = proc_dointvec(table, write, buffer, lenp, ppos); | ||
181 | if (error) | ||
182 | return error; | ||
183 | |||
184 | if (write) | ||
185 | sysrq_toggle_support(__sysrq_enabled); | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | #endif | ||
191 | |||
166 | static struct ctl_table root_table[]; | 192 | static struct ctl_table root_table[]; |
167 | static struct ctl_table_root sysctl_table_root; | 193 | static struct ctl_table_root sysctl_table_root; |
168 | static struct ctl_table_header root_table_header = { | 194 | static struct ctl_table_header root_table_header = { |
@@ -183,9 +209,6 @@ static struct ctl_table fs_table[]; | |||
183 | static struct ctl_table debug_table[]; | 209 | static struct ctl_table debug_table[]; |
184 | static struct ctl_table dev_table[]; | 210 | static struct ctl_table dev_table[]; |
185 | extern struct ctl_table random_table[]; | 211 | extern struct ctl_table random_table[]; |
186 | #ifdef CONFIG_INOTIFY_USER | ||
187 | extern struct ctl_table inotify_table[]; | ||
188 | #endif | ||
189 | #ifdef CONFIG_EPOLL | 212 | #ifdef CONFIG_EPOLL |
190 | extern struct ctl_table epoll_table[]; | 213 | extern struct ctl_table epoll_table[]; |
191 | #endif | 214 | #endif |
@@ -194,38 +217,30 @@ extern struct ctl_table epoll_table[]; | |||
194 | int sysctl_legacy_va_layout; | 217 | int sysctl_legacy_va_layout; |
195 | #endif | 218 | #endif |
196 | 219 | ||
197 | extern int prove_locking; | ||
198 | extern int lock_stat; | ||
199 | |||
200 | /* The default sysctl tables: */ | 220 | /* The default sysctl tables: */ |
201 | 221 | ||
202 | static struct ctl_table root_table[] = { | 222 | static struct ctl_table root_table[] = { |
203 | { | 223 | { |
204 | .ctl_name = CTL_KERN, | ||
205 | .procname = "kernel", | 224 | .procname = "kernel", |
206 | .mode = 0555, | 225 | .mode = 0555, |
207 | .child = kern_table, | 226 | .child = kern_table, |
208 | }, | 227 | }, |
209 | { | 228 | { |
210 | .ctl_name = CTL_VM, | ||
211 | .procname = "vm", | 229 | .procname = "vm", |
212 | .mode = 0555, | 230 | .mode = 0555, |
213 | .child = vm_table, | 231 | .child = vm_table, |
214 | }, | 232 | }, |
215 | { | 233 | { |
216 | .ctl_name = CTL_FS, | ||
217 | .procname = "fs", | 234 | .procname = "fs", |
218 | .mode = 0555, | 235 | .mode = 0555, |
219 | .child = fs_table, | 236 | .child = fs_table, |
220 | }, | 237 | }, |
221 | { | 238 | { |
222 | .ctl_name = CTL_DEBUG, | ||
223 | .procname = "debug", | 239 | .procname = "debug", |
224 | .mode = 0555, | 240 | .mode = 0555, |
225 | .child = debug_table, | 241 | .child = debug_table, |
226 | }, | 242 | }, |
227 | { | 243 | { |
228 | .ctl_name = CTL_DEV, | ||
229 | .procname = "dev", | 244 | .procname = "dev", |
230 | .mode = 0555, | 245 | .mode = 0555, |
231 | .child = dev_table, | 246 | .child = dev_table, |
@@ -234,7 +249,7 @@ static struct ctl_table root_table[] = { | |||
234 | * NOTE: do not add new entries to this table unless you have read | 249 | * NOTE: do not add new entries to this table unless you have read |
235 | * Documentation/sysctl/ctl_unnumbered.txt | 250 | * Documentation/sysctl/ctl_unnumbered.txt |
236 | */ | 251 | */ |
237 | { .ctl_name = 0 } | 252 | { } |
238 | }; | 253 | }; |
239 | 254 | ||
240 | #ifdef CONFIG_SCHED_DEBUG | 255 | #ifdef CONFIG_SCHED_DEBUG |
@@ -242,177 +257,182 @@ static int min_sched_granularity_ns = 100000; /* 100 usecs */ | |||
242 | static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ | 257 | static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
243 | static int min_wakeup_granularity_ns; /* 0 usecs */ | 258 | static int min_wakeup_granularity_ns; /* 0 usecs */ |
244 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ | 259 | static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ |
260 | static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; | ||
261 | static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; | ||
262 | #endif | ||
263 | |||
264 | #ifdef CONFIG_COMPACTION | ||
265 | static int min_extfrag_threshold; | ||
266 | static int max_extfrag_threshold = 1000; | ||
245 | #endif | 267 | #endif |
246 | 268 | ||
247 | static struct ctl_table kern_table[] = { | 269 | static struct ctl_table kern_table[] = { |
270 | { | ||
271 | .procname = "sched_child_runs_first", | ||
272 | .data = &sysctl_sched_child_runs_first, | ||
273 | .maxlen = sizeof(unsigned int), | ||
274 | .mode = 0644, | ||
275 | .proc_handler = proc_dointvec, | ||
276 | }, | ||
248 | #ifdef CONFIG_SCHED_DEBUG | 277 | #ifdef CONFIG_SCHED_DEBUG |
249 | { | 278 | { |
250 | .ctl_name = CTL_UNNUMBERED, | ||
251 | .procname = "sched_min_granularity_ns", | 279 | .procname = "sched_min_granularity_ns", |
252 | .data = &sysctl_sched_min_granularity, | 280 | .data = &sysctl_sched_min_granularity, |
253 | .maxlen = sizeof(unsigned int), | 281 | .maxlen = sizeof(unsigned int), |
254 | .mode = 0644, | 282 | .mode = 0644, |
255 | .proc_handler = &sched_nr_latency_handler, | 283 | .proc_handler = sched_proc_update_handler, |
256 | .strategy = &sysctl_intvec, | ||
257 | .extra1 = &min_sched_granularity_ns, | 284 | .extra1 = &min_sched_granularity_ns, |
258 | .extra2 = &max_sched_granularity_ns, | 285 | .extra2 = &max_sched_granularity_ns, |
259 | }, | 286 | }, |
260 | { | 287 | { |
261 | .ctl_name = CTL_UNNUMBERED, | ||
262 | .procname = "sched_latency_ns", | 288 | .procname = "sched_latency_ns", |
263 | .data = &sysctl_sched_latency, | 289 | .data = &sysctl_sched_latency, |
264 | .maxlen = sizeof(unsigned int), | 290 | .maxlen = sizeof(unsigned int), |
265 | .mode = 0644, | 291 | .mode = 0644, |
266 | .proc_handler = &sched_nr_latency_handler, | 292 | .proc_handler = sched_proc_update_handler, |
267 | .strategy = &sysctl_intvec, | ||
268 | .extra1 = &min_sched_granularity_ns, | 293 | .extra1 = &min_sched_granularity_ns, |
269 | .extra2 = &max_sched_granularity_ns, | 294 | .extra2 = &max_sched_granularity_ns, |
270 | }, | 295 | }, |
271 | { | 296 | { |
272 | .ctl_name = CTL_UNNUMBERED, | ||
273 | .procname = "sched_wakeup_granularity_ns", | 297 | .procname = "sched_wakeup_granularity_ns", |
274 | .data = &sysctl_sched_wakeup_granularity, | 298 | .data = &sysctl_sched_wakeup_granularity, |
275 | .maxlen = sizeof(unsigned int), | 299 | .maxlen = sizeof(unsigned int), |
276 | .mode = 0644, | 300 | .mode = 0644, |
277 | .proc_handler = &proc_dointvec_minmax, | 301 | .proc_handler = sched_proc_update_handler, |
278 | .strategy = &sysctl_intvec, | ||
279 | .extra1 = &min_wakeup_granularity_ns, | 302 | .extra1 = &min_wakeup_granularity_ns, |
280 | .extra2 = &max_wakeup_granularity_ns, | 303 | .extra2 = &max_wakeup_granularity_ns, |
281 | }, | 304 | }, |
282 | { | 305 | { |
283 | .ctl_name = CTL_UNNUMBERED, | 306 | .procname = "sched_tunable_scaling", |
284 | .procname = "sched_shares_ratelimit", | 307 | .data = &sysctl_sched_tunable_scaling, |
285 | .data = &sysctl_sched_shares_ratelimit, | 308 | .maxlen = sizeof(enum sched_tunable_scaling), |
286 | .maxlen = sizeof(unsigned int), | ||
287 | .mode = 0644, | 309 | .mode = 0644, |
288 | .proc_handler = &proc_dointvec, | 310 | .proc_handler = sched_proc_update_handler, |
311 | .extra1 = &min_sched_tunable_scaling, | ||
312 | .extra2 = &max_sched_tunable_scaling, | ||
289 | }, | 313 | }, |
290 | { | 314 | { |
291 | .ctl_name = CTL_UNNUMBERED, | 315 | .procname = "sched_migration_cost", |
292 | .procname = "sched_shares_thresh", | 316 | .data = &sysctl_sched_migration_cost, |
293 | .data = &sysctl_sched_shares_thresh, | ||
294 | .maxlen = sizeof(unsigned int), | ||
295 | .mode = 0644, | ||
296 | .proc_handler = &proc_dointvec_minmax, | ||
297 | .strategy = &sysctl_intvec, | ||
298 | .extra1 = &zero, | ||
299 | }, | ||
300 | { | ||
301 | .ctl_name = CTL_UNNUMBERED, | ||
302 | .procname = "sched_child_runs_first", | ||
303 | .data = &sysctl_sched_child_runs_first, | ||
304 | .maxlen = sizeof(unsigned int), | 317 | .maxlen = sizeof(unsigned int), |
305 | .mode = 0644, | 318 | .mode = 0644, |
306 | .proc_handler = &proc_dointvec, | 319 | .proc_handler = proc_dointvec, |
307 | }, | 320 | }, |
308 | { | 321 | { |
309 | .ctl_name = CTL_UNNUMBERED, | 322 | .procname = "sched_nr_migrate", |
310 | .procname = "sched_features", | 323 | .data = &sysctl_sched_nr_migrate, |
311 | .data = &sysctl_sched_features, | ||
312 | .maxlen = sizeof(unsigned int), | 324 | .maxlen = sizeof(unsigned int), |
313 | .mode = 0644, | 325 | .mode = 0644, |
314 | .proc_handler = &proc_dointvec, | 326 | .proc_handler = proc_dointvec, |
315 | }, | 327 | }, |
316 | { | 328 | { |
317 | .ctl_name = CTL_UNNUMBERED, | 329 | .procname = "sched_time_avg", |
318 | .procname = "sched_migration_cost", | 330 | .data = &sysctl_sched_time_avg, |
319 | .data = &sysctl_sched_migration_cost, | ||
320 | .maxlen = sizeof(unsigned int), | 331 | .maxlen = sizeof(unsigned int), |
321 | .mode = 0644, | 332 | .mode = 0644, |
322 | .proc_handler = &proc_dointvec, | 333 | .proc_handler = proc_dointvec, |
323 | }, | 334 | }, |
324 | { | 335 | { |
325 | .ctl_name = CTL_UNNUMBERED, | 336 | .procname = "sched_shares_window", |
326 | .procname = "sched_nr_migrate", | 337 | .data = &sysctl_sched_shares_window, |
327 | .data = &sysctl_sched_nr_migrate, | ||
328 | .maxlen = sizeof(unsigned int), | 338 | .maxlen = sizeof(unsigned int), |
329 | .mode = 0644, | 339 | .mode = 0644, |
330 | .proc_handler = &proc_dointvec, | 340 | .proc_handler = proc_dointvec, |
331 | }, | 341 | }, |
332 | { | 342 | { |
333 | .ctl_name = CTL_UNNUMBERED, | ||
334 | .procname = "timer_migration", | 343 | .procname = "timer_migration", |
335 | .data = &sysctl_timer_migration, | 344 | .data = &sysctl_timer_migration, |
336 | .maxlen = sizeof(unsigned int), | 345 | .maxlen = sizeof(unsigned int), |
337 | .mode = 0644, | 346 | .mode = 0644, |
338 | .proc_handler = &proc_dointvec, | 347 | .proc_handler = proc_dointvec_minmax, |
348 | .extra1 = &zero, | ||
349 | .extra2 = &one, | ||
339 | }, | 350 | }, |
340 | #endif | 351 | #endif |
341 | { | 352 | { |
342 | .ctl_name = CTL_UNNUMBERED, | ||
343 | .procname = "sched_rt_period_us", | 353 | .procname = "sched_rt_period_us", |
344 | .data = &sysctl_sched_rt_period, | 354 | .data = &sysctl_sched_rt_period, |
345 | .maxlen = sizeof(unsigned int), | 355 | .maxlen = sizeof(unsigned int), |
346 | .mode = 0644, | 356 | .mode = 0644, |
347 | .proc_handler = &sched_rt_handler, | 357 | .proc_handler = sched_rt_handler, |
348 | }, | 358 | }, |
349 | { | 359 | { |
350 | .ctl_name = CTL_UNNUMBERED, | ||
351 | .procname = "sched_rt_runtime_us", | 360 | .procname = "sched_rt_runtime_us", |
352 | .data = &sysctl_sched_rt_runtime, | 361 | .data = &sysctl_sched_rt_runtime, |
353 | .maxlen = sizeof(int), | 362 | .maxlen = sizeof(int), |
354 | .mode = 0644, | 363 | .mode = 0644, |
355 | .proc_handler = &sched_rt_handler, | 364 | .proc_handler = sched_rt_handler, |
356 | }, | 365 | }, |
357 | { | 366 | { |
358 | .ctl_name = CTL_UNNUMBERED, | ||
359 | .procname = "sched_compat_yield", | 367 | .procname = "sched_compat_yield", |
360 | .data = &sysctl_sched_compat_yield, | 368 | .data = &sysctl_sched_compat_yield, |
361 | .maxlen = sizeof(unsigned int), | 369 | .maxlen = sizeof(unsigned int), |
362 | .mode = 0644, | 370 | .mode = 0644, |
363 | .proc_handler = &proc_dointvec, | 371 | .proc_handler = proc_dointvec, |
372 | }, | ||
373 | #ifdef CONFIG_SCHED_AUTOGROUP | ||
374 | { | ||
375 | .procname = "sched_autogroup_enabled", | ||
376 | .data = &sysctl_sched_autogroup_enabled, | ||
377 | .maxlen = sizeof(unsigned int), | ||
378 | .mode = 0644, | ||
379 | .proc_handler = proc_dointvec, | ||
380 | .extra1 = &zero, | ||
381 | .extra2 = &one, | ||
364 | }, | 382 | }, |
383 | #endif | ||
365 | #ifdef CONFIG_PROVE_LOCKING | 384 | #ifdef CONFIG_PROVE_LOCKING |
366 | { | 385 | { |
367 | .ctl_name = CTL_UNNUMBERED, | ||
368 | .procname = "prove_locking", | 386 | .procname = "prove_locking", |
369 | .data = &prove_locking, | 387 | .data = &prove_locking, |
370 | .maxlen = sizeof(int), | 388 | .maxlen = sizeof(int), |
371 | .mode = 0644, | 389 | .mode = 0644, |
372 | .proc_handler = &proc_dointvec, | 390 | .proc_handler = proc_dointvec, |
373 | }, | 391 | }, |
374 | #endif | 392 | #endif |
375 | #ifdef CONFIG_LOCK_STAT | 393 | #ifdef CONFIG_LOCK_STAT |
376 | { | 394 | { |
377 | .ctl_name = CTL_UNNUMBERED, | ||
378 | .procname = "lock_stat", | 395 | .procname = "lock_stat", |
379 | .data = &lock_stat, | 396 | .data = &lock_stat, |
380 | .maxlen = sizeof(int), | 397 | .maxlen = sizeof(int), |
381 | .mode = 0644, | 398 | .mode = 0644, |
382 | .proc_handler = &proc_dointvec, | 399 | .proc_handler = proc_dointvec, |
383 | }, | 400 | }, |
384 | #endif | 401 | #endif |
385 | { | 402 | { |
386 | .ctl_name = KERN_PANIC, | ||
387 | .procname = "panic", | 403 | .procname = "panic", |
388 | .data = &panic_timeout, | 404 | .data = &panic_timeout, |
389 | .maxlen = sizeof(int), | 405 | .maxlen = sizeof(int), |
390 | .mode = 0644, | 406 | .mode = 0644, |
391 | .proc_handler = &proc_dointvec, | 407 | .proc_handler = proc_dointvec, |
392 | }, | 408 | }, |
393 | { | 409 | { |
394 | .ctl_name = KERN_CORE_USES_PID, | ||
395 | .procname = "core_uses_pid", | 410 | .procname = "core_uses_pid", |
396 | .data = &core_uses_pid, | 411 | .data = &core_uses_pid, |
397 | .maxlen = sizeof(int), | 412 | .maxlen = sizeof(int), |
398 | .mode = 0644, | 413 | .mode = 0644, |
399 | .proc_handler = &proc_dointvec, | 414 | .proc_handler = proc_dointvec, |
400 | }, | 415 | }, |
401 | { | 416 | { |
402 | .ctl_name = KERN_CORE_PATTERN, | ||
403 | .procname = "core_pattern", | 417 | .procname = "core_pattern", |
404 | .data = core_pattern, | 418 | .data = core_pattern, |
405 | .maxlen = CORENAME_MAX_SIZE, | 419 | .maxlen = CORENAME_MAX_SIZE, |
406 | .mode = 0644, | 420 | .mode = 0644, |
407 | .proc_handler = &proc_dostring, | 421 | .proc_handler = proc_dostring, |
408 | .strategy = &sysctl_string, | 422 | }, |
423 | { | ||
424 | .procname = "core_pipe_limit", | ||
425 | .data = &core_pipe_limit, | ||
426 | .maxlen = sizeof(unsigned int), | ||
427 | .mode = 0644, | ||
428 | .proc_handler = proc_dointvec, | ||
409 | }, | 429 | }, |
410 | #ifdef CONFIG_PROC_SYSCTL | 430 | #ifdef CONFIG_PROC_SYSCTL |
411 | { | 431 | { |
412 | .procname = "tainted", | 432 | .procname = "tainted", |
413 | .maxlen = sizeof(long), | 433 | .maxlen = sizeof(long), |
414 | .mode = 0644, | 434 | .mode = 0644, |
415 | .proc_handler = &proc_taint, | 435 | .proc_handler = proc_taint, |
416 | }, | 436 | }, |
417 | #endif | 437 | #endif |
418 | #ifdef CONFIG_LATENCYTOP | 438 | #ifdef CONFIG_LATENCYTOP |
@@ -421,181 +441,160 @@ static struct ctl_table kern_table[] = { | |||
421 | .data = &latencytop_enabled, | 441 | .data = &latencytop_enabled, |
422 | .maxlen = sizeof(int), | 442 | .maxlen = sizeof(int), |
423 | .mode = 0644, | 443 | .mode = 0644, |
424 | .proc_handler = &proc_dointvec, | 444 | .proc_handler = proc_dointvec, |
425 | }, | 445 | }, |
426 | #endif | 446 | #endif |
427 | #ifdef CONFIG_BLK_DEV_INITRD | 447 | #ifdef CONFIG_BLK_DEV_INITRD |
428 | { | 448 | { |
429 | .ctl_name = KERN_REALROOTDEV, | ||
430 | .procname = "real-root-dev", | 449 | .procname = "real-root-dev", |
431 | .data = &real_root_dev, | 450 | .data = &real_root_dev, |
432 | .maxlen = sizeof(int), | 451 | .maxlen = sizeof(int), |
433 | .mode = 0644, | 452 | .mode = 0644, |
434 | .proc_handler = &proc_dointvec, | 453 | .proc_handler = proc_dointvec, |
435 | }, | 454 | }, |
436 | #endif | 455 | #endif |
437 | { | 456 | { |
438 | .ctl_name = CTL_UNNUMBERED, | ||
439 | .procname = "print-fatal-signals", | 457 | .procname = "print-fatal-signals", |
440 | .data = &print_fatal_signals, | 458 | .data = &print_fatal_signals, |
441 | .maxlen = sizeof(int), | 459 | .maxlen = sizeof(int), |
442 | .mode = 0644, | 460 | .mode = 0644, |
443 | .proc_handler = &proc_dointvec, | 461 | .proc_handler = proc_dointvec, |
444 | }, | 462 | }, |
445 | #ifdef CONFIG_SPARC | 463 | #ifdef CONFIG_SPARC |
446 | { | 464 | { |
447 | .ctl_name = KERN_SPARC_REBOOT, | ||
448 | .procname = "reboot-cmd", | 465 | .procname = "reboot-cmd", |
449 | .data = reboot_command, | 466 | .data = reboot_command, |
450 | .maxlen = 256, | 467 | .maxlen = 256, |
451 | .mode = 0644, | 468 | .mode = 0644, |
452 | .proc_handler = &proc_dostring, | 469 | .proc_handler = proc_dostring, |
453 | .strategy = &sysctl_string, | ||
454 | }, | 470 | }, |
455 | { | 471 | { |
456 | .ctl_name = KERN_SPARC_STOP_A, | ||
457 | .procname = "stop-a", | 472 | .procname = "stop-a", |
458 | .data = &stop_a_enabled, | 473 | .data = &stop_a_enabled, |
459 | .maxlen = sizeof (int), | 474 | .maxlen = sizeof (int), |
460 | .mode = 0644, | 475 | .mode = 0644, |
461 | .proc_handler = &proc_dointvec, | 476 | .proc_handler = proc_dointvec, |
462 | }, | 477 | }, |
463 | { | 478 | { |
464 | .ctl_name = KERN_SPARC_SCONS_PWROFF, | ||
465 | .procname = "scons-poweroff", | 479 | .procname = "scons-poweroff", |
466 | .data = &scons_pwroff, | 480 | .data = &scons_pwroff, |
467 | .maxlen = sizeof (int), | 481 | .maxlen = sizeof (int), |
468 | .mode = 0644, | 482 | .mode = 0644, |
469 | .proc_handler = &proc_dointvec, | 483 | .proc_handler = proc_dointvec, |
470 | }, | 484 | }, |
471 | #endif | 485 | #endif |
472 | #ifdef CONFIG_SPARC64 | 486 | #ifdef CONFIG_SPARC64 |
473 | { | 487 | { |
474 | .ctl_name = CTL_UNNUMBERED, | ||
475 | .procname = "tsb-ratio", | 488 | .procname = "tsb-ratio", |
476 | .data = &sysctl_tsb_ratio, | 489 | .data = &sysctl_tsb_ratio, |
477 | .maxlen = sizeof (int), | 490 | .maxlen = sizeof (int), |
478 | .mode = 0644, | 491 | .mode = 0644, |
479 | .proc_handler = &proc_dointvec, | 492 | .proc_handler = proc_dointvec, |
480 | }, | 493 | }, |
481 | #endif | 494 | #endif |
482 | #ifdef __hppa__ | 495 | #ifdef __hppa__ |
483 | { | 496 | { |
484 | .ctl_name = KERN_HPPA_PWRSW, | ||
485 | .procname = "soft-power", | 497 | .procname = "soft-power", |
486 | .data = &pwrsw_enabled, | 498 | .data = &pwrsw_enabled, |
487 | .maxlen = sizeof (int), | 499 | .maxlen = sizeof (int), |
488 | .mode = 0644, | 500 | .mode = 0644, |
489 | .proc_handler = &proc_dointvec, | 501 | .proc_handler = proc_dointvec, |
490 | }, | 502 | }, |
491 | { | 503 | { |
492 | .ctl_name = KERN_HPPA_UNALIGNED, | ||
493 | .procname = "unaligned-trap", | 504 | .procname = "unaligned-trap", |
494 | .data = &unaligned_enabled, | 505 | .data = &unaligned_enabled, |
495 | .maxlen = sizeof (int), | 506 | .maxlen = sizeof (int), |
496 | .mode = 0644, | 507 | .mode = 0644, |
497 | .proc_handler = &proc_dointvec, | 508 | .proc_handler = proc_dointvec, |
498 | }, | 509 | }, |
499 | #endif | 510 | #endif |
500 | { | 511 | { |
501 | .ctl_name = KERN_CTLALTDEL, | ||
502 | .procname = "ctrl-alt-del", | 512 | .procname = "ctrl-alt-del", |
503 | .data = &C_A_D, | 513 | .data = &C_A_D, |
504 | .maxlen = sizeof(int), | 514 | .maxlen = sizeof(int), |
505 | .mode = 0644, | 515 | .mode = 0644, |
506 | .proc_handler = &proc_dointvec, | 516 | .proc_handler = proc_dointvec, |
507 | }, | 517 | }, |
508 | #ifdef CONFIG_FUNCTION_TRACER | 518 | #ifdef CONFIG_FUNCTION_TRACER |
509 | { | 519 | { |
510 | .ctl_name = CTL_UNNUMBERED, | ||
511 | .procname = "ftrace_enabled", | 520 | .procname = "ftrace_enabled", |
512 | .data = &ftrace_enabled, | 521 | .data = &ftrace_enabled, |
513 | .maxlen = sizeof(int), | 522 | .maxlen = sizeof(int), |
514 | .mode = 0644, | 523 | .mode = 0644, |
515 | .proc_handler = &ftrace_enable_sysctl, | 524 | .proc_handler = ftrace_enable_sysctl, |
516 | }, | 525 | }, |
517 | #endif | 526 | #endif |
518 | #ifdef CONFIG_STACK_TRACER | 527 | #ifdef CONFIG_STACK_TRACER |
519 | { | 528 | { |
520 | .ctl_name = CTL_UNNUMBERED, | ||
521 | .procname = "stack_tracer_enabled", | 529 | .procname = "stack_tracer_enabled", |
522 | .data = &stack_tracer_enabled, | 530 | .data = &stack_tracer_enabled, |
523 | .maxlen = sizeof(int), | 531 | .maxlen = sizeof(int), |
524 | .mode = 0644, | 532 | .mode = 0644, |
525 | .proc_handler = &stack_trace_sysctl, | 533 | .proc_handler = stack_trace_sysctl, |
526 | }, | 534 | }, |
527 | #endif | 535 | #endif |
528 | #ifdef CONFIG_TRACING | 536 | #ifdef CONFIG_TRACING |
529 | { | 537 | { |
530 | .ctl_name = CTL_UNNUMBERED, | ||
531 | .procname = "ftrace_dump_on_oops", | 538 | .procname = "ftrace_dump_on_oops", |
532 | .data = &ftrace_dump_on_oops, | 539 | .data = &ftrace_dump_on_oops, |
533 | .maxlen = sizeof(int), | 540 | .maxlen = sizeof(int), |
534 | .mode = 0644, | 541 | .mode = 0644, |
535 | .proc_handler = &proc_dointvec, | 542 | .proc_handler = proc_dointvec, |
536 | }, | 543 | }, |
537 | #endif | 544 | #endif |
538 | #ifdef CONFIG_MODULES | 545 | #ifdef CONFIG_MODULES |
539 | { | 546 | { |
540 | .ctl_name = KERN_MODPROBE, | ||
541 | .procname = "modprobe", | 547 | .procname = "modprobe", |
542 | .data = &modprobe_path, | 548 | .data = &modprobe_path, |
543 | .maxlen = KMOD_PATH_LEN, | 549 | .maxlen = KMOD_PATH_LEN, |
544 | .mode = 0644, | 550 | .mode = 0644, |
545 | .proc_handler = &proc_dostring, | 551 | .proc_handler = proc_dostring, |
546 | .strategy = &sysctl_string, | ||
547 | }, | 552 | }, |
548 | { | 553 | { |
549 | .ctl_name = CTL_UNNUMBERED, | ||
550 | .procname = "modules_disabled", | 554 | .procname = "modules_disabled", |
551 | .data = &modules_disabled, | 555 | .data = &modules_disabled, |
552 | .maxlen = sizeof(int), | 556 | .maxlen = sizeof(int), |
553 | .mode = 0644, | 557 | .mode = 0644, |
554 | /* only handle a transition from default "0" to "1" */ | 558 | /* only handle a transition from default "0" to "1" */ |
555 | .proc_handler = &proc_dointvec_minmax, | 559 | .proc_handler = proc_dointvec_minmax, |
556 | .extra1 = &one, | 560 | .extra1 = &one, |
557 | .extra2 = &one, | 561 | .extra2 = &one, |
558 | }, | 562 | }, |
559 | #endif | 563 | #endif |
560 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 564 | #ifdef CONFIG_HOTPLUG |
561 | { | 565 | { |
562 | .ctl_name = KERN_HOTPLUG, | ||
563 | .procname = "hotplug", | 566 | .procname = "hotplug", |
564 | .data = &uevent_helper, | 567 | .data = &uevent_helper, |
565 | .maxlen = UEVENT_HELPER_PATH_LEN, | 568 | .maxlen = UEVENT_HELPER_PATH_LEN, |
566 | .mode = 0644, | 569 | .mode = 0644, |
567 | .proc_handler = &proc_dostring, | 570 | .proc_handler = proc_dostring, |
568 | .strategy = &sysctl_string, | ||
569 | }, | 571 | }, |
570 | #endif | 572 | #endif |
571 | #ifdef CONFIG_CHR_DEV_SG | 573 | #ifdef CONFIG_CHR_DEV_SG |
572 | { | 574 | { |
573 | .ctl_name = KERN_SG_BIG_BUFF, | ||
574 | .procname = "sg-big-buff", | 575 | .procname = "sg-big-buff", |
575 | .data = &sg_big_buff, | 576 | .data = &sg_big_buff, |
576 | .maxlen = sizeof (int), | 577 | .maxlen = sizeof (int), |
577 | .mode = 0444, | 578 | .mode = 0444, |
578 | .proc_handler = &proc_dointvec, | 579 | .proc_handler = proc_dointvec, |
579 | }, | 580 | }, |
580 | #endif | 581 | #endif |
581 | #ifdef CONFIG_BSD_PROCESS_ACCT | 582 | #ifdef CONFIG_BSD_PROCESS_ACCT |
582 | { | 583 | { |
583 | .ctl_name = KERN_ACCT, | ||
584 | .procname = "acct", | 584 | .procname = "acct", |
585 | .data = &acct_parm, | 585 | .data = &acct_parm, |
586 | .maxlen = 3*sizeof(int), | 586 | .maxlen = 3*sizeof(int), |
587 | .mode = 0644, | 587 | .mode = 0644, |
588 | .proc_handler = &proc_dointvec, | 588 | .proc_handler = proc_dointvec, |
589 | }, | 589 | }, |
590 | #endif | 590 | #endif |
591 | #ifdef CONFIG_MAGIC_SYSRQ | 591 | #ifdef CONFIG_MAGIC_SYSRQ |
592 | { | 592 | { |
593 | .ctl_name = KERN_SYSRQ, | ||
594 | .procname = "sysrq", | 593 | .procname = "sysrq", |
595 | .data = &__sysrq_enabled, | 594 | .data = &__sysrq_enabled, |
596 | .maxlen = sizeof (int), | 595 | .maxlen = sizeof (int), |
597 | .mode = 0644, | 596 | .mode = 0644, |
598 | .proc_handler = &proc_dointvec, | 597 | .proc_handler = sysrq_sysctl_handler, |
599 | }, | 598 | }, |
600 | #endif | 599 | #endif |
601 | #ifdef CONFIG_PROC_SYSCTL | 600 | #ifdef CONFIG_PROC_SYSCTL |
@@ -604,196 +603,224 @@ static struct ctl_table kern_table[] = { | |||
604 | .data = NULL, | 603 | .data = NULL, |
605 | .maxlen = sizeof (int), | 604 | .maxlen = sizeof (int), |
606 | .mode = 0600, | 605 | .mode = 0600, |
607 | .proc_handler = &proc_do_cad_pid, | 606 | .proc_handler = proc_do_cad_pid, |
608 | }, | 607 | }, |
609 | #endif | 608 | #endif |
610 | { | 609 | { |
611 | .ctl_name = KERN_MAX_THREADS, | ||
612 | .procname = "threads-max", | 610 | .procname = "threads-max", |
613 | .data = &max_threads, | 611 | .data = &max_threads, |
614 | .maxlen = sizeof(int), | 612 | .maxlen = sizeof(int), |
615 | .mode = 0644, | 613 | .mode = 0644, |
616 | .proc_handler = &proc_dointvec, | 614 | .proc_handler = proc_dointvec, |
617 | }, | 615 | }, |
618 | { | 616 | { |
619 | .ctl_name = KERN_RANDOM, | ||
620 | .procname = "random", | 617 | .procname = "random", |
621 | .mode = 0555, | 618 | .mode = 0555, |
622 | .child = random_table, | 619 | .child = random_table, |
623 | }, | 620 | }, |
624 | { | 621 | { |
625 | .ctl_name = KERN_OVERFLOWUID, | ||
626 | .procname = "overflowuid", | 622 | .procname = "overflowuid", |
627 | .data = &overflowuid, | 623 | .data = &overflowuid, |
628 | .maxlen = sizeof(int), | 624 | .maxlen = sizeof(int), |
629 | .mode = 0644, | 625 | .mode = 0644, |
630 | .proc_handler = &proc_dointvec_minmax, | 626 | .proc_handler = proc_dointvec_minmax, |
631 | .strategy = &sysctl_intvec, | ||
632 | .extra1 = &minolduid, | 627 | .extra1 = &minolduid, |
633 | .extra2 = &maxolduid, | 628 | .extra2 = &maxolduid, |
634 | }, | 629 | }, |
635 | { | 630 | { |
636 | .ctl_name = KERN_OVERFLOWGID, | ||
637 | .procname = "overflowgid", | 631 | .procname = "overflowgid", |
638 | .data = &overflowgid, | 632 | .data = &overflowgid, |
639 | .maxlen = sizeof(int), | 633 | .maxlen = sizeof(int), |
640 | .mode = 0644, | 634 | .mode = 0644, |
641 | .proc_handler = &proc_dointvec_minmax, | 635 | .proc_handler = proc_dointvec_minmax, |
642 | .strategy = &sysctl_intvec, | ||
643 | .extra1 = &minolduid, | 636 | .extra1 = &minolduid, |
644 | .extra2 = &maxolduid, | 637 | .extra2 = &maxolduid, |
645 | }, | 638 | }, |
646 | #ifdef CONFIG_S390 | 639 | #ifdef CONFIG_S390 |
647 | #ifdef CONFIG_MATHEMU | 640 | #ifdef CONFIG_MATHEMU |
648 | { | 641 | { |
649 | .ctl_name = KERN_IEEE_EMULATION_WARNINGS, | ||
650 | .procname = "ieee_emulation_warnings", | 642 | .procname = "ieee_emulation_warnings", |
651 | .data = &sysctl_ieee_emulation_warnings, | 643 | .data = &sysctl_ieee_emulation_warnings, |
652 | .maxlen = sizeof(int), | 644 | .maxlen = sizeof(int), |
653 | .mode = 0644, | 645 | .mode = 0644, |
654 | .proc_handler = &proc_dointvec, | 646 | .proc_handler = proc_dointvec, |
655 | }, | 647 | }, |
656 | #endif | 648 | #endif |
657 | { | 649 | { |
658 | .ctl_name = KERN_S390_USER_DEBUG_LOGGING, | ||
659 | .procname = "userprocess_debug", | 650 | .procname = "userprocess_debug", |
660 | .data = &sysctl_userprocess_debug, | 651 | .data = &show_unhandled_signals, |
661 | .maxlen = sizeof(int), | 652 | .maxlen = sizeof(int), |
662 | .mode = 0644, | 653 | .mode = 0644, |
663 | .proc_handler = &proc_dointvec, | 654 | .proc_handler = proc_dointvec, |
664 | }, | 655 | }, |
665 | #endif | 656 | #endif |
666 | { | 657 | { |
667 | .ctl_name = KERN_PIDMAX, | ||
668 | .procname = "pid_max", | 658 | .procname = "pid_max", |
669 | .data = &pid_max, | 659 | .data = &pid_max, |
670 | .maxlen = sizeof (int), | 660 | .maxlen = sizeof (int), |
671 | .mode = 0644, | 661 | .mode = 0644, |
672 | .proc_handler = &proc_dointvec_minmax, | 662 | .proc_handler = proc_dointvec_minmax, |
673 | .strategy = sysctl_intvec, | ||
674 | .extra1 = &pid_max_min, | 663 | .extra1 = &pid_max_min, |
675 | .extra2 = &pid_max_max, | 664 | .extra2 = &pid_max_max, |
676 | }, | 665 | }, |
677 | { | 666 | { |
678 | .ctl_name = KERN_PANIC_ON_OOPS, | ||
679 | .procname = "panic_on_oops", | 667 | .procname = "panic_on_oops", |
680 | .data = &panic_on_oops, | 668 | .data = &panic_on_oops, |
681 | .maxlen = sizeof(int), | 669 | .maxlen = sizeof(int), |
682 | .mode = 0644, | 670 | .mode = 0644, |
683 | .proc_handler = &proc_dointvec, | 671 | .proc_handler = proc_dointvec, |
684 | }, | 672 | }, |
685 | #if defined CONFIG_PRINTK | 673 | #if defined CONFIG_PRINTK |
686 | { | 674 | { |
687 | .ctl_name = KERN_PRINTK, | ||
688 | .procname = "printk", | 675 | .procname = "printk", |
689 | .data = &console_loglevel, | 676 | .data = &console_loglevel, |
690 | .maxlen = 4*sizeof(int), | 677 | .maxlen = 4*sizeof(int), |
691 | .mode = 0644, | 678 | .mode = 0644, |
692 | .proc_handler = &proc_dointvec, | 679 | .proc_handler = proc_dointvec, |
693 | }, | 680 | }, |
694 | { | 681 | { |
695 | .ctl_name = KERN_PRINTK_RATELIMIT, | ||
696 | .procname = "printk_ratelimit", | 682 | .procname = "printk_ratelimit", |
697 | .data = &printk_ratelimit_state.interval, | 683 | .data = &printk_ratelimit_state.interval, |
698 | .maxlen = sizeof(int), | 684 | .maxlen = sizeof(int), |
699 | .mode = 0644, | 685 | .mode = 0644, |
700 | .proc_handler = &proc_dointvec_jiffies, | 686 | .proc_handler = proc_dointvec_jiffies, |
701 | .strategy = &sysctl_jiffies, | ||
702 | }, | 687 | }, |
703 | { | 688 | { |
704 | .ctl_name = KERN_PRINTK_RATELIMIT_BURST, | ||
705 | .procname = "printk_ratelimit_burst", | 689 | .procname = "printk_ratelimit_burst", |
706 | .data = &printk_ratelimit_state.burst, | 690 | .data = &printk_ratelimit_state.burst, |
707 | .maxlen = sizeof(int), | 691 | .maxlen = sizeof(int), |
708 | .mode = 0644, | 692 | .mode = 0644, |
709 | .proc_handler = &proc_dointvec, | 693 | .proc_handler = proc_dointvec, |
694 | }, | ||
695 | { | ||
696 | .procname = "printk_delay", | ||
697 | .data = &printk_delay_msec, | ||
698 | .maxlen = sizeof(int), | ||
699 | .mode = 0644, | ||
700 | .proc_handler = proc_dointvec_minmax, | ||
701 | .extra1 = &zero, | ||
702 | .extra2 = &ten_thousand, | ||
703 | }, | ||
704 | { | ||
705 | .procname = "dmesg_restrict", | ||
706 | .data = &dmesg_restrict, | ||
707 | .maxlen = sizeof(int), | ||
708 | .mode = 0644, | ||
709 | .proc_handler = proc_dointvec_minmax, | ||
710 | .extra1 = &zero, | ||
711 | .extra2 = &one, | ||
710 | }, | 712 | }, |
711 | #endif | 713 | #endif |
712 | { | 714 | { |
713 | .ctl_name = KERN_NGROUPS_MAX, | ||
714 | .procname = "ngroups_max", | 715 | .procname = "ngroups_max", |
715 | .data = &ngroups_max, | 716 | .data = &ngroups_max, |
716 | .maxlen = sizeof (int), | 717 | .maxlen = sizeof (int), |
717 | .mode = 0444, | 718 | .mode = 0444, |
718 | .proc_handler = &proc_dointvec, | 719 | .proc_handler = proc_dointvec, |
719 | }, | 720 | }, |
720 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | 721 | #if defined(CONFIG_LOCKUP_DETECTOR) |
721 | { | 722 | { |
722 | .ctl_name = KERN_UNKNOWN_NMI_PANIC, | 723 | .procname = "watchdog", |
723 | .procname = "unknown_nmi_panic", | 724 | .data = &watchdog_enabled, |
724 | .data = &unknown_nmi_panic, | ||
725 | .maxlen = sizeof (int), | 725 | .maxlen = sizeof (int), |
726 | .mode = 0644, | 726 | .mode = 0644, |
727 | .proc_handler = &proc_dointvec, | 727 | .proc_handler = proc_dowatchdog_enabled, |
728 | }, | ||
729 | { | ||
730 | .procname = "watchdog_thresh", | ||
731 | .data = &softlockup_thresh, | ||
732 | .maxlen = sizeof(int), | ||
733 | .mode = 0644, | ||
734 | .proc_handler = proc_dowatchdog_thresh, | ||
735 | .extra1 = &neg_one, | ||
736 | .extra2 = &sixty, | ||
737 | }, | ||
738 | { | ||
739 | .procname = "softlockup_panic", | ||
740 | .data = &softlockup_panic, | ||
741 | .maxlen = sizeof(int), | ||
742 | .mode = 0644, | ||
743 | .proc_handler = proc_dointvec_minmax, | ||
744 | .extra1 = &zero, | ||
745 | .extra2 = &one, | ||
728 | }, | 746 | }, |
729 | { | 747 | { |
730 | .procname = "nmi_watchdog", | 748 | .procname = "nmi_watchdog", |
731 | .data = &nmi_watchdog_enabled, | 749 | .data = &watchdog_enabled, |
732 | .maxlen = sizeof (int), | 750 | .maxlen = sizeof (int), |
733 | .mode = 0644, | 751 | .mode = 0644, |
734 | .proc_handler = &proc_nmi_enabled, | 752 | .proc_handler = proc_dowatchdog_enabled, |
753 | }, | ||
754 | #endif | ||
755 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | ||
756 | { | ||
757 | .procname = "unknown_nmi_panic", | ||
758 | .data = &unknown_nmi_panic, | ||
759 | .maxlen = sizeof (int), | ||
760 | .mode = 0644, | ||
761 | .proc_handler = proc_dointvec, | ||
735 | }, | 762 | }, |
736 | #endif | 763 | #endif |
737 | #if defined(CONFIG_X86) | 764 | #if defined(CONFIG_X86) |
738 | { | 765 | { |
739 | .ctl_name = KERN_PANIC_ON_NMI, | ||
740 | .procname = "panic_on_unrecovered_nmi", | 766 | .procname = "panic_on_unrecovered_nmi", |
741 | .data = &panic_on_unrecovered_nmi, | 767 | .data = &panic_on_unrecovered_nmi, |
742 | .maxlen = sizeof(int), | 768 | .maxlen = sizeof(int), |
743 | .mode = 0644, | 769 | .mode = 0644, |
744 | .proc_handler = &proc_dointvec, | 770 | .proc_handler = proc_dointvec, |
771 | }, | ||
772 | { | ||
773 | .procname = "panic_on_io_nmi", | ||
774 | .data = &panic_on_io_nmi, | ||
775 | .maxlen = sizeof(int), | ||
776 | .mode = 0644, | ||
777 | .proc_handler = proc_dointvec, | ||
745 | }, | 778 | }, |
746 | { | 779 | { |
747 | .ctl_name = KERN_BOOTLOADER_TYPE, | ||
748 | .procname = "bootloader_type", | 780 | .procname = "bootloader_type", |
749 | .data = &bootloader_type, | 781 | .data = &bootloader_type, |
750 | .maxlen = sizeof (int), | 782 | .maxlen = sizeof (int), |
751 | .mode = 0444, | 783 | .mode = 0444, |
752 | .proc_handler = &proc_dointvec, | 784 | .proc_handler = proc_dointvec, |
753 | }, | 785 | }, |
754 | { | 786 | { |
755 | .ctl_name = CTL_UNNUMBERED, | ||
756 | .procname = "bootloader_version", | 787 | .procname = "bootloader_version", |
757 | .data = &bootloader_version, | 788 | .data = &bootloader_version, |
758 | .maxlen = sizeof (int), | 789 | .maxlen = sizeof (int), |
759 | .mode = 0444, | 790 | .mode = 0444, |
760 | .proc_handler = &proc_dointvec, | 791 | .proc_handler = proc_dointvec, |
761 | }, | 792 | }, |
762 | { | 793 | { |
763 | .ctl_name = CTL_UNNUMBERED, | ||
764 | .procname = "kstack_depth_to_print", | 794 | .procname = "kstack_depth_to_print", |
765 | .data = &kstack_depth_to_print, | 795 | .data = &kstack_depth_to_print, |
766 | .maxlen = sizeof(int), | 796 | .maxlen = sizeof(int), |
767 | .mode = 0644, | 797 | .mode = 0644, |
768 | .proc_handler = &proc_dointvec, | 798 | .proc_handler = proc_dointvec, |
769 | }, | 799 | }, |
770 | { | 800 | { |
771 | .ctl_name = CTL_UNNUMBERED, | ||
772 | .procname = "io_delay_type", | 801 | .procname = "io_delay_type", |
773 | .data = &io_delay_type, | 802 | .data = &io_delay_type, |
774 | .maxlen = sizeof(int), | 803 | .maxlen = sizeof(int), |
775 | .mode = 0644, | 804 | .mode = 0644, |
776 | .proc_handler = &proc_dointvec, | 805 | .proc_handler = proc_dointvec, |
777 | }, | 806 | }, |
778 | #endif | 807 | #endif |
779 | #if defined(CONFIG_MMU) | 808 | #if defined(CONFIG_MMU) |
780 | { | 809 | { |
781 | .ctl_name = KERN_RANDOMIZE, | ||
782 | .procname = "randomize_va_space", | 810 | .procname = "randomize_va_space", |
783 | .data = &randomize_va_space, | 811 | .data = &randomize_va_space, |
784 | .maxlen = sizeof(int), | 812 | .maxlen = sizeof(int), |
785 | .mode = 0644, | 813 | .mode = 0644, |
786 | .proc_handler = &proc_dointvec, | 814 | .proc_handler = proc_dointvec, |
787 | }, | 815 | }, |
788 | #endif | 816 | #endif |
789 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) | 817 | #if defined(CONFIG_S390) && defined(CONFIG_SMP) |
790 | { | 818 | { |
791 | .ctl_name = KERN_SPIN_RETRY, | ||
792 | .procname = "spin_retry", | 819 | .procname = "spin_retry", |
793 | .data = &spin_retry, | 820 | .data = &spin_retry, |
794 | .maxlen = sizeof (int), | 821 | .maxlen = sizeof (int), |
795 | .mode = 0644, | 822 | .mode = 0644, |
796 | .proc_handler = &proc_dointvec, | 823 | .proc_handler = proc_dointvec, |
797 | }, | 824 | }, |
798 | #endif | 825 | #endif |
799 | #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) | 826 | #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) |
@@ -802,123 +829,84 @@ static struct ctl_table kern_table[] = { | |||
802 | .data = &acpi_realmode_flags, | 829 | .data = &acpi_realmode_flags, |
803 | .maxlen = sizeof (unsigned long), | 830 | .maxlen = sizeof (unsigned long), |
804 | .mode = 0644, | 831 | .mode = 0644, |
805 | .proc_handler = &proc_doulongvec_minmax, | 832 | .proc_handler = proc_doulongvec_minmax, |
806 | }, | 833 | }, |
807 | #endif | 834 | #endif |
808 | #ifdef CONFIG_IA64 | 835 | #ifdef CONFIG_IA64 |
809 | { | 836 | { |
810 | .ctl_name = KERN_IA64_UNALIGNED, | ||
811 | .procname = "ignore-unaligned-usertrap", | 837 | .procname = "ignore-unaligned-usertrap", |
812 | .data = &no_unaligned_warning, | 838 | .data = &no_unaligned_warning, |
813 | .maxlen = sizeof (int), | 839 | .maxlen = sizeof (int), |
814 | .mode = 0644, | 840 | .mode = 0644, |
815 | .proc_handler = &proc_dointvec, | 841 | .proc_handler = proc_dointvec, |
816 | }, | 842 | }, |
817 | { | 843 | { |
818 | .ctl_name = CTL_UNNUMBERED, | ||
819 | .procname = "unaligned-dump-stack", | 844 | .procname = "unaligned-dump-stack", |
820 | .data = &unaligned_dump_stack, | 845 | .data = &unaligned_dump_stack, |
821 | .maxlen = sizeof (int), | 846 | .maxlen = sizeof (int), |
822 | .mode = 0644, | 847 | .mode = 0644, |
823 | .proc_handler = &proc_dointvec, | 848 | .proc_handler = proc_dointvec, |
824 | }, | ||
825 | #endif | ||
826 | #ifdef CONFIG_DETECT_SOFTLOCKUP | ||
827 | { | ||
828 | .ctl_name = CTL_UNNUMBERED, | ||
829 | .procname = "softlockup_panic", | ||
830 | .data = &softlockup_panic, | ||
831 | .maxlen = sizeof(int), | ||
832 | .mode = 0644, | ||
833 | .proc_handler = &proc_dointvec_minmax, | ||
834 | .strategy = &sysctl_intvec, | ||
835 | .extra1 = &zero, | ||
836 | .extra2 = &one, | ||
837 | }, | ||
838 | { | ||
839 | .ctl_name = CTL_UNNUMBERED, | ||
840 | .procname = "softlockup_thresh", | ||
841 | .data = &softlockup_thresh, | ||
842 | .maxlen = sizeof(int), | ||
843 | .mode = 0644, | ||
844 | .proc_handler = &proc_dosoftlockup_thresh, | ||
845 | .strategy = &sysctl_intvec, | ||
846 | .extra1 = &neg_one, | ||
847 | .extra2 = &sixty, | ||
848 | }, | 849 | }, |
849 | #endif | 850 | #endif |
850 | #ifdef CONFIG_DETECT_HUNG_TASK | 851 | #ifdef CONFIG_DETECT_HUNG_TASK |
851 | { | 852 | { |
852 | .ctl_name = CTL_UNNUMBERED, | ||
853 | .procname = "hung_task_panic", | 853 | .procname = "hung_task_panic", |
854 | .data = &sysctl_hung_task_panic, | 854 | .data = &sysctl_hung_task_panic, |
855 | .maxlen = sizeof(int), | 855 | .maxlen = sizeof(int), |
856 | .mode = 0644, | 856 | .mode = 0644, |
857 | .proc_handler = &proc_dointvec_minmax, | 857 | .proc_handler = proc_dointvec_minmax, |
858 | .strategy = &sysctl_intvec, | ||
859 | .extra1 = &zero, | 858 | .extra1 = &zero, |
860 | .extra2 = &one, | 859 | .extra2 = &one, |
861 | }, | 860 | }, |
862 | { | 861 | { |
863 | .ctl_name = CTL_UNNUMBERED, | ||
864 | .procname = "hung_task_check_count", | 862 | .procname = "hung_task_check_count", |
865 | .data = &sysctl_hung_task_check_count, | 863 | .data = &sysctl_hung_task_check_count, |
866 | .maxlen = sizeof(unsigned long), | 864 | .maxlen = sizeof(unsigned long), |
867 | .mode = 0644, | 865 | .mode = 0644, |
868 | .proc_handler = &proc_doulongvec_minmax, | 866 | .proc_handler = proc_doulongvec_minmax, |
869 | .strategy = &sysctl_intvec, | ||
870 | }, | 867 | }, |
871 | { | 868 | { |
872 | .ctl_name = CTL_UNNUMBERED, | ||
873 | .procname = "hung_task_timeout_secs", | 869 | .procname = "hung_task_timeout_secs", |
874 | .data = &sysctl_hung_task_timeout_secs, | 870 | .data = &sysctl_hung_task_timeout_secs, |
875 | .maxlen = sizeof(unsigned long), | 871 | .maxlen = sizeof(unsigned long), |
876 | .mode = 0644, | 872 | .mode = 0644, |
877 | .proc_handler = &proc_dohung_task_timeout_secs, | 873 | .proc_handler = proc_dohung_task_timeout_secs, |
878 | .strategy = &sysctl_intvec, | ||
879 | }, | 874 | }, |
880 | { | 875 | { |
881 | .ctl_name = CTL_UNNUMBERED, | ||
882 | .procname = "hung_task_warnings", | 876 | .procname = "hung_task_warnings", |
883 | .data = &sysctl_hung_task_warnings, | 877 | .data = &sysctl_hung_task_warnings, |
884 | .maxlen = sizeof(unsigned long), | 878 | .maxlen = sizeof(unsigned long), |
885 | .mode = 0644, | 879 | .mode = 0644, |
886 | .proc_handler = &proc_doulongvec_minmax, | 880 | .proc_handler = proc_doulongvec_minmax, |
887 | .strategy = &sysctl_intvec, | ||
888 | }, | 881 | }, |
889 | #endif | 882 | #endif |
890 | #ifdef CONFIG_COMPAT | 883 | #ifdef CONFIG_COMPAT |
891 | { | 884 | { |
892 | .ctl_name = KERN_COMPAT_LOG, | ||
893 | .procname = "compat-log", | 885 | .procname = "compat-log", |
894 | .data = &compat_log, | 886 | .data = &compat_log, |
895 | .maxlen = sizeof (int), | 887 | .maxlen = sizeof (int), |
896 | .mode = 0644, | 888 | .mode = 0644, |
897 | .proc_handler = &proc_dointvec, | 889 | .proc_handler = proc_dointvec, |
898 | }, | 890 | }, |
899 | #endif | 891 | #endif |
900 | #ifdef CONFIG_RT_MUTEXES | 892 | #ifdef CONFIG_RT_MUTEXES |
901 | { | 893 | { |
902 | .ctl_name = KERN_MAX_LOCK_DEPTH, | ||
903 | .procname = "max_lock_depth", | 894 | .procname = "max_lock_depth", |
904 | .data = &max_lock_depth, | 895 | .data = &max_lock_depth, |
905 | .maxlen = sizeof(int), | 896 | .maxlen = sizeof(int), |
906 | .mode = 0644, | 897 | .mode = 0644, |
907 | .proc_handler = &proc_dointvec, | 898 | .proc_handler = proc_dointvec, |
908 | }, | 899 | }, |
909 | #endif | 900 | #endif |
910 | { | 901 | { |
911 | .ctl_name = CTL_UNNUMBERED, | ||
912 | .procname = "poweroff_cmd", | 902 | .procname = "poweroff_cmd", |
913 | .data = &poweroff_cmd, | 903 | .data = &poweroff_cmd, |
914 | .maxlen = POWEROFF_CMD_PATH_LEN, | 904 | .maxlen = POWEROFF_CMD_PATH_LEN, |
915 | .mode = 0644, | 905 | .mode = 0644, |
916 | .proc_handler = &proc_dostring, | 906 | .proc_handler = proc_dostring, |
917 | .strategy = &sysctl_string, | ||
918 | }, | 907 | }, |
919 | #ifdef CONFIG_KEYS | 908 | #ifdef CONFIG_KEYS |
920 | { | 909 | { |
921 | .ctl_name = CTL_UNNUMBERED, | ||
922 | .procname = "keys", | 910 | .procname = "keys", |
923 | .mode = 0555, | 911 | .mode = 0555, |
924 | .child = key_sysctls, | 912 | .child = key_sysctls, |
@@ -926,155 +914,136 @@ static struct ctl_table kern_table[] = { | |||
926 | #endif | 914 | #endif |
927 | #ifdef CONFIG_RCU_TORTURE_TEST | 915 | #ifdef CONFIG_RCU_TORTURE_TEST |
928 | { | 916 | { |
929 | .ctl_name = CTL_UNNUMBERED, | ||
930 | .procname = "rcutorture_runnable", | 917 | .procname = "rcutorture_runnable", |
931 | .data = &rcutorture_runnable, | 918 | .data = &rcutorture_runnable, |
932 | .maxlen = sizeof(int), | 919 | .maxlen = sizeof(int), |
933 | .mode = 0644, | 920 | .mode = 0644, |
934 | .proc_handler = &proc_dointvec, | 921 | .proc_handler = proc_dointvec, |
935 | }, | ||
936 | #endif | ||
937 | #ifdef CONFIG_SLOW_WORK | ||
938 | { | ||
939 | .ctl_name = CTL_UNNUMBERED, | ||
940 | .procname = "slow-work", | ||
941 | .mode = 0555, | ||
942 | .child = slow_work_sysctls, | ||
943 | }, | 922 | }, |
944 | #endif | 923 | #endif |
945 | #ifdef CONFIG_PERF_COUNTERS | 924 | #ifdef CONFIG_PERF_EVENTS |
946 | { | 925 | { |
947 | .ctl_name = CTL_UNNUMBERED, | 926 | .procname = "perf_event_paranoid", |
948 | .procname = "perf_counter_paranoid", | 927 | .data = &sysctl_perf_event_paranoid, |
949 | .data = &sysctl_perf_counter_paranoid, | 928 | .maxlen = sizeof(sysctl_perf_event_paranoid), |
950 | .maxlen = sizeof(sysctl_perf_counter_paranoid), | ||
951 | .mode = 0644, | 929 | .mode = 0644, |
952 | .proc_handler = &proc_dointvec, | 930 | .proc_handler = proc_dointvec, |
953 | }, | 931 | }, |
954 | { | 932 | { |
955 | .ctl_name = CTL_UNNUMBERED, | 933 | .procname = "perf_event_mlock_kb", |
956 | .procname = "perf_counter_mlock_kb", | 934 | .data = &sysctl_perf_event_mlock, |
957 | .data = &sysctl_perf_counter_mlock, | 935 | .maxlen = sizeof(sysctl_perf_event_mlock), |
958 | .maxlen = sizeof(sysctl_perf_counter_mlock), | ||
959 | .mode = 0644, | 936 | .mode = 0644, |
960 | .proc_handler = &proc_dointvec, | 937 | .proc_handler = proc_dointvec, |
961 | }, | 938 | }, |
962 | { | 939 | { |
963 | .ctl_name = CTL_UNNUMBERED, | 940 | .procname = "perf_event_max_sample_rate", |
964 | .procname = "perf_counter_max_sample_rate", | 941 | .data = &sysctl_perf_event_sample_rate, |
965 | .data = &sysctl_perf_counter_sample_rate, | 942 | .maxlen = sizeof(sysctl_perf_event_sample_rate), |
966 | .maxlen = sizeof(sysctl_perf_counter_sample_rate), | ||
967 | .mode = 0644, | 943 | .mode = 0644, |
968 | .proc_handler = &proc_dointvec, | 944 | .proc_handler = proc_dointvec, |
969 | }, | 945 | }, |
970 | #endif | 946 | #endif |
971 | #ifdef CONFIG_KMEMCHECK | 947 | #ifdef CONFIG_KMEMCHECK |
972 | { | 948 | { |
973 | .ctl_name = CTL_UNNUMBERED, | ||
974 | .procname = "kmemcheck", | 949 | .procname = "kmemcheck", |
975 | .data = &kmemcheck_enabled, | 950 | .data = &kmemcheck_enabled, |
976 | .maxlen = sizeof(int), | 951 | .maxlen = sizeof(int), |
977 | .mode = 0644, | 952 | .mode = 0644, |
978 | .proc_handler = &proc_dointvec, | 953 | .proc_handler = proc_dointvec, |
954 | }, | ||
955 | #endif | ||
956 | #ifdef CONFIG_BLOCK | ||
957 | { | ||
958 | .procname = "blk_iopoll", | ||
959 | .data = &blk_iopoll_enabled, | ||
960 | .maxlen = sizeof(int), | ||
961 | .mode = 0644, | ||
962 | .proc_handler = proc_dointvec, | ||
979 | }, | 963 | }, |
980 | #endif | 964 | #endif |
981 | |||
982 | /* | 965 | /* |
983 | * NOTE: do not add new entries to this table unless you have read | 966 | * NOTE: do not add new entries to this table unless you have read |
984 | * Documentation/sysctl/ctl_unnumbered.txt | 967 | * Documentation/sysctl/ctl_unnumbered.txt |
985 | */ | 968 | */ |
986 | { .ctl_name = 0 } | 969 | { } |
987 | }; | 970 | }; |
988 | 971 | ||
989 | static struct ctl_table vm_table[] = { | 972 | static struct ctl_table vm_table[] = { |
990 | { | 973 | { |
991 | .ctl_name = VM_OVERCOMMIT_MEMORY, | ||
992 | .procname = "overcommit_memory", | 974 | .procname = "overcommit_memory", |
993 | .data = &sysctl_overcommit_memory, | 975 | .data = &sysctl_overcommit_memory, |
994 | .maxlen = sizeof(sysctl_overcommit_memory), | 976 | .maxlen = sizeof(sysctl_overcommit_memory), |
995 | .mode = 0644, | 977 | .mode = 0644, |
996 | .proc_handler = &proc_dointvec, | 978 | .proc_handler = proc_dointvec, |
997 | }, | 979 | }, |
998 | { | 980 | { |
999 | .ctl_name = VM_PANIC_ON_OOM, | ||
1000 | .procname = "panic_on_oom", | 981 | .procname = "panic_on_oom", |
1001 | .data = &sysctl_panic_on_oom, | 982 | .data = &sysctl_panic_on_oom, |
1002 | .maxlen = sizeof(sysctl_panic_on_oom), | 983 | .maxlen = sizeof(sysctl_panic_on_oom), |
1003 | .mode = 0644, | 984 | .mode = 0644, |
1004 | .proc_handler = &proc_dointvec, | 985 | .proc_handler = proc_dointvec, |
1005 | }, | 986 | }, |
1006 | { | 987 | { |
1007 | .ctl_name = CTL_UNNUMBERED, | ||
1008 | .procname = "oom_kill_allocating_task", | 988 | .procname = "oom_kill_allocating_task", |
1009 | .data = &sysctl_oom_kill_allocating_task, | 989 | .data = &sysctl_oom_kill_allocating_task, |
1010 | .maxlen = sizeof(sysctl_oom_kill_allocating_task), | 990 | .maxlen = sizeof(sysctl_oom_kill_allocating_task), |
1011 | .mode = 0644, | 991 | .mode = 0644, |
1012 | .proc_handler = &proc_dointvec, | 992 | .proc_handler = proc_dointvec, |
1013 | }, | 993 | }, |
1014 | { | 994 | { |
1015 | .ctl_name = CTL_UNNUMBERED, | ||
1016 | .procname = "oom_dump_tasks", | 995 | .procname = "oom_dump_tasks", |
1017 | .data = &sysctl_oom_dump_tasks, | 996 | .data = &sysctl_oom_dump_tasks, |
1018 | .maxlen = sizeof(sysctl_oom_dump_tasks), | 997 | .maxlen = sizeof(sysctl_oom_dump_tasks), |
1019 | .mode = 0644, | 998 | .mode = 0644, |
1020 | .proc_handler = &proc_dointvec, | 999 | .proc_handler = proc_dointvec, |
1021 | }, | 1000 | }, |
1022 | { | 1001 | { |
1023 | .ctl_name = VM_OVERCOMMIT_RATIO, | ||
1024 | .procname = "overcommit_ratio", | 1002 | .procname = "overcommit_ratio", |
1025 | .data = &sysctl_overcommit_ratio, | 1003 | .data = &sysctl_overcommit_ratio, |
1026 | .maxlen = sizeof(sysctl_overcommit_ratio), | 1004 | .maxlen = sizeof(sysctl_overcommit_ratio), |
1027 | .mode = 0644, | 1005 | .mode = 0644, |
1028 | .proc_handler = &proc_dointvec, | 1006 | .proc_handler = proc_dointvec, |
1029 | }, | 1007 | }, |
1030 | { | 1008 | { |
1031 | .ctl_name = VM_PAGE_CLUSTER, | ||
1032 | .procname = "page-cluster", | 1009 | .procname = "page-cluster", |
1033 | .data = &page_cluster, | 1010 | .data = &page_cluster, |
1034 | .maxlen = sizeof(int), | 1011 | .maxlen = sizeof(int), |
1035 | .mode = 0644, | 1012 | .mode = 0644, |
1036 | .proc_handler = &proc_dointvec, | 1013 | .proc_handler = proc_dointvec, |
1037 | }, | 1014 | }, |
1038 | { | 1015 | { |
1039 | .ctl_name = VM_DIRTY_BACKGROUND, | ||
1040 | .procname = "dirty_background_ratio", | 1016 | .procname = "dirty_background_ratio", |
1041 | .data = &dirty_background_ratio, | 1017 | .data = &dirty_background_ratio, |
1042 | .maxlen = sizeof(dirty_background_ratio), | 1018 | .maxlen = sizeof(dirty_background_ratio), |
1043 | .mode = 0644, | 1019 | .mode = 0644, |
1044 | .proc_handler = &dirty_background_ratio_handler, | 1020 | .proc_handler = dirty_background_ratio_handler, |
1045 | .strategy = &sysctl_intvec, | ||
1046 | .extra1 = &zero, | 1021 | .extra1 = &zero, |
1047 | .extra2 = &one_hundred, | 1022 | .extra2 = &one_hundred, |
1048 | }, | 1023 | }, |
1049 | { | 1024 | { |
1050 | .ctl_name = CTL_UNNUMBERED, | ||
1051 | .procname = "dirty_background_bytes", | 1025 | .procname = "dirty_background_bytes", |
1052 | .data = &dirty_background_bytes, | 1026 | .data = &dirty_background_bytes, |
1053 | .maxlen = sizeof(dirty_background_bytes), | 1027 | .maxlen = sizeof(dirty_background_bytes), |
1054 | .mode = 0644, | 1028 | .mode = 0644, |
1055 | .proc_handler = &dirty_background_bytes_handler, | 1029 | .proc_handler = dirty_background_bytes_handler, |
1056 | .strategy = &sysctl_intvec, | ||
1057 | .extra1 = &one_ul, | 1030 | .extra1 = &one_ul, |
1058 | }, | 1031 | }, |
1059 | { | 1032 | { |
1060 | .ctl_name = VM_DIRTY_RATIO, | ||
1061 | .procname = "dirty_ratio", | 1033 | .procname = "dirty_ratio", |
1062 | .data = &vm_dirty_ratio, | 1034 | .data = &vm_dirty_ratio, |
1063 | .maxlen = sizeof(vm_dirty_ratio), | 1035 | .maxlen = sizeof(vm_dirty_ratio), |
1064 | .mode = 0644, | 1036 | .mode = 0644, |
1065 | .proc_handler = &dirty_ratio_handler, | 1037 | .proc_handler = dirty_ratio_handler, |
1066 | .strategy = &sysctl_intvec, | ||
1067 | .extra1 = &zero, | 1038 | .extra1 = &zero, |
1068 | .extra2 = &one_hundred, | 1039 | .extra2 = &one_hundred, |
1069 | }, | 1040 | }, |
1070 | { | 1041 | { |
1071 | .ctl_name = CTL_UNNUMBERED, | ||
1072 | .procname = "dirty_bytes", | 1042 | .procname = "dirty_bytes", |
1073 | .data = &vm_dirty_bytes, | 1043 | .data = &vm_dirty_bytes, |
1074 | .maxlen = sizeof(vm_dirty_bytes), | 1044 | .maxlen = sizeof(vm_dirty_bytes), |
1075 | .mode = 0644, | 1045 | .mode = 0644, |
1076 | .proc_handler = &dirty_bytes_handler, | 1046 | .proc_handler = dirty_bytes_handler, |
1077 | .strategy = &sysctl_intvec, | ||
1078 | .extra1 = &dirty_bytes_min, | 1047 | .extra1 = &dirty_bytes_min, |
1079 | }, | 1048 | }, |
1080 | { | 1049 | { |
@@ -1082,383 +1051,384 @@ static struct ctl_table vm_table[] = { | |||
1082 | .data = &dirty_writeback_interval, | 1051 | .data = &dirty_writeback_interval, |
1083 | .maxlen = sizeof(dirty_writeback_interval), | 1052 | .maxlen = sizeof(dirty_writeback_interval), |
1084 | .mode = 0644, | 1053 | .mode = 0644, |
1085 | .proc_handler = &dirty_writeback_centisecs_handler, | 1054 | .proc_handler = dirty_writeback_centisecs_handler, |
1086 | }, | 1055 | }, |
1087 | { | 1056 | { |
1088 | .procname = "dirty_expire_centisecs", | 1057 | .procname = "dirty_expire_centisecs", |
1089 | .data = &dirty_expire_interval, | 1058 | .data = &dirty_expire_interval, |
1090 | .maxlen = sizeof(dirty_expire_interval), | 1059 | .maxlen = sizeof(dirty_expire_interval), |
1091 | .mode = 0644, | 1060 | .mode = 0644, |
1092 | .proc_handler = &proc_dointvec, | 1061 | .proc_handler = proc_dointvec, |
1093 | }, | 1062 | }, |
1094 | { | 1063 | { |
1095 | .ctl_name = VM_NR_PDFLUSH_THREADS, | ||
1096 | .procname = "nr_pdflush_threads", | 1064 | .procname = "nr_pdflush_threads", |
1097 | .data = &nr_pdflush_threads, | 1065 | .data = &nr_pdflush_threads, |
1098 | .maxlen = sizeof nr_pdflush_threads, | 1066 | .maxlen = sizeof nr_pdflush_threads, |
1099 | .mode = 0444 /* read-only*/, | 1067 | .mode = 0444 /* read-only*/, |
1100 | .proc_handler = &proc_dointvec, | 1068 | .proc_handler = proc_dointvec, |
1101 | }, | 1069 | }, |
1102 | { | 1070 | { |
1103 | .ctl_name = VM_SWAPPINESS, | ||
1104 | .procname = "swappiness", | 1071 | .procname = "swappiness", |
1105 | .data = &vm_swappiness, | 1072 | .data = &vm_swappiness, |
1106 | .maxlen = sizeof(vm_swappiness), | 1073 | .maxlen = sizeof(vm_swappiness), |
1107 | .mode = 0644, | 1074 | .mode = 0644, |
1108 | .proc_handler = &proc_dointvec_minmax, | 1075 | .proc_handler = proc_dointvec_minmax, |
1109 | .strategy = &sysctl_intvec, | ||
1110 | .extra1 = &zero, | 1076 | .extra1 = &zero, |
1111 | .extra2 = &one_hundred, | 1077 | .extra2 = &one_hundred, |
1112 | }, | 1078 | }, |
1113 | #ifdef CONFIG_HUGETLB_PAGE | 1079 | #ifdef CONFIG_HUGETLB_PAGE |
1114 | { | 1080 | { |
1115 | .procname = "nr_hugepages", | 1081 | .procname = "nr_hugepages", |
1116 | .data = NULL, | 1082 | .data = NULL, |
1117 | .maxlen = sizeof(unsigned long), | 1083 | .maxlen = sizeof(unsigned long), |
1118 | .mode = 0644, | 1084 | .mode = 0644, |
1119 | .proc_handler = &hugetlb_sysctl_handler, | 1085 | .proc_handler = hugetlb_sysctl_handler, |
1120 | .extra1 = (void *)&hugetlb_zero, | 1086 | .extra1 = (void *)&hugetlb_zero, |
1121 | .extra2 = (void *)&hugetlb_infinity, | 1087 | .extra2 = (void *)&hugetlb_infinity, |
1122 | }, | 1088 | }, |
1089 | #ifdef CONFIG_NUMA | ||
1090 | { | ||
1091 | .procname = "nr_hugepages_mempolicy", | ||
1092 | .data = NULL, | ||
1093 | .maxlen = sizeof(unsigned long), | ||
1094 | .mode = 0644, | ||
1095 | .proc_handler = &hugetlb_mempolicy_sysctl_handler, | ||
1096 | .extra1 = (void *)&hugetlb_zero, | ||
1097 | .extra2 = (void *)&hugetlb_infinity, | ||
1098 | }, | ||
1099 | #endif | ||
1123 | { | 1100 | { |
1124 | .ctl_name = VM_HUGETLB_GROUP, | ||
1125 | .procname = "hugetlb_shm_group", | 1101 | .procname = "hugetlb_shm_group", |
1126 | .data = &sysctl_hugetlb_shm_group, | 1102 | .data = &sysctl_hugetlb_shm_group, |
1127 | .maxlen = sizeof(gid_t), | 1103 | .maxlen = sizeof(gid_t), |
1128 | .mode = 0644, | 1104 | .mode = 0644, |
1129 | .proc_handler = &proc_dointvec, | 1105 | .proc_handler = proc_dointvec, |
1130 | }, | 1106 | }, |
1131 | { | 1107 | { |
1132 | .ctl_name = CTL_UNNUMBERED, | ||
1133 | .procname = "hugepages_treat_as_movable", | 1108 | .procname = "hugepages_treat_as_movable", |
1134 | .data = &hugepages_treat_as_movable, | 1109 | .data = &hugepages_treat_as_movable, |
1135 | .maxlen = sizeof(int), | 1110 | .maxlen = sizeof(int), |
1136 | .mode = 0644, | 1111 | .mode = 0644, |
1137 | .proc_handler = &hugetlb_treat_movable_handler, | 1112 | .proc_handler = hugetlb_treat_movable_handler, |
1138 | }, | 1113 | }, |
1139 | { | 1114 | { |
1140 | .ctl_name = CTL_UNNUMBERED, | ||
1141 | .procname = "nr_overcommit_hugepages", | 1115 | .procname = "nr_overcommit_hugepages", |
1142 | .data = NULL, | 1116 | .data = NULL, |
1143 | .maxlen = sizeof(unsigned long), | 1117 | .maxlen = sizeof(unsigned long), |
1144 | .mode = 0644, | 1118 | .mode = 0644, |
1145 | .proc_handler = &hugetlb_overcommit_handler, | 1119 | .proc_handler = hugetlb_overcommit_handler, |
1146 | .extra1 = (void *)&hugetlb_zero, | 1120 | .extra1 = (void *)&hugetlb_zero, |
1147 | .extra2 = (void *)&hugetlb_infinity, | 1121 | .extra2 = (void *)&hugetlb_infinity, |
1148 | }, | 1122 | }, |
1149 | #endif | 1123 | #endif |
1150 | { | 1124 | { |
1151 | .ctl_name = VM_LOWMEM_RESERVE_RATIO, | ||
1152 | .procname = "lowmem_reserve_ratio", | 1125 | .procname = "lowmem_reserve_ratio", |
1153 | .data = &sysctl_lowmem_reserve_ratio, | 1126 | .data = &sysctl_lowmem_reserve_ratio, |
1154 | .maxlen = sizeof(sysctl_lowmem_reserve_ratio), | 1127 | .maxlen = sizeof(sysctl_lowmem_reserve_ratio), |
1155 | .mode = 0644, | 1128 | .mode = 0644, |
1156 | .proc_handler = &lowmem_reserve_ratio_sysctl_handler, | 1129 | .proc_handler = lowmem_reserve_ratio_sysctl_handler, |
1157 | .strategy = &sysctl_intvec, | ||
1158 | }, | 1130 | }, |
1159 | { | 1131 | { |
1160 | .ctl_name = VM_DROP_PAGECACHE, | ||
1161 | .procname = "drop_caches", | 1132 | .procname = "drop_caches", |
1162 | .data = &sysctl_drop_caches, | 1133 | .data = &sysctl_drop_caches, |
1163 | .maxlen = sizeof(int), | 1134 | .maxlen = sizeof(int), |
1164 | .mode = 0644, | 1135 | .mode = 0644, |
1165 | .proc_handler = drop_caches_sysctl_handler, | 1136 | .proc_handler = drop_caches_sysctl_handler, |
1166 | .strategy = &sysctl_intvec, | 1137 | }, |
1138 | #ifdef CONFIG_COMPACTION | ||
1139 | { | ||
1140 | .procname = "compact_memory", | ||
1141 | .data = &sysctl_compact_memory, | ||
1142 | .maxlen = sizeof(int), | ||
1143 | .mode = 0200, | ||
1144 | .proc_handler = sysctl_compaction_handler, | ||
1167 | }, | 1145 | }, |
1168 | { | 1146 | { |
1169 | .ctl_name = VM_MIN_FREE_KBYTES, | 1147 | .procname = "extfrag_threshold", |
1148 | .data = &sysctl_extfrag_threshold, | ||
1149 | .maxlen = sizeof(int), | ||
1150 | .mode = 0644, | ||
1151 | .proc_handler = sysctl_extfrag_handler, | ||
1152 | .extra1 = &min_extfrag_threshold, | ||
1153 | .extra2 = &max_extfrag_threshold, | ||
1154 | }, | ||
1155 | |||
1156 | #endif /* CONFIG_COMPACTION */ | ||
1157 | { | ||
1170 | .procname = "min_free_kbytes", | 1158 | .procname = "min_free_kbytes", |
1171 | .data = &min_free_kbytes, | 1159 | .data = &min_free_kbytes, |
1172 | .maxlen = sizeof(min_free_kbytes), | 1160 | .maxlen = sizeof(min_free_kbytes), |
1173 | .mode = 0644, | 1161 | .mode = 0644, |
1174 | .proc_handler = &min_free_kbytes_sysctl_handler, | 1162 | .proc_handler = min_free_kbytes_sysctl_handler, |
1175 | .strategy = &sysctl_intvec, | ||
1176 | .extra1 = &zero, | 1163 | .extra1 = &zero, |
1177 | }, | 1164 | }, |
1178 | { | 1165 | { |
1179 | .ctl_name = VM_PERCPU_PAGELIST_FRACTION, | ||
1180 | .procname = "percpu_pagelist_fraction", | 1166 | .procname = "percpu_pagelist_fraction", |
1181 | .data = &percpu_pagelist_fraction, | 1167 | .data = &percpu_pagelist_fraction, |
1182 | .maxlen = sizeof(percpu_pagelist_fraction), | 1168 | .maxlen = sizeof(percpu_pagelist_fraction), |
1183 | .mode = 0644, | 1169 | .mode = 0644, |
1184 | .proc_handler = &percpu_pagelist_fraction_sysctl_handler, | 1170 | .proc_handler = percpu_pagelist_fraction_sysctl_handler, |
1185 | .strategy = &sysctl_intvec, | ||
1186 | .extra1 = &min_percpu_pagelist_fract, | 1171 | .extra1 = &min_percpu_pagelist_fract, |
1187 | }, | 1172 | }, |
1188 | #ifdef CONFIG_MMU | 1173 | #ifdef CONFIG_MMU |
1189 | { | 1174 | { |
1190 | .ctl_name = VM_MAX_MAP_COUNT, | ||
1191 | .procname = "max_map_count", | 1175 | .procname = "max_map_count", |
1192 | .data = &sysctl_max_map_count, | 1176 | .data = &sysctl_max_map_count, |
1193 | .maxlen = sizeof(sysctl_max_map_count), | 1177 | .maxlen = sizeof(sysctl_max_map_count), |
1194 | .mode = 0644, | 1178 | .mode = 0644, |
1195 | .proc_handler = &proc_dointvec | 1179 | .proc_handler = proc_dointvec_minmax, |
1180 | .extra1 = &zero, | ||
1196 | }, | 1181 | }, |
1197 | #else | 1182 | #else |
1198 | { | 1183 | { |
1199 | .ctl_name = CTL_UNNUMBERED, | ||
1200 | .procname = "nr_trim_pages", | 1184 | .procname = "nr_trim_pages", |
1201 | .data = &sysctl_nr_trim_pages, | 1185 | .data = &sysctl_nr_trim_pages, |
1202 | .maxlen = sizeof(sysctl_nr_trim_pages), | 1186 | .maxlen = sizeof(sysctl_nr_trim_pages), |
1203 | .mode = 0644, | 1187 | .mode = 0644, |
1204 | .proc_handler = &proc_dointvec_minmax, | 1188 | .proc_handler = proc_dointvec_minmax, |
1205 | .strategy = &sysctl_intvec, | ||
1206 | .extra1 = &zero, | 1189 | .extra1 = &zero, |
1207 | }, | 1190 | }, |
1208 | #endif | 1191 | #endif |
1209 | { | 1192 | { |
1210 | .ctl_name = VM_LAPTOP_MODE, | ||
1211 | .procname = "laptop_mode", | 1193 | .procname = "laptop_mode", |
1212 | .data = &laptop_mode, | 1194 | .data = &laptop_mode, |
1213 | .maxlen = sizeof(laptop_mode), | 1195 | .maxlen = sizeof(laptop_mode), |
1214 | .mode = 0644, | 1196 | .mode = 0644, |
1215 | .proc_handler = &proc_dointvec_jiffies, | 1197 | .proc_handler = proc_dointvec_jiffies, |
1216 | .strategy = &sysctl_jiffies, | ||
1217 | }, | 1198 | }, |
1218 | { | 1199 | { |
1219 | .ctl_name = VM_BLOCK_DUMP, | ||
1220 | .procname = "block_dump", | 1200 | .procname = "block_dump", |
1221 | .data = &block_dump, | 1201 | .data = &block_dump, |
1222 | .maxlen = sizeof(block_dump), | 1202 | .maxlen = sizeof(block_dump), |
1223 | .mode = 0644, | 1203 | .mode = 0644, |
1224 | .proc_handler = &proc_dointvec, | 1204 | .proc_handler = proc_dointvec, |
1225 | .strategy = &sysctl_intvec, | ||
1226 | .extra1 = &zero, | 1205 | .extra1 = &zero, |
1227 | }, | 1206 | }, |
1228 | { | 1207 | { |
1229 | .ctl_name = VM_VFS_CACHE_PRESSURE, | ||
1230 | .procname = "vfs_cache_pressure", | 1208 | .procname = "vfs_cache_pressure", |
1231 | .data = &sysctl_vfs_cache_pressure, | 1209 | .data = &sysctl_vfs_cache_pressure, |
1232 | .maxlen = sizeof(sysctl_vfs_cache_pressure), | 1210 | .maxlen = sizeof(sysctl_vfs_cache_pressure), |
1233 | .mode = 0644, | 1211 | .mode = 0644, |
1234 | .proc_handler = &proc_dointvec, | 1212 | .proc_handler = proc_dointvec, |
1235 | .strategy = &sysctl_intvec, | ||
1236 | .extra1 = &zero, | 1213 | .extra1 = &zero, |
1237 | }, | 1214 | }, |
1238 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT | 1215 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
1239 | { | 1216 | { |
1240 | .ctl_name = VM_LEGACY_VA_LAYOUT, | ||
1241 | .procname = "legacy_va_layout", | 1217 | .procname = "legacy_va_layout", |
1242 | .data = &sysctl_legacy_va_layout, | 1218 | .data = &sysctl_legacy_va_layout, |
1243 | .maxlen = sizeof(sysctl_legacy_va_layout), | 1219 | .maxlen = sizeof(sysctl_legacy_va_layout), |
1244 | .mode = 0644, | 1220 | .mode = 0644, |
1245 | .proc_handler = &proc_dointvec, | 1221 | .proc_handler = proc_dointvec, |
1246 | .strategy = &sysctl_intvec, | ||
1247 | .extra1 = &zero, | 1222 | .extra1 = &zero, |
1248 | }, | 1223 | }, |
1249 | #endif | 1224 | #endif |
1250 | #ifdef CONFIG_NUMA | 1225 | #ifdef CONFIG_NUMA |
1251 | { | 1226 | { |
1252 | .ctl_name = VM_ZONE_RECLAIM_MODE, | ||
1253 | .procname = "zone_reclaim_mode", | 1227 | .procname = "zone_reclaim_mode", |
1254 | .data = &zone_reclaim_mode, | 1228 | .data = &zone_reclaim_mode, |
1255 | .maxlen = sizeof(zone_reclaim_mode), | 1229 | .maxlen = sizeof(zone_reclaim_mode), |
1256 | .mode = 0644, | 1230 | .mode = 0644, |
1257 | .proc_handler = &proc_dointvec, | 1231 | .proc_handler = proc_dointvec, |
1258 | .strategy = &sysctl_intvec, | ||
1259 | .extra1 = &zero, | 1232 | .extra1 = &zero, |
1260 | }, | 1233 | }, |
1261 | { | 1234 | { |
1262 | .ctl_name = VM_MIN_UNMAPPED, | ||
1263 | .procname = "min_unmapped_ratio", | 1235 | .procname = "min_unmapped_ratio", |
1264 | .data = &sysctl_min_unmapped_ratio, | 1236 | .data = &sysctl_min_unmapped_ratio, |
1265 | .maxlen = sizeof(sysctl_min_unmapped_ratio), | 1237 | .maxlen = sizeof(sysctl_min_unmapped_ratio), |
1266 | .mode = 0644, | 1238 | .mode = 0644, |
1267 | .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler, | 1239 | .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler, |
1268 | .strategy = &sysctl_intvec, | ||
1269 | .extra1 = &zero, | 1240 | .extra1 = &zero, |
1270 | .extra2 = &one_hundred, | 1241 | .extra2 = &one_hundred, |
1271 | }, | 1242 | }, |
1272 | { | 1243 | { |
1273 | .ctl_name = VM_MIN_SLAB, | ||
1274 | .procname = "min_slab_ratio", | 1244 | .procname = "min_slab_ratio", |
1275 | .data = &sysctl_min_slab_ratio, | 1245 | .data = &sysctl_min_slab_ratio, |
1276 | .maxlen = sizeof(sysctl_min_slab_ratio), | 1246 | .maxlen = sizeof(sysctl_min_slab_ratio), |
1277 | .mode = 0644, | 1247 | .mode = 0644, |
1278 | .proc_handler = &sysctl_min_slab_ratio_sysctl_handler, | 1248 | .proc_handler = sysctl_min_slab_ratio_sysctl_handler, |
1279 | .strategy = &sysctl_intvec, | ||
1280 | .extra1 = &zero, | 1249 | .extra1 = &zero, |
1281 | .extra2 = &one_hundred, | 1250 | .extra2 = &one_hundred, |
1282 | }, | 1251 | }, |
1283 | #endif | 1252 | #endif |
1284 | #ifdef CONFIG_SMP | 1253 | #ifdef CONFIG_SMP |
1285 | { | 1254 | { |
1286 | .ctl_name = CTL_UNNUMBERED, | ||
1287 | .procname = "stat_interval", | 1255 | .procname = "stat_interval", |
1288 | .data = &sysctl_stat_interval, | 1256 | .data = &sysctl_stat_interval, |
1289 | .maxlen = sizeof(sysctl_stat_interval), | 1257 | .maxlen = sizeof(sysctl_stat_interval), |
1290 | .mode = 0644, | 1258 | .mode = 0644, |
1291 | .proc_handler = &proc_dointvec_jiffies, | 1259 | .proc_handler = proc_dointvec_jiffies, |
1292 | .strategy = &sysctl_jiffies, | ||
1293 | }, | 1260 | }, |
1294 | #endif | 1261 | #endif |
1262 | #ifdef CONFIG_MMU | ||
1295 | { | 1263 | { |
1296 | .ctl_name = CTL_UNNUMBERED, | ||
1297 | .procname = "mmap_min_addr", | 1264 | .procname = "mmap_min_addr", |
1298 | .data = &mmap_min_addr, | 1265 | .data = &dac_mmap_min_addr, |
1299 | .maxlen = sizeof(unsigned long), | 1266 | .maxlen = sizeof(unsigned long), |
1300 | .mode = 0644, | 1267 | .mode = 0644, |
1301 | .proc_handler = &proc_doulongvec_minmax, | 1268 | .proc_handler = mmap_min_addr_handler, |
1302 | }, | 1269 | }, |
1270 | #endif | ||
1303 | #ifdef CONFIG_NUMA | 1271 | #ifdef CONFIG_NUMA |
1304 | { | 1272 | { |
1305 | .ctl_name = CTL_UNNUMBERED, | ||
1306 | .procname = "numa_zonelist_order", | 1273 | .procname = "numa_zonelist_order", |
1307 | .data = &numa_zonelist_order, | 1274 | .data = &numa_zonelist_order, |
1308 | .maxlen = NUMA_ZONELIST_ORDER_LEN, | 1275 | .maxlen = NUMA_ZONELIST_ORDER_LEN, |
1309 | .mode = 0644, | 1276 | .mode = 0644, |
1310 | .proc_handler = &numa_zonelist_order_handler, | 1277 | .proc_handler = numa_zonelist_order_handler, |
1311 | .strategy = &sysctl_string, | ||
1312 | }, | 1278 | }, |
1313 | #endif | 1279 | #endif |
1314 | #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ | 1280 | #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ |
1315 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) | 1281 | (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) |
1316 | { | 1282 | { |
1317 | .ctl_name = VM_VDSO_ENABLED, | ||
1318 | .procname = "vdso_enabled", | 1283 | .procname = "vdso_enabled", |
1319 | .data = &vdso_enabled, | 1284 | .data = &vdso_enabled, |
1320 | .maxlen = sizeof(vdso_enabled), | 1285 | .maxlen = sizeof(vdso_enabled), |
1321 | .mode = 0644, | 1286 | .mode = 0644, |
1322 | .proc_handler = &proc_dointvec, | 1287 | .proc_handler = proc_dointvec, |
1323 | .strategy = &sysctl_intvec, | ||
1324 | .extra1 = &zero, | 1288 | .extra1 = &zero, |
1325 | }, | 1289 | }, |
1326 | #endif | 1290 | #endif |
1327 | #ifdef CONFIG_HIGHMEM | 1291 | #ifdef CONFIG_HIGHMEM |
1328 | { | 1292 | { |
1329 | .ctl_name = CTL_UNNUMBERED, | ||
1330 | .procname = "highmem_is_dirtyable", | 1293 | .procname = "highmem_is_dirtyable", |
1331 | .data = &vm_highmem_is_dirtyable, | 1294 | .data = &vm_highmem_is_dirtyable, |
1332 | .maxlen = sizeof(vm_highmem_is_dirtyable), | 1295 | .maxlen = sizeof(vm_highmem_is_dirtyable), |
1333 | .mode = 0644, | 1296 | .mode = 0644, |
1334 | .proc_handler = &proc_dointvec_minmax, | 1297 | .proc_handler = proc_dointvec_minmax, |
1335 | .strategy = &sysctl_intvec, | ||
1336 | .extra1 = &zero, | 1298 | .extra1 = &zero, |
1337 | .extra2 = &one, | 1299 | .extra2 = &one, |
1338 | }, | 1300 | }, |
1339 | #endif | 1301 | #endif |
1340 | { | 1302 | { |
1341 | .ctl_name = CTL_UNNUMBERED, | ||
1342 | .procname = "scan_unevictable_pages", | 1303 | .procname = "scan_unevictable_pages", |
1343 | .data = &scan_unevictable_pages, | 1304 | .data = &scan_unevictable_pages, |
1344 | .maxlen = sizeof(scan_unevictable_pages), | 1305 | .maxlen = sizeof(scan_unevictable_pages), |
1345 | .mode = 0644, | 1306 | .mode = 0644, |
1346 | .proc_handler = &scan_unevictable_handler, | 1307 | .proc_handler = scan_unevictable_handler, |
1347 | }, | 1308 | }, |
1309 | #ifdef CONFIG_MEMORY_FAILURE | ||
1310 | { | ||
1311 | .procname = "memory_failure_early_kill", | ||
1312 | .data = &sysctl_memory_failure_early_kill, | ||
1313 | .maxlen = sizeof(sysctl_memory_failure_early_kill), | ||
1314 | .mode = 0644, | ||
1315 | .proc_handler = proc_dointvec_minmax, | ||
1316 | .extra1 = &zero, | ||
1317 | .extra2 = &one, | ||
1318 | }, | ||
1319 | { | ||
1320 | .procname = "memory_failure_recovery", | ||
1321 | .data = &sysctl_memory_failure_recovery, | ||
1322 | .maxlen = sizeof(sysctl_memory_failure_recovery), | ||
1323 | .mode = 0644, | ||
1324 | .proc_handler = proc_dointvec_minmax, | ||
1325 | .extra1 = &zero, | ||
1326 | .extra2 = &one, | ||
1327 | }, | ||
1328 | #endif | ||
1329 | |||
1348 | /* | 1330 | /* |
1349 | * NOTE: do not add new entries to this table unless you have read | 1331 | * NOTE: do not add new entries to this table unless you have read |
1350 | * Documentation/sysctl/ctl_unnumbered.txt | 1332 | * Documentation/sysctl/ctl_unnumbered.txt |
1351 | */ | 1333 | */ |
1352 | { .ctl_name = 0 } | 1334 | { } |
1353 | }; | 1335 | }; |
1354 | 1336 | ||
1355 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) | 1337 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
1356 | static struct ctl_table binfmt_misc_table[] = { | 1338 | static struct ctl_table binfmt_misc_table[] = { |
1357 | { .ctl_name = 0 } | 1339 | { } |
1358 | }; | 1340 | }; |
1359 | #endif | 1341 | #endif |
1360 | 1342 | ||
1361 | static struct ctl_table fs_table[] = { | 1343 | static struct ctl_table fs_table[] = { |
1362 | { | 1344 | { |
1363 | .ctl_name = FS_NRINODE, | ||
1364 | .procname = "inode-nr", | 1345 | .procname = "inode-nr", |
1365 | .data = &inodes_stat, | 1346 | .data = &inodes_stat, |
1366 | .maxlen = 2*sizeof(int), | 1347 | .maxlen = 2*sizeof(int), |
1367 | .mode = 0444, | 1348 | .mode = 0444, |
1368 | .proc_handler = &proc_dointvec, | 1349 | .proc_handler = proc_nr_inodes, |
1369 | }, | 1350 | }, |
1370 | { | 1351 | { |
1371 | .ctl_name = FS_STATINODE, | ||
1372 | .procname = "inode-state", | 1352 | .procname = "inode-state", |
1373 | .data = &inodes_stat, | 1353 | .data = &inodes_stat, |
1374 | .maxlen = 7*sizeof(int), | 1354 | .maxlen = 7*sizeof(int), |
1375 | .mode = 0444, | 1355 | .mode = 0444, |
1376 | .proc_handler = &proc_dointvec, | 1356 | .proc_handler = proc_nr_inodes, |
1377 | }, | 1357 | }, |
1378 | { | 1358 | { |
1379 | .procname = "file-nr", | 1359 | .procname = "file-nr", |
1380 | .data = &files_stat, | 1360 | .data = &files_stat, |
1381 | .maxlen = 3*sizeof(int), | 1361 | .maxlen = sizeof(files_stat), |
1382 | .mode = 0444, | 1362 | .mode = 0444, |
1383 | .proc_handler = &proc_nr_files, | 1363 | .proc_handler = proc_nr_files, |
1384 | }, | 1364 | }, |
1385 | { | 1365 | { |
1386 | .ctl_name = FS_MAXFILE, | ||
1387 | .procname = "file-max", | 1366 | .procname = "file-max", |
1388 | .data = &files_stat.max_files, | 1367 | .data = &files_stat.max_files, |
1389 | .maxlen = sizeof(int), | 1368 | .maxlen = sizeof(files_stat.max_files), |
1390 | .mode = 0644, | 1369 | .mode = 0644, |
1391 | .proc_handler = &proc_dointvec, | 1370 | .proc_handler = proc_doulongvec_minmax, |
1392 | }, | 1371 | }, |
1393 | { | 1372 | { |
1394 | .ctl_name = CTL_UNNUMBERED, | ||
1395 | .procname = "nr_open", | 1373 | .procname = "nr_open", |
1396 | .data = &sysctl_nr_open, | 1374 | .data = &sysctl_nr_open, |
1397 | .maxlen = sizeof(int), | 1375 | .maxlen = sizeof(int), |
1398 | .mode = 0644, | 1376 | .mode = 0644, |
1399 | .proc_handler = &proc_dointvec_minmax, | 1377 | .proc_handler = proc_dointvec_minmax, |
1400 | .extra1 = &sysctl_nr_open_min, | 1378 | .extra1 = &sysctl_nr_open_min, |
1401 | .extra2 = &sysctl_nr_open_max, | 1379 | .extra2 = &sysctl_nr_open_max, |
1402 | }, | 1380 | }, |
1403 | { | 1381 | { |
1404 | .ctl_name = FS_DENTRY, | ||
1405 | .procname = "dentry-state", | 1382 | .procname = "dentry-state", |
1406 | .data = &dentry_stat, | 1383 | .data = &dentry_stat, |
1407 | .maxlen = 6*sizeof(int), | 1384 | .maxlen = 6*sizeof(int), |
1408 | .mode = 0444, | 1385 | .mode = 0444, |
1409 | .proc_handler = &proc_dointvec, | 1386 | .proc_handler = proc_nr_dentry, |
1410 | }, | 1387 | }, |
1411 | { | 1388 | { |
1412 | .ctl_name = FS_OVERFLOWUID, | ||
1413 | .procname = "overflowuid", | 1389 | .procname = "overflowuid", |
1414 | .data = &fs_overflowuid, | 1390 | .data = &fs_overflowuid, |
1415 | .maxlen = sizeof(int), | 1391 | .maxlen = sizeof(int), |
1416 | .mode = 0644, | 1392 | .mode = 0644, |
1417 | .proc_handler = &proc_dointvec_minmax, | 1393 | .proc_handler = proc_dointvec_minmax, |
1418 | .strategy = &sysctl_intvec, | ||
1419 | .extra1 = &minolduid, | 1394 | .extra1 = &minolduid, |
1420 | .extra2 = &maxolduid, | 1395 | .extra2 = &maxolduid, |
1421 | }, | 1396 | }, |
1422 | { | 1397 | { |
1423 | .ctl_name = FS_OVERFLOWGID, | ||
1424 | .procname = "overflowgid", | 1398 | .procname = "overflowgid", |
1425 | .data = &fs_overflowgid, | 1399 | .data = &fs_overflowgid, |
1426 | .maxlen = sizeof(int), | 1400 | .maxlen = sizeof(int), |
1427 | .mode = 0644, | 1401 | .mode = 0644, |
1428 | .proc_handler = &proc_dointvec_minmax, | 1402 | .proc_handler = proc_dointvec_minmax, |
1429 | .strategy = &sysctl_intvec, | ||
1430 | .extra1 = &minolduid, | 1403 | .extra1 = &minolduid, |
1431 | .extra2 = &maxolduid, | 1404 | .extra2 = &maxolduid, |
1432 | }, | 1405 | }, |
1433 | #ifdef CONFIG_FILE_LOCKING | 1406 | #ifdef CONFIG_FILE_LOCKING |
1434 | { | 1407 | { |
1435 | .ctl_name = FS_LEASES, | ||
1436 | .procname = "leases-enable", | 1408 | .procname = "leases-enable", |
1437 | .data = &leases_enable, | 1409 | .data = &leases_enable, |
1438 | .maxlen = sizeof(int), | 1410 | .maxlen = sizeof(int), |
1439 | .mode = 0644, | 1411 | .mode = 0644, |
1440 | .proc_handler = &proc_dointvec, | 1412 | .proc_handler = proc_dointvec, |
1441 | }, | 1413 | }, |
1442 | #endif | 1414 | #endif |
1443 | #ifdef CONFIG_DNOTIFY | 1415 | #ifdef CONFIG_DNOTIFY |
1444 | { | 1416 | { |
1445 | .ctl_name = FS_DIR_NOTIFY, | ||
1446 | .procname = "dir-notify-enable", | 1417 | .procname = "dir-notify-enable", |
1447 | .data = &dir_notify_enable, | 1418 | .data = &dir_notify_enable, |
1448 | .maxlen = sizeof(int), | 1419 | .maxlen = sizeof(int), |
1449 | .mode = 0644, | 1420 | .mode = 0644, |
1450 | .proc_handler = &proc_dointvec, | 1421 | .proc_handler = proc_dointvec, |
1451 | }, | 1422 | }, |
1452 | #endif | 1423 | #endif |
1453 | #ifdef CONFIG_MMU | 1424 | #ifdef CONFIG_MMU |
1454 | #ifdef CONFIG_FILE_LOCKING | 1425 | #ifdef CONFIG_FILE_LOCKING |
1455 | { | 1426 | { |
1456 | .ctl_name = FS_LEASE_TIME, | ||
1457 | .procname = "lease-break-time", | 1427 | .procname = "lease-break-time", |
1458 | .data = &lease_break_time, | 1428 | .data = &lease_break_time, |
1459 | .maxlen = sizeof(int), | 1429 | .maxlen = sizeof(int), |
1460 | .mode = 0644, | 1430 | .mode = 0644, |
1461 | .proc_handler = &proc_dointvec, | 1431 | .proc_handler = proc_dointvec, |
1462 | }, | 1432 | }, |
1463 | #endif | 1433 | #endif |
1464 | #ifdef CONFIG_AIO | 1434 | #ifdef CONFIG_AIO |
@@ -1467,19 +1437,18 @@ static struct ctl_table fs_table[] = { | |||
1467 | .data = &aio_nr, | 1437 | .data = &aio_nr, |
1468 | .maxlen = sizeof(aio_nr), | 1438 | .maxlen = sizeof(aio_nr), |
1469 | .mode = 0444, | 1439 | .mode = 0444, |
1470 | .proc_handler = &proc_doulongvec_minmax, | 1440 | .proc_handler = proc_doulongvec_minmax, |
1471 | }, | 1441 | }, |
1472 | { | 1442 | { |
1473 | .procname = "aio-max-nr", | 1443 | .procname = "aio-max-nr", |
1474 | .data = &aio_max_nr, | 1444 | .data = &aio_max_nr, |
1475 | .maxlen = sizeof(aio_max_nr), | 1445 | .maxlen = sizeof(aio_max_nr), |
1476 | .mode = 0644, | 1446 | .mode = 0644, |
1477 | .proc_handler = &proc_doulongvec_minmax, | 1447 | .proc_handler = proc_doulongvec_minmax, |
1478 | }, | 1448 | }, |
1479 | #endif /* CONFIG_AIO */ | 1449 | #endif /* CONFIG_AIO */ |
1480 | #ifdef CONFIG_INOTIFY_USER | 1450 | #ifdef CONFIG_INOTIFY_USER |
1481 | { | 1451 | { |
1482 | .ctl_name = FS_INOTIFY, | ||
1483 | .procname = "inotify", | 1452 | .procname = "inotify", |
1484 | .mode = 0555, | 1453 | .mode = 0555, |
1485 | .child = inotify_table, | 1454 | .child = inotify_table, |
@@ -1494,35 +1463,40 @@ static struct ctl_table fs_table[] = { | |||
1494 | #endif | 1463 | #endif |
1495 | #endif | 1464 | #endif |
1496 | { | 1465 | { |
1497 | .ctl_name = KERN_SETUID_DUMPABLE, | ||
1498 | .procname = "suid_dumpable", | 1466 | .procname = "suid_dumpable", |
1499 | .data = &suid_dumpable, | 1467 | .data = &suid_dumpable, |
1500 | .maxlen = sizeof(int), | 1468 | .maxlen = sizeof(int), |
1501 | .mode = 0644, | 1469 | .mode = 0644, |
1502 | .proc_handler = &proc_dointvec_minmax, | 1470 | .proc_handler = proc_dointvec_minmax, |
1503 | .strategy = &sysctl_intvec, | ||
1504 | .extra1 = &zero, | 1471 | .extra1 = &zero, |
1505 | .extra2 = &two, | 1472 | .extra2 = &two, |
1506 | }, | 1473 | }, |
1507 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) | 1474 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) |
1508 | { | 1475 | { |
1509 | .ctl_name = CTL_UNNUMBERED, | ||
1510 | .procname = "binfmt_misc", | 1476 | .procname = "binfmt_misc", |
1511 | .mode = 0555, | 1477 | .mode = 0555, |
1512 | .child = binfmt_misc_table, | 1478 | .child = binfmt_misc_table, |
1513 | }, | 1479 | }, |
1514 | #endif | 1480 | #endif |
1481 | { | ||
1482 | .procname = "pipe-max-size", | ||
1483 | .data = &pipe_max_size, | ||
1484 | .maxlen = sizeof(int), | ||
1485 | .mode = 0644, | ||
1486 | .proc_handler = &pipe_proc_fn, | ||
1487 | .extra1 = &pipe_min_size, | ||
1488 | }, | ||
1515 | /* | 1489 | /* |
1516 | * NOTE: do not add new entries to this table unless you have read | 1490 | * NOTE: do not add new entries to this table unless you have read |
1517 | * Documentation/sysctl/ctl_unnumbered.txt | 1491 | * Documentation/sysctl/ctl_unnumbered.txt |
1518 | */ | 1492 | */ |
1519 | { .ctl_name = 0 } | 1493 | { } |
1520 | }; | 1494 | }; |
1521 | 1495 | ||
1522 | static struct ctl_table debug_table[] = { | 1496 | static struct ctl_table debug_table[] = { |
1523 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) | 1497 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ |
1498 | defined(CONFIG_S390) | ||
1524 | { | 1499 | { |
1525 | .ctl_name = CTL_UNNUMBERED, | ||
1526 | .procname = "exception-trace", | 1500 | .procname = "exception-trace", |
1527 | .data = &show_unhandled_signals, | 1501 | .data = &show_unhandled_signals, |
1528 | .maxlen = sizeof(int), | 1502 | .maxlen = sizeof(int), |
@@ -1530,11 +1504,22 @@ static struct ctl_table debug_table[] = { | |||
1530 | .proc_handler = proc_dointvec | 1504 | .proc_handler = proc_dointvec |
1531 | }, | 1505 | }, |
1532 | #endif | 1506 | #endif |
1533 | { .ctl_name = 0 } | 1507 | #if defined(CONFIG_OPTPROBES) |
1508 | { | ||
1509 | .procname = "kprobes-optimization", | ||
1510 | .data = &sysctl_kprobes_optimization, | ||
1511 | .maxlen = sizeof(int), | ||
1512 | .mode = 0644, | ||
1513 | .proc_handler = proc_kprobes_optimization_handler, | ||
1514 | .extra1 = &zero, | ||
1515 | .extra2 = &one, | ||
1516 | }, | ||
1517 | #endif | ||
1518 | { } | ||
1534 | }; | 1519 | }; |
1535 | 1520 | ||
1536 | static struct ctl_table dev_table[] = { | 1521 | static struct ctl_table dev_table[] = { |
1537 | { .ctl_name = 0 } | 1522 | { } |
1538 | }; | 1523 | }; |
1539 | 1524 | ||
1540 | static DEFINE_SPINLOCK(sysctl_lock); | 1525 | static DEFINE_SPINLOCK(sysctl_lock); |
@@ -1688,122 +1673,6 @@ void register_sysctl_root(struct ctl_table_root *root) | |||
1688 | spin_unlock(&sysctl_lock); | 1673 | spin_unlock(&sysctl_lock); |
1689 | } | 1674 | } |
1690 | 1675 | ||
1691 | #ifdef CONFIG_SYSCTL_SYSCALL | ||
1692 | /* Perform the actual read/write of a sysctl table entry. */ | ||
1693 | static int do_sysctl_strategy(struct ctl_table_root *root, | ||
1694 | struct ctl_table *table, | ||
1695 | void __user *oldval, size_t __user *oldlenp, | ||
1696 | void __user *newval, size_t newlen) | ||
1697 | { | ||
1698 | int op = 0, rc; | ||
1699 | |||
1700 | if (oldval) | ||
1701 | op |= MAY_READ; | ||
1702 | if (newval) | ||
1703 | op |= MAY_WRITE; | ||
1704 | if (sysctl_perm(root, table, op)) | ||
1705 | return -EPERM; | ||
1706 | |||
1707 | if (table->strategy) { | ||
1708 | rc = table->strategy(table, oldval, oldlenp, newval, newlen); | ||
1709 | if (rc < 0) | ||
1710 | return rc; | ||
1711 | if (rc > 0) | ||
1712 | return 0; | ||
1713 | } | ||
1714 | |||
1715 | /* If there is no strategy routine, or if the strategy returns | ||
1716 | * zero, proceed with automatic r/w */ | ||
1717 | if (table->data && table->maxlen) { | ||
1718 | rc = sysctl_data(table, oldval, oldlenp, newval, newlen); | ||
1719 | if (rc < 0) | ||
1720 | return rc; | ||
1721 | } | ||
1722 | return 0; | ||
1723 | } | ||
1724 | |||
1725 | static int parse_table(int __user *name, int nlen, | ||
1726 | void __user *oldval, size_t __user *oldlenp, | ||
1727 | void __user *newval, size_t newlen, | ||
1728 | struct ctl_table_root *root, | ||
1729 | struct ctl_table *table) | ||
1730 | { | ||
1731 | int n; | ||
1732 | repeat: | ||
1733 | if (!nlen) | ||
1734 | return -ENOTDIR; | ||
1735 | if (get_user(n, name)) | ||
1736 | return -EFAULT; | ||
1737 | for ( ; table->ctl_name || table->procname; table++) { | ||
1738 | if (!table->ctl_name) | ||
1739 | continue; | ||
1740 | if (n == table->ctl_name) { | ||
1741 | int error; | ||
1742 | if (table->child) { | ||
1743 | if (sysctl_perm(root, table, MAY_EXEC)) | ||
1744 | return -EPERM; | ||
1745 | name++; | ||
1746 | nlen--; | ||
1747 | table = table->child; | ||
1748 | goto repeat; | ||
1749 | } | ||
1750 | error = do_sysctl_strategy(root, table, | ||
1751 | oldval, oldlenp, | ||
1752 | newval, newlen); | ||
1753 | return error; | ||
1754 | } | ||
1755 | } | ||
1756 | return -ENOTDIR; | ||
1757 | } | ||
1758 | |||
1759 | int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp, | ||
1760 | void __user *newval, size_t newlen) | ||
1761 | { | ||
1762 | struct ctl_table_header *head; | ||
1763 | int error = -ENOTDIR; | ||
1764 | |||
1765 | if (nlen <= 0 || nlen >= CTL_MAXNAME) | ||
1766 | return -ENOTDIR; | ||
1767 | if (oldval) { | ||
1768 | int old_len; | ||
1769 | if (!oldlenp || get_user(old_len, oldlenp)) | ||
1770 | return -EFAULT; | ||
1771 | } | ||
1772 | |||
1773 | for (head = sysctl_head_next(NULL); head; | ||
1774 | head = sysctl_head_next(head)) { | ||
1775 | error = parse_table(name, nlen, oldval, oldlenp, | ||
1776 | newval, newlen, | ||
1777 | head->root, head->ctl_table); | ||
1778 | if (error != -ENOTDIR) { | ||
1779 | sysctl_head_finish(head); | ||
1780 | break; | ||
1781 | } | ||
1782 | } | ||
1783 | return error; | ||
1784 | } | ||
1785 | |||
1786 | SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) | ||
1787 | { | ||
1788 | struct __sysctl_args tmp; | ||
1789 | int error; | ||
1790 | |||
1791 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
1792 | return -EFAULT; | ||
1793 | |||
1794 | error = deprecated_sysctl_warning(&tmp); | ||
1795 | if (error) | ||
1796 | goto out; | ||
1797 | |||
1798 | lock_kernel(); | ||
1799 | error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp, | ||
1800 | tmp.newval, tmp.newlen); | ||
1801 | unlock_kernel(); | ||
1802 | out: | ||
1803 | return error; | ||
1804 | } | ||
1805 | #endif /* CONFIG_SYSCTL_SYSCALL */ | ||
1806 | |||
1807 | /* | 1676 | /* |
1808 | * sysctl_perm does NOT grant the superuser all rights automatically, because | 1677 | * sysctl_perm does NOT grant the superuser all rights automatically, because |
1809 | * some sysctl variables are readonly even to root. | 1678 | * some sysctl variables are readonly even to root. |
@@ -1839,7 +1708,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op) | |||
1839 | 1708 | ||
1840 | static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) | 1709 | static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) |
1841 | { | 1710 | { |
1842 | for (; table->ctl_name || table->procname; table++) { | 1711 | for (; table->procname; table++) { |
1843 | table->parent = parent; | 1712 | table->parent = parent; |
1844 | if (table->child) | 1713 | if (table->child) |
1845 | sysctl_set_parent(table, table->child); | 1714 | sysctl_set_parent(table, table->child); |
@@ -1850,10 +1719,7 @@ static __init int sysctl_init(void) | |||
1850 | { | 1719 | { |
1851 | sysctl_set_parent(NULL, root_table); | 1720 | sysctl_set_parent(NULL, root_table); |
1852 | #ifdef CONFIG_SYSCTL_SYSCALL_CHECK | 1721 | #ifdef CONFIG_SYSCTL_SYSCALL_CHECK |
1853 | { | 1722 | sysctl_check_table(current->nsproxy, root_table); |
1854 | int err; | ||
1855 | err = sysctl_check_table(current->nsproxy, root_table); | ||
1856 | } | ||
1857 | #endif | 1723 | #endif |
1858 | return 0; | 1724 | return 0; |
1859 | } | 1725 | } |
@@ -1871,11 +1737,11 @@ static struct ctl_table *is_branch_in(struct ctl_table *branch, | |||
1871 | return NULL; | 1737 | return NULL; |
1872 | 1738 | ||
1873 | /* ... and nothing else */ | 1739 | /* ... and nothing else */ |
1874 | if (branch[1].procname || branch[1].ctl_name) | 1740 | if (branch[1].procname) |
1875 | return NULL; | 1741 | return NULL; |
1876 | 1742 | ||
1877 | /* table should contain subdirectory with the same name */ | 1743 | /* table should contain subdirectory with the same name */ |
1878 | for (p = table; p->procname || p->ctl_name; p++) { | 1744 | for (p = table; p->procname; p++) { |
1879 | if (!p->child) | 1745 | if (!p->child) |
1880 | continue; | 1746 | continue; |
1881 | if (p->procname && strcmp(p->procname, s) == 0) | 1747 | if (p->procname && strcmp(p->procname, s) == 0) |
@@ -1920,9 +1786,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) | |||
1920 | * | 1786 | * |
1921 | * The members of the &struct ctl_table structure are used as follows: | 1787 | * The members of the &struct ctl_table structure are used as follows: |
1922 | * | 1788 | * |
1923 | * ctl_name - This is the numeric sysctl value used by sysctl(2). The number | ||
1924 | * must be unique within that level of sysctl | ||
1925 | * | ||
1926 | * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not | 1789 | * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not |
1927 | * enter a sysctl file | 1790 | * enter a sysctl file |
1928 | * | 1791 | * |
@@ -1937,8 +1800,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) | |||
1937 | * | 1800 | * |
1938 | * proc_handler - the text handler routine (described below) | 1801 | * proc_handler - the text handler routine (described below) |
1939 | * | 1802 | * |
1940 | * strategy - the strategy routine (described below) | ||
1941 | * | ||
1942 | * de - for internal use by the sysctl routines | 1803 | * de - for internal use by the sysctl routines |
1943 | * | 1804 | * |
1944 | * extra1, extra2 - extra pointers usable by the proc handler routines | 1805 | * extra1, extra2 - extra pointers usable by the proc handler routines |
@@ -1951,19 +1812,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q) | |||
1951 | * struct enable minimal validation of the values being written to be | 1812 | * struct enable minimal validation of the values being written to be |
1952 | * performed, and the mode field allows minimal authentication. | 1813 | * performed, and the mode field allows minimal authentication. |
1953 | * | 1814 | * |
1954 | * More sophisticated management can be enabled by the provision of a | ||
1955 | * strategy routine with the table entry. This will be called before | ||
1956 | * any automatic read or write of the data is performed. | ||
1957 | * | ||
1958 | * The strategy routine may return | ||
1959 | * | ||
1960 | * < 0 - Error occurred (error is passed to user process) | ||
1961 | * | ||
1962 | * 0 - OK - proceed with automatic read or write. | ||
1963 | * | ||
1964 | * > 0 - OK - read or write has been done by the strategy routine, so | ||
1965 | * return immediately. | ||
1966 | * | ||
1967 | * There must be a proc_handler routine for any terminal nodes | 1815 | * There must be a proc_handler routine for any terminal nodes |
1968 | * mirrored under /proc/sys (non-terminals are handled by a built-in | 1816 | * mirrored under /proc/sys (non-terminals are handled by a built-in |
1969 | * directory handler). Several default handlers are available to | 1817 | * directory handler). Several default handlers are available to |
@@ -1990,13 +1838,13 @@ struct ctl_table_header *__register_sysctl_paths( | |||
1990 | struct ctl_table_set *set; | 1838 | struct ctl_table_set *set; |
1991 | 1839 | ||
1992 | /* Count the path components */ | 1840 | /* Count the path components */ |
1993 | for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath) | 1841 | for (npath = 0; path[npath].procname; ++npath) |
1994 | ; | 1842 | ; |
1995 | 1843 | ||
1996 | /* | 1844 | /* |
1997 | * For each path component, allocate a 2-element ctl_table array. | 1845 | * For each path component, allocate a 2-element ctl_table array. |
1998 | * The first array element will be filled with the sysctl entry | 1846 | * The first array element will be filled with the sysctl entry |
1999 | * for this, the second will be the sentinel (ctl_name == 0). | 1847 | * for this, the second will be the sentinel (procname == 0). |
2000 | * | 1848 | * |
2001 | * We allocate everything in one go so that we don't have to | 1849 | * We allocate everything in one go so that we don't have to |
2002 | * worry about freeing additional memory in unregister_sysctl_table. | 1850 | * worry about freeing additional memory in unregister_sysctl_table. |
@@ -2013,7 +1861,6 @@ struct ctl_table_header *__register_sysctl_paths( | |||
2013 | for (n = 0; n < npath; ++n, ++path) { | 1861 | for (n = 0; n < npath; ++n, ++path) { |
2014 | /* Copy the procname */ | 1862 | /* Copy the procname */ |
2015 | new->procname = path->procname; | 1863 | new->procname = path->procname; |
2016 | new->ctl_name = path->ctl_name; | ||
2017 | new->mode = 0555; | 1864 | new->mode = 0555; |
2018 | 1865 | ||
2019 | *prevp = new; | 1866 | *prevp = new; |
@@ -2173,7 +2020,7 @@ void sysctl_head_put(struct ctl_table_header *head) | |||
2173 | #ifdef CONFIG_PROC_SYSCTL | 2020 | #ifdef CONFIG_PROC_SYSCTL |
2174 | 2021 | ||
2175 | static int _proc_do_string(void* data, int maxlen, int write, | 2022 | static int _proc_do_string(void* data, int maxlen, int write, |
2176 | struct file *filp, void __user *buffer, | 2023 | void __user *buffer, |
2177 | size_t *lenp, loff_t *ppos) | 2024 | size_t *lenp, loff_t *ppos) |
2178 | { | 2025 | { |
2179 | size_t len; | 2026 | size_t len; |
@@ -2234,7 +2081,6 @@ static int _proc_do_string(void* data, int maxlen, int write, | |||
2234 | * proc_dostring - read a string sysctl | 2081 | * proc_dostring - read a string sysctl |
2235 | * @table: the sysctl table | 2082 | * @table: the sysctl table |
2236 | * @write: %TRUE if this is a write to the sysctl file | 2083 | * @write: %TRUE if this is a write to the sysctl file |
2237 | * @filp: the file structure | ||
2238 | * @buffer: the user buffer | 2084 | * @buffer: the user buffer |
2239 | * @lenp: the size of the user buffer | 2085 | * @lenp: the size of the user buffer |
2240 | * @ppos: file position | 2086 | * @ppos: file position |
@@ -2248,15 +2094,139 @@ static int _proc_do_string(void* data, int maxlen, int write, | |||
2248 | * | 2094 | * |
2249 | * Returns 0 on success. | 2095 | * Returns 0 on success. |
2250 | */ | 2096 | */ |
2251 | int proc_dostring(struct ctl_table *table, int write, struct file *filp, | 2097 | int proc_dostring(struct ctl_table *table, int write, |
2252 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2098 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2253 | { | 2099 | { |
2254 | return _proc_do_string(table->data, table->maxlen, write, filp, | 2100 | return _proc_do_string(table->data, table->maxlen, write, |
2255 | buffer, lenp, ppos); | 2101 | buffer, lenp, ppos); |
2256 | } | 2102 | } |
2257 | 2103 | ||
2104 | static size_t proc_skip_spaces(char **buf) | ||
2105 | { | ||
2106 | size_t ret; | ||
2107 | char *tmp = skip_spaces(*buf); | ||
2108 | ret = tmp - *buf; | ||
2109 | *buf = tmp; | ||
2110 | return ret; | ||
2111 | } | ||
2112 | |||
2113 | static void proc_skip_char(char **buf, size_t *size, const char v) | ||
2114 | { | ||
2115 | while (*size) { | ||
2116 | if (**buf != v) | ||
2117 | break; | ||
2118 | (*size)--; | ||
2119 | (*buf)++; | ||
2120 | } | ||
2121 | } | ||
2122 | |||
2123 | #define TMPBUFLEN 22 | ||
2124 | /** | ||
2125 | * proc_get_long - reads an ASCII formatted integer from a user buffer | ||
2126 | * | ||
2127 | * @buf: a kernel buffer | ||
2128 | * @size: size of the kernel buffer | ||
2129 | * @val: this is where the number will be stored | ||
2130 | * @neg: set to %TRUE if number is negative | ||
2131 | * @perm_tr: a vector which contains the allowed trailers | ||
2132 | * @perm_tr_len: size of the perm_tr vector | ||
2133 | * @tr: pointer to store the trailer character | ||
2134 | * | ||
2135 | * In case of success %0 is returned and @buf and @size are updated with | ||
2136 | * the amount of bytes read. If @tr is non-NULL and a trailing | ||
2137 | * character exists (size is non-zero after returning from this | ||
2138 | * function), @tr is updated with the trailing character. | ||
2139 | */ | ||
2140 | static int proc_get_long(char **buf, size_t *size, | ||
2141 | unsigned long *val, bool *neg, | ||
2142 | const char *perm_tr, unsigned perm_tr_len, char *tr) | ||
2143 | { | ||
2144 | int len; | ||
2145 | char *p, tmp[TMPBUFLEN]; | ||
2146 | |||
2147 | if (!*size) | ||
2148 | return -EINVAL; | ||
2149 | |||
2150 | len = *size; | ||
2151 | if (len > TMPBUFLEN - 1) | ||
2152 | len = TMPBUFLEN - 1; | ||
2153 | |||
2154 | memcpy(tmp, *buf, len); | ||
2155 | |||
2156 | tmp[len] = 0; | ||
2157 | p = tmp; | ||
2158 | if (*p == '-' && *size > 1) { | ||
2159 | *neg = true; | ||
2160 | p++; | ||
2161 | } else | ||
2162 | *neg = false; | ||
2163 | if (!isdigit(*p)) | ||
2164 | return -EINVAL; | ||
2165 | |||
2166 | *val = simple_strtoul(p, &p, 0); | ||
2167 | |||
2168 | len = p - tmp; | ||
2169 | |||
2170 | /* We don't know if the next char is whitespace thus we may accept | ||
2171 | * invalid integers (e.g. 1234...a) or two integers instead of one | ||
2172 | * (e.g. 123...1). So lets not allow such large numbers. */ | ||
2173 | if (len == TMPBUFLEN - 1) | ||
2174 | return -EINVAL; | ||
2175 | |||
2176 | if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len)) | ||
2177 | return -EINVAL; | ||
2178 | |||
2179 | if (tr && (len < *size)) | ||
2180 | *tr = *p; | ||
2181 | |||
2182 | *buf += len; | ||
2183 | *size -= len; | ||
2184 | |||
2185 | return 0; | ||
2186 | } | ||
2187 | |||
2188 | /** | ||
2189 | * proc_put_long - converts an integer to a decimal ASCII formatted string | ||
2190 | * | ||
2191 | * @buf: the user buffer | ||
2192 | * @size: the size of the user buffer | ||
2193 | * @val: the integer to be converted | ||
2194 | * @neg: sign of the number, %TRUE for negative | ||
2195 | * | ||
2196 | * In case of success %0 is returned and @buf and @size are updated with | ||
2197 | * the amount of bytes written. | ||
2198 | */ | ||
2199 | static int proc_put_long(void __user **buf, size_t *size, unsigned long val, | ||
2200 | bool neg) | ||
2201 | { | ||
2202 | int len; | ||
2203 | char tmp[TMPBUFLEN], *p = tmp; | ||
2204 | |||
2205 | sprintf(p, "%s%lu", neg ? "-" : "", val); | ||
2206 | len = strlen(tmp); | ||
2207 | if (len > *size) | ||
2208 | len = *size; | ||
2209 | if (copy_to_user(*buf, tmp, len)) | ||
2210 | return -EFAULT; | ||
2211 | *size -= len; | ||
2212 | *buf += len; | ||
2213 | return 0; | ||
2214 | } | ||
2215 | #undef TMPBUFLEN | ||
2216 | |||
2217 | static int proc_put_char(void __user **buf, size_t *size, char c) | ||
2218 | { | ||
2219 | if (*size) { | ||
2220 | char __user **buffer = (char __user **)buf; | ||
2221 | if (put_user(c, *buffer)) | ||
2222 | return -EFAULT; | ||
2223 | (*size)--, (*buffer)++; | ||
2224 | *buf = *buffer; | ||
2225 | } | ||
2226 | return 0; | ||
2227 | } | ||
2258 | 2228 | ||
2259 | static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp, | 2229 | static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp, |
2260 | int *valp, | 2230 | int *valp, |
2261 | int write, void *data) | 2231 | int write, void *data) |
2262 | { | 2232 | { |
@@ -2265,33 +2235,31 @@ static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp, | |||
2265 | } else { | 2235 | } else { |
2266 | int val = *valp; | 2236 | int val = *valp; |
2267 | if (val < 0) { | 2237 | if (val < 0) { |
2268 | *negp = -1; | 2238 | *negp = true; |
2269 | *lvalp = (unsigned long)-val; | 2239 | *lvalp = (unsigned long)-val; |
2270 | } else { | 2240 | } else { |
2271 | *negp = 0; | 2241 | *negp = false; |
2272 | *lvalp = (unsigned long)val; | 2242 | *lvalp = (unsigned long)val; |
2273 | } | 2243 | } |
2274 | } | 2244 | } |
2275 | return 0; | 2245 | return 0; |
2276 | } | 2246 | } |
2277 | 2247 | ||
2248 | static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; | ||
2249 | |||
2278 | static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, | 2250 | static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, |
2279 | int write, struct file *filp, void __user *buffer, | 2251 | int write, void __user *buffer, |
2280 | size_t *lenp, loff_t *ppos, | 2252 | size_t *lenp, loff_t *ppos, |
2281 | int (*conv)(int *negp, unsigned long *lvalp, int *valp, | 2253 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
2282 | int write, void *data), | 2254 | int write, void *data), |
2283 | void *data) | 2255 | void *data) |
2284 | { | 2256 | { |
2285 | #define TMPBUFLEN 21 | 2257 | int *i, vleft, first = 1, err = 0; |
2286 | int *i, vleft, first = 1, neg; | 2258 | unsigned long page = 0; |
2287 | unsigned long lval; | 2259 | size_t left; |
2288 | size_t left, len; | 2260 | char *kbuf; |
2289 | 2261 | ||
2290 | char buf[TMPBUFLEN], *p; | 2262 | if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { |
2291 | char __user *s = buffer; | ||
2292 | |||
2293 | if (!tbl_data || !table->maxlen || !*lenp || | ||
2294 | (*ppos && !write)) { | ||
2295 | *lenp = 0; | 2263 | *lenp = 0; |
2296 | return 0; | 2264 | return 0; |
2297 | } | 2265 | } |
@@ -2303,93 +2271,75 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, | |||
2303 | if (!conv) | 2271 | if (!conv) |
2304 | conv = do_proc_dointvec_conv; | 2272 | conv = do_proc_dointvec_conv; |
2305 | 2273 | ||
2274 | if (write) { | ||
2275 | if (left > PAGE_SIZE - 1) | ||
2276 | left = PAGE_SIZE - 1; | ||
2277 | page = __get_free_page(GFP_TEMPORARY); | ||
2278 | kbuf = (char *) page; | ||
2279 | if (!kbuf) | ||
2280 | return -ENOMEM; | ||
2281 | if (copy_from_user(kbuf, buffer, left)) { | ||
2282 | err = -EFAULT; | ||
2283 | goto free; | ||
2284 | } | ||
2285 | kbuf[left] = 0; | ||
2286 | } | ||
2287 | |||
2306 | for (; left && vleft--; i++, first=0) { | 2288 | for (; left && vleft--; i++, first=0) { |
2289 | unsigned long lval; | ||
2290 | bool neg; | ||
2291 | |||
2307 | if (write) { | 2292 | if (write) { |
2308 | while (left) { | 2293 | left -= proc_skip_spaces(&kbuf); |
2309 | char c; | 2294 | |
2310 | if (get_user(c, s)) | ||
2311 | return -EFAULT; | ||
2312 | if (!isspace(c)) | ||
2313 | break; | ||
2314 | left--; | ||
2315 | s++; | ||
2316 | } | ||
2317 | if (!left) | 2295 | if (!left) |
2318 | break; | 2296 | break; |
2319 | neg = 0; | 2297 | err = proc_get_long(&kbuf, &left, &lval, &neg, |
2320 | len = left; | 2298 | proc_wspace_sep, |
2321 | if (len > sizeof(buf) - 1) | 2299 | sizeof(proc_wspace_sep), NULL); |
2322 | len = sizeof(buf) - 1; | 2300 | if (err) |
2323 | if (copy_from_user(buf, s, len)) | ||
2324 | return -EFAULT; | ||
2325 | buf[len] = 0; | ||
2326 | p = buf; | ||
2327 | if (*p == '-' && left > 1) { | ||
2328 | neg = 1; | ||
2329 | p++; | ||
2330 | } | ||
2331 | if (*p < '0' || *p > '9') | ||
2332 | break; | 2301 | break; |
2333 | 2302 | if (conv(&neg, &lval, i, 1, data)) { | |
2334 | lval = simple_strtoul(p, &p, 0); | 2303 | err = -EINVAL; |
2335 | |||
2336 | len = p-buf; | ||
2337 | if ((len < left) && *p && !isspace(*p)) | ||
2338 | break; | ||
2339 | s += len; | ||
2340 | left -= len; | ||
2341 | |||
2342 | if (conv(&neg, &lval, i, 1, data)) | ||
2343 | break; | 2304 | break; |
2305 | } | ||
2344 | } else { | 2306 | } else { |
2345 | p = buf; | 2307 | if (conv(&neg, &lval, i, 0, data)) { |
2308 | err = -EINVAL; | ||
2309 | break; | ||
2310 | } | ||
2346 | if (!first) | 2311 | if (!first) |
2347 | *p++ = '\t'; | 2312 | err = proc_put_char(&buffer, &left, '\t'); |
2348 | 2313 | if (err) | |
2349 | if (conv(&neg, &lval, i, 0, data)) | 2314 | break; |
2315 | err = proc_put_long(&buffer, &left, lval, neg); | ||
2316 | if (err) | ||
2350 | break; | 2317 | break; |
2351 | |||
2352 | sprintf(p, "%s%lu", neg ? "-" : "", lval); | ||
2353 | len = strlen(buf); | ||
2354 | if (len > left) | ||
2355 | len = left; | ||
2356 | if(copy_to_user(s, buf, len)) | ||
2357 | return -EFAULT; | ||
2358 | left -= len; | ||
2359 | s += len; | ||
2360 | } | 2318 | } |
2361 | } | 2319 | } |
2362 | 2320 | ||
2363 | if (!write && !first && left) { | 2321 | if (!write && !first && left && !err) |
2364 | if(put_user('\n', s)) | 2322 | err = proc_put_char(&buffer, &left, '\n'); |
2365 | return -EFAULT; | 2323 | if (write && !err && left) |
2366 | left--, s++; | 2324 | left -= proc_skip_spaces(&kbuf); |
2367 | } | 2325 | free: |
2368 | if (write) { | 2326 | if (write) { |
2369 | while (left) { | 2327 | free_page(page); |
2370 | char c; | 2328 | if (first) |
2371 | if (get_user(c, s++)) | 2329 | return err ? : -EINVAL; |
2372 | return -EFAULT; | ||
2373 | if (!isspace(c)) | ||
2374 | break; | ||
2375 | left--; | ||
2376 | } | ||
2377 | } | 2330 | } |
2378 | if (write && first) | ||
2379 | return -EINVAL; | ||
2380 | *lenp -= left; | 2331 | *lenp -= left; |
2381 | *ppos += *lenp; | 2332 | *ppos += *lenp; |
2382 | return 0; | 2333 | return err; |
2383 | #undef TMPBUFLEN | ||
2384 | } | 2334 | } |
2385 | 2335 | ||
2386 | static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp, | 2336 | static int do_proc_dointvec(struct ctl_table *table, int write, |
2387 | void __user *buffer, size_t *lenp, loff_t *ppos, | 2337 | void __user *buffer, size_t *lenp, loff_t *ppos, |
2388 | int (*conv)(int *negp, unsigned long *lvalp, int *valp, | 2338 | int (*conv)(bool *negp, unsigned long *lvalp, int *valp, |
2389 | int write, void *data), | 2339 | int write, void *data), |
2390 | void *data) | 2340 | void *data) |
2391 | { | 2341 | { |
2392 | return __do_proc_dointvec(table->data, table, write, filp, | 2342 | return __do_proc_dointvec(table->data, table, write, |
2393 | buffer, lenp, ppos, conv, data); | 2343 | buffer, lenp, ppos, conv, data); |
2394 | } | 2344 | } |
2395 | 2345 | ||
@@ -2397,7 +2347,6 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil | |||
2397 | * proc_dointvec - read a vector of integers | 2347 | * proc_dointvec - read a vector of integers |
2398 | * @table: the sysctl table | 2348 | * @table: the sysctl table |
2399 | * @write: %TRUE if this is a write to the sysctl file | 2349 | * @write: %TRUE if this is a write to the sysctl file |
2400 | * @filp: the file structure | ||
2401 | * @buffer: the user buffer | 2350 | * @buffer: the user buffer |
2402 | * @lenp: the size of the user buffer | 2351 | * @lenp: the size of the user buffer |
2403 | * @ppos: file position | 2352 | * @ppos: file position |
@@ -2407,10 +2356,10 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil | |||
2407 | * | 2356 | * |
2408 | * Returns 0 on success. | 2357 | * Returns 0 on success. |
2409 | */ | 2358 | */ |
2410 | int proc_dointvec(struct ctl_table *table, int write, struct file *filp, | 2359 | int proc_dointvec(struct ctl_table *table, int write, |
2411 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2360 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2412 | { | 2361 | { |
2413 | return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, | 2362 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
2414 | NULL,NULL); | 2363 | NULL,NULL); |
2415 | } | 2364 | } |
2416 | 2365 | ||
@@ -2418,7 +2367,7 @@ int proc_dointvec(struct ctl_table *table, int write, struct file *filp, | |||
2418 | * Taint values can only be increased | 2367 | * Taint values can only be increased |
2419 | * This means we can safely use a temporary. | 2368 | * This means we can safely use a temporary. |
2420 | */ | 2369 | */ |
2421 | static int proc_taint(struct ctl_table *table, int write, struct file *filp, | 2370 | static int proc_taint(struct ctl_table *table, int write, |
2422 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2371 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2423 | { | 2372 | { |
2424 | struct ctl_table t; | 2373 | struct ctl_table t; |
@@ -2430,7 +2379,7 @@ static int proc_taint(struct ctl_table *table, int write, struct file *filp, | |||
2430 | 2379 | ||
2431 | t = *table; | 2380 | t = *table; |
2432 | t.data = &tmptaint; | 2381 | t.data = &tmptaint; |
2433 | err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos); | 2382 | err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos); |
2434 | if (err < 0) | 2383 | if (err < 0) |
2435 | return err; | 2384 | return err; |
2436 | 2385 | ||
@@ -2454,8 +2403,8 @@ struct do_proc_dointvec_minmax_conv_param { | |||
2454 | int *max; | 2403 | int *max; |
2455 | }; | 2404 | }; |
2456 | 2405 | ||
2457 | static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, | 2406 | static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, |
2458 | int *valp, | 2407 | int *valp, |
2459 | int write, void *data) | 2408 | int write, void *data) |
2460 | { | 2409 | { |
2461 | struct do_proc_dointvec_minmax_conv_param *param = data; | 2410 | struct do_proc_dointvec_minmax_conv_param *param = data; |
@@ -2468,10 +2417,10 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, | |||
2468 | } else { | 2417 | } else { |
2469 | int val = *valp; | 2418 | int val = *valp; |
2470 | if (val < 0) { | 2419 | if (val < 0) { |
2471 | *negp = -1; | 2420 | *negp = true; |
2472 | *lvalp = (unsigned long)-val; | 2421 | *lvalp = (unsigned long)-val; |
2473 | } else { | 2422 | } else { |
2474 | *negp = 0; | 2423 | *negp = false; |
2475 | *lvalp = (unsigned long)val; | 2424 | *lvalp = (unsigned long)val; |
2476 | } | 2425 | } |
2477 | } | 2426 | } |
@@ -2482,7 +2431,6 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, | |||
2482 | * proc_dointvec_minmax - read a vector of integers with min/max values | 2431 | * proc_dointvec_minmax - read a vector of integers with min/max values |
2483 | * @table: the sysctl table | 2432 | * @table: the sysctl table |
2484 | * @write: %TRUE if this is a write to the sysctl file | 2433 | * @write: %TRUE if this is a write to the sysctl file |
2485 | * @filp: the file structure | ||
2486 | * @buffer: the user buffer | 2434 | * @buffer: the user buffer |
2487 | * @lenp: the size of the user buffer | 2435 | * @lenp: the size of the user buffer |
2488 | * @ppos: file position | 2436 | * @ppos: file position |
@@ -2495,138 +2443,111 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp, | |||
2495 | * | 2443 | * |
2496 | * Returns 0 on success. | 2444 | * Returns 0 on success. |
2497 | */ | 2445 | */ |
2498 | int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp, | 2446 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
2499 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2447 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2500 | { | 2448 | { |
2501 | struct do_proc_dointvec_minmax_conv_param param = { | 2449 | struct do_proc_dointvec_minmax_conv_param param = { |
2502 | .min = (int *) table->extra1, | 2450 | .min = (int *) table->extra1, |
2503 | .max = (int *) table->extra2, | 2451 | .max = (int *) table->extra2, |
2504 | }; | 2452 | }; |
2505 | return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, | 2453 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
2506 | do_proc_dointvec_minmax_conv, ¶m); | 2454 | do_proc_dointvec_minmax_conv, ¶m); |
2507 | } | 2455 | } |
2508 | 2456 | ||
2509 | static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, | 2457 | static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, |
2510 | struct file *filp, | ||
2511 | void __user *buffer, | 2458 | void __user *buffer, |
2512 | size_t *lenp, loff_t *ppos, | 2459 | size_t *lenp, loff_t *ppos, |
2513 | unsigned long convmul, | 2460 | unsigned long convmul, |
2514 | unsigned long convdiv) | 2461 | unsigned long convdiv) |
2515 | { | 2462 | { |
2516 | #define TMPBUFLEN 21 | 2463 | unsigned long *i, *min, *max; |
2517 | unsigned long *i, *min, *max, val; | 2464 | int vleft, first = 1, err = 0; |
2518 | int vleft, first=1, neg; | 2465 | unsigned long page = 0; |
2519 | size_t len, left; | 2466 | size_t left; |
2520 | char buf[TMPBUFLEN], *p; | 2467 | char *kbuf; |
2521 | char __user *s = buffer; | 2468 | |
2522 | 2469 | if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { | |
2523 | if (!data || !table->maxlen || !*lenp || | ||
2524 | (*ppos && !write)) { | ||
2525 | *lenp = 0; | 2470 | *lenp = 0; |
2526 | return 0; | 2471 | return 0; |
2527 | } | 2472 | } |
2528 | 2473 | ||
2529 | i = (unsigned long *) data; | 2474 | i = (unsigned long *) data; |
2530 | min = (unsigned long *) table->extra1; | 2475 | min = (unsigned long *) table->extra1; |
2531 | max = (unsigned long *) table->extra2; | 2476 | max = (unsigned long *) table->extra2; |
2532 | vleft = table->maxlen / sizeof(unsigned long); | 2477 | vleft = table->maxlen / sizeof(unsigned long); |
2533 | left = *lenp; | 2478 | left = *lenp; |
2534 | 2479 | ||
2535 | for (; left && vleft--; i++, min++, max++, first=0) { | 2480 | if (write) { |
2481 | if (left > PAGE_SIZE - 1) | ||
2482 | left = PAGE_SIZE - 1; | ||
2483 | page = __get_free_page(GFP_TEMPORARY); | ||
2484 | kbuf = (char *) page; | ||
2485 | if (!kbuf) | ||
2486 | return -ENOMEM; | ||
2487 | if (copy_from_user(kbuf, buffer, left)) { | ||
2488 | err = -EFAULT; | ||
2489 | goto free; | ||
2490 | } | ||
2491 | kbuf[left] = 0; | ||
2492 | } | ||
2493 | |||
2494 | for (; left && vleft--; i++, first = 0) { | ||
2495 | unsigned long val; | ||
2496 | |||
2536 | if (write) { | 2497 | if (write) { |
2537 | while (left) { | 2498 | bool neg; |
2538 | char c; | 2499 | |
2539 | if (get_user(c, s)) | 2500 | left -= proc_skip_spaces(&kbuf); |
2540 | return -EFAULT; | 2501 | |
2541 | if (!isspace(c)) | 2502 | err = proc_get_long(&kbuf, &left, &val, &neg, |
2542 | break; | 2503 | proc_wspace_sep, |
2543 | left--; | 2504 | sizeof(proc_wspace_sep), NULL); |
2544 | s++; | 2505 | if (err) |
2545 | } | ||
2546 | if (!left) | ||
2547 | break; | ||
2548 | neg = 0; | ||
2549 | len = left; | ||
2550 | if (len > TMPBUFLEN-1) | ||
2551 | len = TMPBUFLEN-1; | ||
2552 | if (copy_from_user(buf, s, len)) | ||
2553 | return -EFAULT; | ||
2554 | buf[len] = 0; | ||
2555 | p = buf; | ||
2556 | if (*p == '-' && left > 1) { | ||
2557 | neg = 1; | ||
2558 | p++; | ||
2559 | } | ||
2560 | if (*p < '0' || *p > '9') | ||
2561 | break; | ||
2562 | val = simple_strtoul(p, &p, 0) * convmul / convdiv ; | ||
2563 | len = p-buf; | ||
2564 | if ((len < left) && *p && !isspace(*p)) | ||
2565 | break; | 2506 | break; |
2566 | if (neg) | 2507 | if (neg) |
2567 | val = -val; | ||
2568 | s += len; | ||
2569 | left -= len; | ||
2570 | |||
2571 | if(neg) | ||
2572 | continue; | 2508 | continue; |
2573 | if ((min && val < *min) || (max && val > *max)) | 2509 | if ((min && val < *min) || (max && val > *max)) |
2574 | continue; | 2510 | continue; |
2575 | *i = val; | 2511 | *i = val; |
2576 | } else { | 2512 | } else { |
2577 | p = buf; | 2513 | val = convdiv * (*i) / convmul; |
2578 | if (!first) | 2514 | if (!first) |
2579 | *p++ = '\t'; | 2515 | err = proc_put_char(&buffer, &left, '\t'); |
2580 | sprintf(p, "%lu", convdiv * (*i) / convmul); | 2516 | err = proc_put_long(&buffer, &left, val, false); |
2581 | len = strlen(buf); | 2517 | if (err) |
2582 | if (len > left) | 2518 | break; |
2583 | len = left; | ||
2584 | if(copy_to_user(s, buf, len)) | ||
2585 | return -EFAULT; | ||
2586 | left -= len; | ||
2587 | s += len; | ||
2588 | } | 2519 | } |
2589 | } | 2520 | } |
2590 | 2521 | ||
2591 | if (!write && !first && left) { | 2522 | if (!write && !first && left && !err) |
2592 | if(put_user('\n', s)) | 2523 | err = proc_put_char(&buffer, &left, '\n'); |
2593 | return -EFAULT; | 2524 | if (write && !err) |
2594 | left--, s++; | 2525 | left -= proc_skip_spaces(&kbuf); |
2595 | } | 2526 | free: |
2596 | if (write) { | 2527 | if (write) { |
2597 | while (left) { | 2528 | free_page(page); |
2598 | char c; | 2529 | if (first) |
2599 | if (get_user(c, s++)) | 2530 | return err ? : -EINVAL; |
2600 | return -EFAULT; | ||
2601 | if (!isspace(c)) | ||
2602 | break; | ||
2603 | left--; | ||
2604 | } | ||
2605 | } | 2531 | } |
2606 | if (write && first) | ||
2607 | return -EINVAL; | ||
2608 | *lenp -= left; | 2532 | *lenp -= left; |
2609 | *ppos += *lenp; | 2533 | *ppos += *lenp; |
2610 | return 0; | 2534 | return err; |
2611 | #undef TMPBUFLEN | ||
2612 | } | 2535 | } |
2613 | 2536 | ||
2614 | static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, | 2537 | static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, |
2615 | struct file *filp, | ||
2616 | void __user *buffer, | 2538 | void __user *buffer, |
2617 | size_t *lenp, loff_t *ppos, | 2539 | size_t *lenp, loff_t *ppos, |
2618 | unsigned long convmul, | 2540 | unsigned long convmul, |
2619 | unsigned long convdiv) | 2541 | unsigned long convdiv) |
2620 | { | 2542 | { |
2621 | return __do_proc_doulongvec_minmax(table->data, table, write, | 2543 | return __do_proc_doulongvec_minmax(table->data, table, write, |
2622 | filp, buffer, lenp, ppos, convmul, convdiv); | 2544 | buffer, lenp, ppos, convmul, convdiv); |
2623 | } | 2545 | } |
2624 | 2546 | ||
2625 | /** | 2547 | /** |
2626 | * proc_doulongvec_minmax - read a vector of long integers with min/max values | 2548 | * proc_doulongvec_minmax - read a vector of long integers with min/max values |
2627 | * @table: the sysctl table | 2549 | * @table: the sysctl table |
2628 | * @write: %TRUE if this is a write to the sysctl file | 2550 | * @write: %TRUE if this is a write to the sysctl file |
2629 | * @filp: the file structure | ||
2630 | * @buffer: the user buffer | 2551 | * @buffer: the user buffer |
2631 | * @lenp: the size of the user buffer | 2552 | * @lenp: the size of the user buffer |
2632 | * @ppos: file position | 2553 | * @ppos: file position |
@@ -2639,17 +2560,16 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, | |||
2639 | * | 2560 | * |
2640 | * Returns 0 on success. | 2561 | * Returns 0 on success. |
2641 | */ | 2562 | */ |
2642 | int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp, | 2563 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
2643 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2564 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2644 | { | 2565 | { |
2645 | return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l); | 2566 | return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l); |
2646 | } | 2567 | } |
2647 | 2568 | ||
2648 | /** | 2569 | /** |
2649 | * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values | 2570 | * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values |
2650 | * @table: the sysctl table | 2571 | * @table: the sysctl table |
2651 | * @write: %TRUE if this is a write to the sysctl file | 2572 | * @write: %TRUE if this is a write to the sysctl file |
2652 | * @filp: the file structure | ||
2653 | * @buffer: the user buffer | 2573 | * @buffer: the user buffer |
2654 | * @lenp: the size of the user buffer | 2574 | * @lenp: the size of the user buffer |
2655 | * @ppos: file position | 2575 | * @ppos: file position |
@@ -2664,16 +2584,15 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp | |||
2664 | * Returns 0 on success. | 2584 | * Returns 0 on success. |
2665 | */ | 2585 | */ |
2666 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, | 2586 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
2667 | struct file *filp, | ||
2668 | void __user *buffer, | 2587 | void __user *buffer, |
2669 | size_t *lenp, loff_t *ppos) | 2588 | size_t *lenp, loff_t *ppos) |
2670 | { | 2589 | { |
2671 | return do_proc_doulongvec_minmax(table, write, filp, buffer, | 2590 | return do_proc_doulongvec_minmax(table, write, buffer, |
2672 | lenp, ppos, HZ, 1000l); | 2591 | lenp, ppos, HZ, 1000l); |
2673 | } | 2592 | } |
2674 | 2593 | ||
2675 | 2594 | ||
2676 | static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp, | 2595 | static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp, |
2677 | int *valp, | 2596 | int *valp, |
2678 | int write, void *data) | 2597 | int write, void *data) |
2679 | { | 2598 | { |
@@ -2685,10 +2604,10 @@ static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2685 | int val = *valp; | 2604 | int val = *valp; |
2686 | unsigned long lval; | 2605 | unsigned long lval; |
2687 | if (val < 0) { | 2606 | if (val < 0) { |
2688 | *negp = -1; | 2607 | *negp = true; |
2689 | lval = (unsigned long)-val; | 2608 | lval = (unsigned long)-val; |
2690 | } else { | 2609 | } else { |
2691 | *negp = 0; | 2610 | *negp = false; |
2692 | lval = (unsigned long)val; | 2611 | lval = (unsigned long)val; |
2693 | } | 2612 | } |
2694 | *lvalp = lval / HZ; | 2613 | *lvalp = lval / HZ; |
@@ -2696,7 +2615,7 @@ static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2696 | return 0; | 2615 | return 0; |
2697 | } | 2616 | } |
2698 | 2617 | ||
2699 | static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp, | 2618 | static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp, |
2700 | int *valp, | 2619 | int *valp, |
2701 | int write, void *data) | 2620 | int write, void *data) |
2702 | { | 2621 | { |
@@ -2708,10 +2627,10 @@ static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2708 | int val = *valp; | 2627 | int val = *valp; |
2709 | unsigned long lval; | 2628 | unsigned long lval; |
2710 | if (val < 0) { | 2629 | if (val < 0) { |
2711 | *negp = -1; | 2630 | *negp = true; |
2712 | lval = (unsigned long)-val; | 2631 | lval = (unsigned long)-val; |
2713 | } else { | 2632 | } else { |
2714 | *negp = 0; | 2633 | *negp = false; |
2715 | lval = (unsigned long)val; | 2634 | lval = (unsigned long)val; |
2716 | } | 2635 | } |
2717 | *lvalp = jiffies_to_clock_t(lval); | 2636 | *lvalp = jiffies_to_clock_t(lval); |
@@ -2719,7 +2638,7 @@ static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2719 | return 0; | 2638 | return 0; |
2720 | } | 2639 | } |
2721 | 2640 | ||
2722 | static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp, | 2641 | static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp, |
2723 | int *valp, | 2642 | int *valp, |
2724 | int write, void *data) | 2643 | int write, void *data) |
2725 | { | 2644 | { |
@@ -2729,10 +2648,10 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2729 | int val = *valp; | 2648 | int val = *valp; |
2730 | unsigned long lval; | 2649 | unsigned long lval; |
2731 | if (val < 0) { | 2650 | if (val < 0) { |
2732 | *negp = -1; | 2651 | *negp = true; |
2733 | lval = (unsigned long)-val; | 2652 | lval = (unsigned long)-val; |
2734 | } else { | 2653 | } else { |
2735 | *negp = 0; | 2654 | *negp = false; |
2736 | lval = (unsigned long)val; | 2655 | lval = (unsigned long)val; |
2737 | } | 2656 | } |
2738 | *lvalp = jiffies_to_msecs(lval); | 2657 | *lvalp = jiffies_to_msecs(lval); |
@@ -2744,7 +2663,6 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2744 | * proc_dointvec_jiffies - read a vector of integers as seconds | 2663 | * proc_dointvec_jiffies - read a vector of integers as seconds |
2745 | * @table: the sysctl table | 2664 | * @table: the sysctl table |
2746 | * @write: %TRUE if this is a write to the sysctl file | 2665 | * @write: %TRUE if this is a write to the sysctl file |
2747 | * @filp: the file structure | ||
2748 | * @buffer: the user buffer | 2666 | * @buffer: the user buffer |
2749 | * @lenp: the size of the user buffer | 2667 | * @lenp: the size of the user buffer |
2750 | * @ppos: file position | 2668 | * @ppos: file position |
@@ -2756,10 +2674,10 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp, | |||
2756 | * | 2674 | * |
2757 | * Returns 0 on success. | 2675 | * Returns 0 on success. |
2758 | */ | 2676 | */ |
2759 | int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, | 2677 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
2760 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2678 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2761 | { | 2679 | { |
2762 | return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, | 2680 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
2763 | do_proc_dointvec_jiffies_conv,NULL); | 2681 | do_proc_dointvec_jiffies_conv,NULL); |
2764 | } | 2682 | } |
2765 | 2683 | ||
@@ -2767,7 +2685,6 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, | |||
2767 | * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds | 2685 | * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds |
2768 | * @table: the sysctl table | 2686 | * @table: the sysctl table |
2769 | * @write: %TRUE if this is a write to the sysctl file | 2687 | * @write: %TRUE if this is a write to the sysctl file |
2770 | * @filp: the file structure | ||
2771 | * @buffer: the user buffer | 2688 | * @buffer: the user buffer |
2772 | * @lenp: the size of the user buffer | 2689 | * @lenp: the size of the user buffer |
2773 | * @ppos: pointer to the file position | 2690 | * @ppos: pointer to the file position |
@@ -2779,10 +2696,10 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, | |||
2779 | * | 2696 | * |
2780 | * Returns 0 on success. | 2697 | * Returns 0 on success. |
2781 | */ | 2698 | */ |
2782 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp, | 2699 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
2783 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2700 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2784 | { | 2701 | { |
2785 | return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, | 2702 | return do_proc_dointvec(table,write,buffer,lenp,ppos, |
2786 | do_proc_dointvec_userhz_jiffies_conv,NULL); | 2703 | do_proc_dointvec_userhz_jiffies_conv,NULL); |
2787 | } | 2704 | } |
2788 | 2705 | ||
@@ -2790,7 +2707,6 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file | |||
2790 | * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds | 2707 | * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds |
2791 | * @table: the sysctl table | 2708 | * @table: the sysctl table |
2792 | * @write: %TRUE if this is a write to the sysctl file | 2709 | * @write: %TRUE if this is a write to the sysctl file |
2793 | * @filp: the file structure | ||
2794 | * @buffer: the user buffer | 2710 | * @buffer: the user buffer |
2795 | * @lenp: the size of the user buffer | 2711 | * @lenp: the size of the user buffer |
2796 | * @ppos: file position | 2712 | * @ppos: file position |
@@ -2803,14 +2719,14 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file | |||
2803 | * | 2719 | * |
2804 | * Returns 0 on success. | 2720 | * Returns 0 on success. |
2805 | */ | 2721 | */ |
2806 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp, | 2722 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
2807 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2723 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2808 | { | 2724 | { |
2809 | return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, | 2725 | return do_proc_dointvec(table, write, buffer, lenp, ppos, |
2810 | do_proc_dointvec_ms_jiffies_conv, NULL); | 2726 | do_proc_dointvec_ms_jiffies_conv, NULL); |
2811 | } | 2727 | } |
2812 | 2728 | ||
2813 | static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, | 2729 | static int proc_do_cad_pid(struct ctl_table *table, int write, |
2814 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2730 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2815 | { | 2731 | { |
2816 | struct pid *new_pid; | 2732 | struct pid *new_pid; |
@@ -2819,7 +2735,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp | |||
2819 | 2735 | ||
2820 | tmp = pid_vnr(cad_pid); | 2736 | tmp = pid_vnr(cad_pid); |
2821 | 2737 | ||
2822 | r = __do_proc_dointvec(&tmp, table, write, filp, buffer, | 2738 | r = __do_proc_dointvec(&tmp, table, write, buffer, |
2823 | lenp, ppos, NULL, NULL); | 2739 | lenp, ppos, NULL, NULL); |
2824 | if (r || !write) | 2740 | if (r || !write) |
2825 | return r; | 2741 | return r; |
@@ -2832,340 +2748,210 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp | |||
2832 | return 0; | 2748 | return 0; |
2833 | } | 2749 | } |
2834 | 2750 | ||
2835 | #else /* CONFIG_PROC_FS */ | 2751 | /** |
2836 | 2752 | * proc_do_large_bitmap - read/write from/to a large bitmap | |
2837 | int proc_dostring(struct ctl_table *table, int write, struct file *filp, | 2753 | * @table: the sysctl table |
2838 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2754 | * @write: %TRUE if this is a write to the sysctl file |
2839 | { | 2755 | * @buffer: the user buffer |
2840 | return -ENOSYS; | 2756 | * @lenp: the size of the user buffer |
2841 | } | 2757 | * @ppos: file position |
2842 | 2758 | * | |
2843 | int proc_dointvec(struct ctl_table *table, int write, struct file *filp, | 2759 | * The bitmap is stored at table->data and the bitmap length (in bits) |
2844 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2760 | * in table->maxlen. |
2845 | { | 2761 | * |
2846 | return -ENOSYS; | 2762 | * We use a range comma separated format (e.g. 1,3-4,10-10) so that |
2847 | } | 2763 | * large bitmaps may be represented in a compact manner. Writing into |
2848 | 2764 | * the file will clear the bitmap then update it with the given input. | |
2849 | int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp, | 2765 | * |
2850 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2766 | * Returns 0 on success. |
2851 | { | ||
2852 | return -ENOSYS; | ||
2853 | } | ||
2854 | |||
2855 | int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, | ||
2856 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
2857 | { | ||
2858 | return -ENOSYS; | ||
2859 | } | ||
2860 | |||
2861 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp, | ||
2862 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
2863 | { | ||
2864 | return -ENOSYS; | ||
2865 | } | ||
2866 | |||
2867 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp, | ||
2868 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
2869 | { | ||
2870 | return -ENOSYS; | ||
2871 | } | ||
2872 | |||
2873 | int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp, | ||
2874 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
2875 | { | ||
2876 | return -ENOSYS; | ||
2877 | } | ||
2878 | |||
2879 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, | ||
2880 | struct file *filp, | ||
2881 | void __user *buffer, | ||
2882 | size_t *lenp, loff_t *ppos) | ||
2883 | { | ||
2884 | return -ENOSYS; | ||
2885 | } | ||
2886 | |||
2887 | |||
2888 | #endif /* CONFIG_PROC_FS */ | ||
2889 | |||
2890 | |||
2891 | #ifdef CONFIG_SYSCTL_SYSCALL | ||
2892 | /* | ||
2893 | * General sysctl support routines | ||
2894 | */ | 2767 | */ |
2895 | 2768 | int proc_do_large_bitmap(struct ctl_table *table, int write, | |
2896 | /* The generic sysctl data routine (used if no strategy routine supplied) */ | 2769 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2897 | int sysctl_data(struct ctl_table *table, | 2770 | { |
2898 | void __user *oldval, size_t __user *oldlenp, | 2771 | int err = 0; |
2899 | void __user *newval, size_t newlen) | 2772 | bool first = 1; |
2900 | { | 2773 | size_t left = *lenp; |
2901 | size_t len; | 2774 | unsigned long bitmap_len = table->maxlen; |
2902 | 2775 | unsigned long *bitmap = (unsigned long *) table->data; | |
2903 | /* Get out of I don't have a variable */ | 2776 | unsigned long *tmp_bitmap = NULL; |
2904 | if (!table->data || !table->maxlen) | 2777 | char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c; |
2905 | return -ENOTDIR; | 2778 | |
2906 | 2779 | if (!bitmap_len || !left || (*ppos && !write)) { | |
2907 | if (oldval && oldlenp) { | 2780 | *lenp = 0; |
2908 | if (get_user(len, oldlenp)) | 2781 | return 0; |
2909 | return -EFAULT; | ||
2910 | if (len) { | ||
2911 | if (len > table->maxlen) | ||
2912 | len = table->maxlen; | ||
2913 | if (copy_to_user(oldval, table->data, len)) | ||
2914 | return -EFAULT; | ||
2915 | if (put_user(len, oldlenp)) | ||
2916 | return -EFAULT; | ||
2917 | } | ||
2918 | } | ||
2919 | |||
2920 | if (newval && newlen) { | ||
2921 | if (newlen > table->maxlen) | ||
2922 | newlen = table->maxlen; | ||
2923 | |||
2924 | if (copy_from_user(table->data, newval, newlen)) | ||
2925 | return -EFAULT; | ||
2926 | } | 2782 | } |
2927 | return 1; | ||
2928 | } | ||
2929 | 2783 | ||
2930 | /* The generic string strategy routine: */ | 2784 | if (write) { |
2931 | int sysctl_string(struct ctl_table *table, | 2785 | unsigned long page = 0; |
2932 | void __user *oldval, size_t __user *oldlenp, | 2786 | char *kbuf; |
2933 | void __user *newval, size_t newlen) | 2787 | |
2934 | { | 2788 | if (left > PAGE_SIZE - 1) |
2935 | if (!table->data || !table->maxlen) | 2789 | left = PAGE_SIZE - 1; |
2936 | return -ENOTDIR; | 2790 | |
2937 | 2791 | page = __get_free_page(GFP_TEMPORARY); | |
2938 | if (oldval && oldlenp) { | 2792 | kbuf = (char *) page; |
2939 | size_t bufsize; | 2793 | if (!kbuf) |
2940 | if (get_user(bufsize, oldlenp)) | 2794 | return -ENOMEM; |
2795 | if (copy_from_user(kbuf, buffer, left)) { | ||
2796 | free_page(page); | ||
2941 | return -EFAULT; | 2797 | return -EFAULT; |
2942 | if (bufsize) { | 2798 | } |
2943 | size_t len = strlen(table->data), copied; | 2799 | kbuf[left] = 0; |
2944 | 2800 | ||
2945 | /* This shouldn't trigger for a well-formed sysctl */ | 2801 | tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long), |
2946 | if (len > table->maxlen) | 2802 | GFP_KERNEL); |
2947 | len = table->maxlen; | 2803 | if (!tmp_bitmap) { |
2948 | 2804 | free_page(page); | |
2949 | /* Copy up to a max of bufsize-1 bytes of the string */ | 2805 | return -ENOMEM; |
2950 | copied = (len >= bufsize) ? bufsize - 1 : len; | ||
2951 | |||
2952 | if (copy_to_user(oldval, table->data, copied) || | ||
2953 | put_user(0, (char __user *)(oldval + copied))) | ||
2954 | return -EFAULT; | ||
2955 | if (put_user(len, oldlenp)) | ||
2956 | return -EFAULT; | ||
2957 | } | 2806 | } |
2958 | } | 2807 | proc_skip_char(&kbuf, &left, '\n'); |
2959 | if (newval && newlen) { | 2808 | while (!err && left) { |
2960 | size_t len = newlen; | 2809 | unsigned long val_a, val_b; |
2961 | if (len > table->maxlen) | 2810 | bool neg; |
2962 | len = table->maxlen; | 2811 | |
2963 | if(copy_from_user(table->data, newval, len)) | 2812 | err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a, |
2964 | return -EFAULT; | 2813 | sizeof(tr_a), &c); |
2965 | if (len == table->maxlen) | 2814 | if (err) |
2966 | len--; | 2815 | break; |
2967 | ((char *) table->data)[len] = 0; | 2816 | if (val_a >= bitmap_len || neg) { |
2968 | } | 2817 | err = -EINVAL; |
2969 | return 1; | 2818 | break; |
2970 | } | 2819 | } |
2971 | |||
2972 | /* | ||
2973 | * This function makes sure that all of the integers in the vector | ||
2974 | * are between the minimum and maximum values given in the arrays | ||
2975 | * table->extra1 and table->extra2, respectively. | ||
2976 | */ | ||
2977 | int sysctl_intvec(struct ctl_table *table, | ||
2978 | void __user *oldval, size_t __user *oldlenp, | ||
2979 | void __user *newval, size_t newlen) | ||
2980 | { | ||
2981 | |||
2982 | if (newval && newlen) { | ||
2983 | int __user *vec = (int __user *) newval; | ||
2984 | int *min = (int *) table->extra1; | ||
2985 | int *max = (int *) table->extra2; | ||
2986 | size_t length; | ||
2987 | int i; | ||
2988 | 2820 | ||
2989 | if (newlen % sizeof(int) != 0) | 2821 | val_b = val_a; |
2990 | return -EINVAL; | 2822 | if (left) { |
2823 | kbuf++; | ||
2824 | left--; | ||
2825 | } | ||
2991 | 2826 | ||
2992 | if (!table->extra1 && !table->extra2) | 2827 | if (c == '-') { |
2993 | return 0; | 2828 | err = proc_get_long(&kbuf, &left, &val_b, |
2829 | &neg, tr_b, sizeof(tr_b), | ||
2830 | &c); | ||
2831 | if (err) | ||
2832 | break; | ||
2833 | if (val_b >= bitmap_len || neg || | ||
2834 | val_a > val_b) { | ||
2835 | err = -EINVAL; | ||
2836 | break; | ||
2837 | } | ||
2838 | if (left) { | ||
2839 | kbuf++; | ||
2840 | left--; | ||
2841 | } | ||
2842 | } | ||
2994 | 2843 | ||
2995 | if (newlen > table->maxlen) | 2844 | while (val_a <= val_b) |
2996 | newlen = table->maxlen; | 2845 | set_bit(val_a++, tmp_bitmap); |
2997 | length = newlen / sizeof(int); | ||
2998 | 2846 | ||
2999 | for (i = 0; i < length; i++) { | 2847 | first = 0; |
3000 | int value; | 2848 | proc_skip_char(&kbuf, &left, '\n'); |
3001 | if (get_user(value, vec + i)) | ||
3002 | return -EFAULT; | ||
3003 | if (min && value < min[i]) | ||
3004 | return -EINVAL; | ||
3005 | if (max && value > max[i]) | ||
3006 | return -EINVAL; | ||
3007 | } | 2849 | } |
3008 | } | 2850 | free_page(page); |
3009 | return 0; | 2851 | } else { |
3010 | } | 2852 | unsigned long bit_a, bit_b = 0; |
3011 | |||
3012 | /* Strategy function to convert jiffies to seconds */ | ||
3013 | int sysctl_jiffies(struct ctl_table *table, | ||
3014 | void __user *oldval, size_t __user *oldlenp, | ||
3015 | void __user *newval, size_t newlen) | ||
3016 | { | ||
3017 | if (oldval && oldlenp) { | ||
3018 | size_t olen; | ||
3019 | 2853 | ||
3020 | if (get_user(olen, oldlenp)) | 2854 | while (left) { |
3021 | return -EFAULT; | 2855 | bit_a = find_next_bit(bitmap, bitmap_len, bit_b); |
3022 | if (olen) { | 2856 | if (bit_a >= bitmap_len) |
3023 | int val; | 2857 | break; |
2858 | bit_b = find_next_zero_bit(bitmap, bitmap_len, | ||
2859 | bit_a + 1) - 1; | ||
3024 | 2860 | ||
3025 | if (olen < sizeof(int)) | 2861 | if (!first) { |
3026 | return -EINVAL; | 2862 | err = proc_put_char(&buffer, &left, ','); |
2863 | if (err) | ||
2864 | break; | ||
2865 | } | ||
2866 | err = proc_put_long(&buffer, &left, bit_a, false); | ||
2867 | if (err) | ||
2868 | break; | ||
2869 | if (bit_a != bit_b) { | ||
2870 | err = proc_put_char(&buffer, &left, '-'); | ||
2871 | if (err) | ||
2872 | break; | ||
2873 | err = proc_put_long(&buffer, &left, bit_b, false); | ||
2874 | if (err) | ||
2875 | break; | ||
2876 | } | ||
3027 | 2877 | ||
3028 | val = *(int *)(table->data) / HZ; | 2878 | first = 0; bit_b++; |
3029 | if (put_user(val, (int __user *)oldval)) | ||
3030 | return -EFAULT; | ||
3031 | if (put_user(sizeof(int), oldlenp)) | ||
3032 | return -EFAULT; | ||
3033 | } | 2879 | } |
2880 | if (!err) | ||
2881 | err = proc_put_char(&buffer, &left, '\n'); | ||
3034 | } | 2882 | } |
3035 | if (newval && newlen) { | ||
3036 | int new; | ||
3037 | if (newlen != sizeof(int)) | ||
3038 | return -EINVAL; | ||
3039 | if (get_user(new, (int __user *)newval)) | ||
3040 | return -EFAULT; | ||
3041 | *(int *)(table->data) = new*HZ; | ||
3042 | } | ||
3043 | return 1; | ||
3044 | } | ||
3045 | |||
3046 | /* Strategy function to convert jiffies to seconds */ | ||
3047 | int sysctl_ms_jiffies(struct ctl_table *table, | ||
3048 | void __user *oldval, size_t __user *oldlenp, | ||
3049 | void __user *newval, size_t newlen) | ||
3050 | { | ||
3051 | if (oldval && oldlenp) { | ||
3052 | size_t olen; | ||
3053 | |||
3054 | if (get_user(olen, oldlenp)) | ||
3055 | return -EFAULT; | ||
3056 | if (olen) { | ||
3057 | int val; | ||
3058 | 2883 | ||
3059 | if (olen < sizeof(int)) | 2884 | if (!err) { |
3060 | return -EINVAL; | 2885 | if (write) { |
3061 | 2886 | if (*ppos) | |
3062 | val = jiffies_to_msecs(*(int *)(table->data)); | 2887 | bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len); |
3063 | if (put_user(val, (int __user *)oldval)) | 2888 | else |
3064 | return -EFAULT; | 2889 | memcpy(bitmap, tmp_bitmap, |
3065 | if (put_user(sizeof(int), oldlenp)) | 2890 | BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long)); |
3066 | return -EFAULT; | ||
3067 | } | 2891 | } |
2892 | kfree(tmp_bitmap); | ||
2893 | *lenp -= left; | ||
2894 | *ppos += *lenp; | ||
2895 | return 0; | ||
2896 | } else { | ||
2897 | kfree(tmp_bitmap); | ||
2898 | return err; | ||
3068 | } | 2899 | } |
3069 | if (newval && newlen) { | ||
3070 | int new; | ||
3071 | if (newlen != sizeof(int)) | ||
3072 | return -EINVAL; | ||
3073 | if (get_user(new, (int __user *)newval)) | ||
3074 | return -EFAULT; | ||
3075 | *(int *)(table->data) = msecs_to_jiffies(new); | ||
3076 | } | ||
3077 | return 1; | ||
3078 | } | 2900 | } |
3079 | 2901 | ||
2902 | #else /* CONFIG_PROC_FS */ | ||
3080 | 2903 | ||
3081 | 2904 | int proc_dostring(struct ctl_table *table, int write, | |
3082 | #else /* CONFIG_SYSCTL_SYSCALL */ | 2905 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3083 | |||
3084 | |||
3085 | SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) | ||
3086 | { | 2906 | { |
3087 | struct __sysctl_args tmp; | 2907 | return -ENOSYS; |
3088 | int error; | ||
3089 | |||
3090 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
3091 | return -EFAULT; | ||
3092 | |||
3093 | error = deprecated_sysctl_warning(&tmp); | ||
3094 | |||
3095 | /* If no error reading the parameters then just -ENOSYS ... */ | ||
3096 | if (!error) | ||
3097 | error = -ENOSYS; | ||
3098 | |||
3099 | return error; | ||
3100 | } | 2908 | } |
3101 | 2909 | ||
3102 | int sysctl_data(struct ctl_table *table, | 2910 | int proc_dointvec(struct ctl_table *table, int write, |
3103 | void __user *oldval, size_t __user *oldlenp, | 2911 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3104 | void __user *newval, size_t newlen) | ||
3105 | { | 2912 | { |
3106 | return -ENOSYS; | 2913 | return -ENOSYS; |
3107 | } | 2914 | } |
3108 | 2915 | ||
3109 | int sysctl_string(struct ctl_table *table, | 2916 | int proc_dointvec_minmax(struct ctl_table *table, int write, |
3110 | void __user *oldval, size_t __user *oldlenp, | 2917 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3111 | void __user *newval, size_t newlen) | ||
3112 | { | 2918 | { |
3113 | return -ENOSYS; | 2919 | return -ENOSYS; |
3114 | } | 2920 | } |
3115 | 2921 | ||
3116 | int sysctl_intvec(struct ctl_table *table, | 2922 | int proc_dointvec_jiffies(struct ctl_table *table, int write, |
3117 | void __user *oldval, size_t __user *oldlenp, | 2923 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3118 | void __user *newval, size_t newlen) | ||
3119 | { | 2924 | { |
3120 | return -ENOSYS; | 2925 | return -ENOSYS; |
3121 | } | 2926 | } |
3122 | 2927 | ||
3123 | int sysctl_jiffies(struct ctl_table *table, | 2928 | int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, |
3124 | void __user *oldval, size_t __user *oldlenp, | 2929 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3125 | void __user *newval, size_t newlen) | ||
3126 | { | 2930 | { |
3127 | return -ENOSYS; | 2931 | return -ENOSYS; |
3128 | } | 2932 | } |
3129 | 2933 | ||
3130 | int sysctl_ms_jiffies(struct ctl_table *table, | 2934 | int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, |
3131 | void __user *oldval, size_t __user *oldlenp, | 2935 | void __user *buffer, size_t *lenp, loff_t *ppos) |
3132 | void __user *newval, size_t newlen) | ||
3133 | { | 2936 | { |
3134 | return -ENOSYS; | 2937 | return -ENOSYS; |
3135 | } | 2938 | } |
3136 | 2939 | ||
3137 | #endif /* CONFIG_SYSCTL_SYSCALL */ | 2940 | int proc_doulongvec_minmax(struct ctl_table *table, int write, |
3138 | 2941 | void __user *buffer, size_t *lenp, loff_t *ppos) | |
3139 | static int deprecated_sysctl_warning(struct __sysctl_args *args) | ||
3140 | { | 2942 | { |
3141 | static int msg_count; | 2943 | return -ENOSYS; |
3142 | int name[CTL_MAXNAME]; | 2944 | } |
3143 | int i; | ||
3144 | |||
3145 | /* Check args->nlen. */ | ||
3146 | if (args->nlen < 0 || args->nlen > CTL_MAXNAME) | ||
3147 | return -ENOTDIR; | ||
3148 | 2945 | ||
3149 | /* Read in the sysctl name for better debug message logging */ | 2946 | int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, |
3150 | for (i = 0; i < args->nlen; i++) | 2947 | void __user *buffer, |
3151 | if (get_user(name[i], args->name + i)) | 2948 | size_t *lenp, loff_t *ppos) |
3152 | return -EFAULT; | 2949 | { |
2950 | return -ENOSYS; | ||
2951 | } | ||
3153 | 2952 | ||
3154 | /* Ignore accesses to kernel.version */ | ||
3155 | if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION)) | ||
3156 | return 0; | ||
3157 | 2953 | ||
3158 | if (msg_count < 5) { | 2954 | #endif /* CONFIG_PROC_FS */ |
3159 | msg_count++; | ||
3160 | printk(KERN_INFO | ||
3161 | "warning: process `%s' used the deprecated sysctl " | ||
3162 | "system call with ", current->comm); | ||
3163 | for (i = 0; i < args->nlen; i++) | ||
3164 | printk("%d.", name[i]); | ||
3165 | printk("\n"); | ||
3166 | } | ||
3167 | return 0; | ||
3168 | } | ||
3169 | 2955 | ||
3170 | /* | 2956 | /* |
3171 | * No sense putting this after each symbol definition, twice, | 2957 | * No sense putting this after each symbol definition, twice, |
@@ -3181,9 +2967,4 @@ EXPORT_SYMBOL(proc_doulongvec_minmax); | |||
3181 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); | 2967 | EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); |
3182 | EXPORT_SYMBOL(register_sysctl_table); | 2968 | EXPORT_SYMBOL(register_sysctl_table); |
3183 | EXPORT_SYMBOL(register_sysctl_paths); | 2969 | EXPORT_SYMBOL(register_sysctl_paths); |
3184 | EXPORT_SYMBOL(sysctl_intvec); | ||
3185 | EXPORT_SYMBOL(sysctl_jiffies); | ||
3186 | EXPORT_SYMBOL(sysctl_ms_jiffies); | ||
3187 | EXPORT_SYMBOL(sysctl_string); | ||
3188 | EXPORT_SYMBOL(sysctl_data); | ||
3189 | EXPORT_SYMBOL(unregister_sysctl_table); | 2970 | EXPORT_SYMBOL(unregister_sysctl_table); |