aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c1050
1 files changed, 252 insertions, 798 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 58be76017fd0..9327a26765c5 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -26,9 +26,7 @@
26#include <linux/proc_fs.h> 26#include <linux/proc_fs.h>
27#include <linux/security.h> 27#include <linux/security.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/utsname.h>
30#include <linux/kmemcheck.h> 29#include <linux/kmemcheck.h>
31#include <linux/smp_lock.h>
32#include <linux/fs.h> 30#include <linux/fs.h>
33#include <linux/init.h> 31#include <linux/init.h>
34#include <linux/kernel.h> 32#include <linux/kernel.h>
@@ -37,6 +35,7 @@
37#include <linux/sysrq.h> 35#include <linux/sysrq.h>
38#include <linux/highuid.h> 36#include <linux/highuid.h>
39#include <linux/writeback.h> 37#include <linux/writeback.h>
38#include <linux/ratelimit.h>
40#include <linux/hugetlb.h> 39#include <linux/hugetlb.h>
41#include <linux/initrd.h> 40#include <linux/initrd.h>
42#include <linux/key.h> 41#include <linux/key.h>
@@ -49,9 +48,8 @@
49#include <linux/acpi.h> 48#include <linux/acpi.h>
50#include <linux/reboot.h> 49#include <linux/reboot.h>
51#include <linux/ftrace.h> 50#include <linux/ftrace.h>
52#include <linux/security.h>
53#include <linux/slow-work.h> 51#include <linux/slow-work.h>
54#include <linux/perf_counter.h> 52#include <linux/perf_event.h>
55 53
56#include <asm/uaccess.h> 54#include <asm/uaccess.h>
57#include <asm/processor.h> 55#include <asm/processor.h>
@@ -62,7 +60,6 @@
62#include <asm/io.h> 60#include <asm/io.h>
63#endif 61#endif
64 62
65static int deprecated_sysctl_warning(struct __sysctl_args *args);
66 63
67#if defined(CONFIG_SYSCTL) 64#if defined(CONFIG_SYSCTL)
68 65
@@ -78,6 +75,7 @@ extern int max_threads;
78extern int core_uses_pid; 75extern int core_uses_pid;
79extern int suid_dumpable; 76extern int suid_dumpable;
80extern char core_pattern[]; 77extern char core_pattern[];
78extern unsigned int core_pipe_limit;
81extern int pid_max; 79extern int pid_max;
82extern int min_free_kbytes; 80extern int min_free_kbytes;
83extern int pid_max_min, pid_max_max; 81extern int pid_max_min, pid_max_max;
@@ -92,6 +90,9 @@ extern int sysctl_nr_trim_pages;
92#ifdef CONFIG_RCU_TORTURE_TEST 90#ifdef CONFIG_RCU_TORTURE_TEST
93extern int rcutorture_runnable; 91extern int rcutorture_runnable;
94#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 92#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
93#ifdef CONFIG_BLOCK
94extern int blk_iopoll_enabled;
95#endif
95 96
96/* Constants used for minimum and maximum */ 97/* Constants used for minimum and maximum */
97#ifdef CONFIG_DETECT_SOFTLOCKUP 98#ifdef CONFIG_DETECT_SOFTLOCKUP
@@ -104,6 +105,9 @@ static int __maybe_unused one = 1;
104static int __maybe_unused two = 2; 105static int __maybe_unused two = 2;
105static unsigned long one_ul = 1; 106static unsigned long one_ul = 1;
106static int one_hundred = 100; 107static int one_hundred = 100;
108#ifdef CONFIG_PRINTK
109static int ten_thousand = 10000;
110#endif
107 111
108/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ 112/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
109static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; 113static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
@@ -153,14 +157,16 @@ extern int no_unaligned_warning;
153extern int unaligned_dump_stack; 157extern int unaligned_dump_stack;
154#endif 158#endif
155 159
160extern struct ratelimit_state printk_ratelimit_state;
161
156#ifdef CONFIG_RT_MUTEXES 162#ifdef CONFIG_RT_MUTEXES
157extern int max_lock_depth; 163extern int max_lock_depth;
158#endif 164#endif
159 165
160#ifdef CONFIG_PROC_SYSCTL 166#ifdef CONFIG_PROC_SYSCTL
161static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, 167static int proc_do_cad_pid(struct ctl_table *table, int write,
162 void __user *buffer, size_t *lenp, loff_t *ppos); 168 void __user *buffer, size_t *lenp, loff_t *ppos);
163static int proc_taint(struct ctl_table *table, int write, struct file *filp, 169static int proc_taint(struct ctl_table *table, int write,
164 void __user *buffer, size_t *lenp, loff_t *ppos); 170 void __user *buffer, size_t *lenp, loff_t *ppos);
165#endif 171#endif
166 172
@@ -202,31 +208,26 @@ extern int lock_stat;
202 208
203static struct ctl_table root_table[] = { 209static struct ctl_table root_table[] = {
204 { 210 {
205 .ctl_name = CTL_KERN,
206 .procname = "kernel", 211 .procname = "kernel",
207 .mode = 0555, 212 .mode = 0555,
208 .child = kern_table, 213 .child = kern_table,
209 }, 214 },
210 { 215 {
211 .ctl_name = CTL_VM,
212 .procname = "vm", 216 .procname = "vm",
213 .mode = 0555, 217 .mode = 0555,
214 .child = vm_table, 218 .child = vm_table,
215 }, 219 },
216 { 220 {
217 .ctl_name = CTL_FS,
218 .procname = "fs", 221 .procname = "fs",
219 .mode = 0555, 222 .mode = 0555,
220 .child = fs_table, 223 .child = fs_table,
221 }, 224 },
222 { 225 {
223 .ctl_name = CTL_DEBUG,
224 .procname = "debug", 226 .procname = "debug",
225 .mode = 0555, 227 .mode = 0555,
226 .child = debug_table, 228 .child = debug_table,
227 }, 229 },
228 { 230 {
229 .ctl_name = CTL_DEV,
230 .procname = "dev", 231 .procname = "dev",
231 .mode = 0555, 232 .mode = 0555,
232 .child = dev_table, 233 .child = dev_table,
@@ -235,7 +236,7 @@ static struct ctl_table root_table[] = {
235 * NOTE: do not add new entries to this table unless you have read 236 * NOTE: do not add new entries to this table unless you have read
236 * Documentation/sysctl/ctl_unnumbered.txt 237 * Documentation/sysctl/ctl_unnumbered.txt
237 */ 238 */
238 { .ctl_name = 0 } 239 { }
239}; 240};
240 241
241#ifdef CONFIG_SCHED_DEBUG 242#ifdef CONFIG_SCHED_DEBUG
@@ -246,177 +247,167 @@ static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
246#endif 247#endif
247 248
248static struct ctl_table kern_table[] = { 249static struct ctl_table kern_table[] = {
250 {
251 .procname = "sched_child_runs_first",
252 .data = &sysctl_sched_child_runs_first,
253 .maxlen = sizeof(unsigned int),
254 .mode = 0644,
255 .proc_handler = proc_dointvec,
256 },
249#ifdef CONFIG_SCHED_DEBUG 257#ifdef CONFIG_SCHED_DEBUG
250 { 258 {
251 .ctl_name = CTL_UNNUMBERED,
252 .procname = "sched_min_granularity_ns", 259 .procname = "sched_min_granularity_ns",
253 .data = &sysctl_sched_min_granularity, 260 .data = &sysctl_sched_min_granularity,
254 .maxlen = sizeof(unsigned int), 261 .maxlen = sizeof(unsigned int),
255 .mode = 0644, 262 .mode = 0644,
256 .proc_handler = &sched_nr_latency_handler, 263 .proc_handler = sched_nr_latency_handler,
257 .strategy = &sysctl_intvec,
258 .extra1 = &min_sched_granularity_ns, 264 .extra1 = &min_sched_granularity_ns,
259 .extra2 = &max_sched_granularity_ns, 265 .extra2 = &max_sched_granularity_ns,
260 }, 266 },
261 { 267 {
262 .ctl_name = CTL_UNNUMBERED,
263 .procname = "sched_latency_ns", 268 .procname = "sched_latency_ns",
264 .data = &sysctl_sched_latency, 269 .data = &sysctl_sched_latency,
265 .maxlen = sizeof(unsigned int), 270 .maxlen = sizeof(unsigned int),
266 .mode = 0644, 271 .mode = 0644,
267 .proc_handler = &sched_nr_latency_handler, 272 .proc_handler = sched_nr_latency_handler,
268 .strategy = &sysctl_intvec,
269 .extra1 = &min_sched_granularity_ns, 273 .extra1 = &min_sched_granularity_ns,
270 .extra2 = &max_sched_granularity_ns, 274 .extra2 = &max_sched_granularity_ns,
271 }, 275 },
272 { 276 {
273 .ctl_name = CTL_UNNUMBERED,
274 .procname = "sched_wakeup_granularity_ns", 277 .procname = "sched_wakeup_granularity_ns",
275 .data = &sysctl_sched_wakeup_granularity, 278 .data = &sysctl_sched_wakeup_granularity,
276 .maxlen = sizeof(unsigned int), 279 .maxlen = sizeof(unsigned int),
277 .mode = 0644, 280 .mode = 0644,
278 .proc_handler = &proc_dointvec_minmax, 281 .proc_handler = proc_dointvec_minmax,
279 .strategy = &sysctl_intvec,
280 .extra1 = &min_wakeup_granularity_ns, 282 .extra1 = &min_wakeup_granularity_ns,
281 .extra2 = &max_wakeup_granularity_ns, 283 .extra2 = &max_wakeup_granularity_ns,
282 }, 284 },
283 { 285 {
284 .ctl_name = CTL_UNNUMBERED,
285 .procname = "sched_shares_ratelimit", 286 .procname = "sched_shares_ratelimit",
286 .data = &sysctl_sched_shares_ratelimit, 287 .data = &sysctl_sched_shares_ratelimit,
287 .maxlen = sizeof(unsigned int), 288 .maxlen = sizeof(unsigned int),
288 .mode = 0644, 289 .mode = 0644,
289 .proc_handler = &proc_dointvec, 290 .proc_handler = proc_dointvec,
290 }, 291 },
291 { 292 {
292 .ctl_name = CTL_UNNUMBERED,
293 .procname = "sched_shares_thresh", 293 .procname = "sched_shares_thresh",
294 .data = &sysctl_sched_shares_thresh, 294 .data = &sysctl_sched_shares_thresh,
295 .maxlen = sizeof(unsigned int), 295 .maxlen = sizeof(unsigned int),
296 .mode = 0644, 296 .mode = 0644,
297 .proc_handler = &proc_dointvec_minmax, 297 .proc_handler = proc_dointvec_minmax,
298 .strategy = &sysctl_intvec,
299 .extra1 = &zero, 298 .extra1 = &zero,
300 }, 299 },
301 { 300 {
302 .ctl_name = CTL_UNNUMBERED,
303 .procname = "sched_child_runs_first",
304 .data = &sysctl_sched_child_runs_first,
305 .maxlen = sizeof(unsigned int),
306 .mode = 0644,
307 .proc_handler = &proc_dointvec,
308 },
309 {
310 .ctl_name = CTL_UNNUMBERED,
311 .procname = "sched_features", 301 .procname = "sched_features",
312 .data = &sysctl_sched_features, 302 .data = &sysctl_sched_features,
313 .maxlen = sizeof(unsigned int), 303 .maxlen = sizeof(unsigned int),
314 .mode = 0644, 304 .mode = 0644,
315 .proc_handler = &proc_dointvec, 305 .proc_handler = proc_dointvec,
316 }, 306 },
317 { 307 {
318 .ctl_name = CTL_UNNUMBERED,
319 .procname = "sched_migration_cost", 308 .procname = "sched_migration_cost",
320 .data = &sysctl_sched_migration_cost, 309 .data = &sysctl_sched_migration_cost,
321 .maxlen = sizeof(unsigned int), 310 .maxlen = sizeof(unsigned int),
322 .mode = 0644, 311 .mode = 0644,
323 .proc_handler = &proc_dointvec, 312 .proc_handler = proc_dointvec,
324 }, 313 },
325 { 314 {
326 .ctl_name = CTL_UNNUMBERED,
327 .procname = "sched_nr_migrate", 315 .procname = "sched_nr_migrate",
328 .data = &sysctl_sched_nr_migrate, 316 .data = &sysctl_sched_nr_migrate,
329 .maxlen = sizeof(unsigned int), 317 .maxlen = sizeof(unsigned int),
330 .mode = 0644, 318 .mode = 0644,
331 .proc_handler = &proc_dointvec, 319 .proc_handler = proc_dointvec,
320 },
321 {
322 .procname = "sched_time_avg",
323 .data = &sysctl_sched_time_avg,
324 .maxlen = sizeof(unsigned int),
325 .mode = 0644,
326 .proc_handler = proc_dointvec,
332 }, 327 },
333 { 328 {
334 .ctl_name = CTL_UNNUMBERED,
335 .procname = "timer_migration", 329 .procname = "timer_migration",
336 .data = &sysctl_timer_migration, 330 .data = &sysctl_timer_migration,
337 .maxlen = sizeof(unsigned int), 331 .maxlen = sizeof(unsigned int),
338 .mode = 0644, 332 .mode = 0644,
339 .proc_handler = &proc_dointvec_minmax, 333 .proc_handler = proc_dointvec_minmax,
340 .strategy = &sysctl_intvec,
341 .extra1 = &zero, 334 .extra1 = &zero,
342 .extra2 = &one, 335 .extra2 = &one,
343 }, 336 },
344#endif 337#endif
345 { 338 {
346 .ctl_name = CTL_UNNUMBERED,
347 .procname = "sched_rt_period_us", 339 .procname = "sched_rt_period_us",
348 .data = &sysctl_sched_rt_period, 340 .data = &sysctl_sched_rt_period,
349 .maxlen = sizeof(unsigned int), 341 .maxlen = sizeof(unsigned int),
350 .mode = 0644, 342 .mode = 0644,
351 .proc_handler = &sched_rt_handler, 343 .proc_handler = sched_rt_handler,
352 }, 344 },
353 { 345 {
354 .ctl_name = CTL_UNNUMBERED,
355 .procname = "sched_rt_runtime_us", 346 .procname = "sched_rt_runtime_us",
356 .data = &sysctl_sched_rt_runtime, 347 .data = &sysctl_sched_rt_runtime,
357 .maxlen = sizeof(int), 348 .maxlen = sizeof(int),
358 .mode = 0644, 349 .mode = 0644,
359 .proc_handler = &sched_rt_handler, 350 .proc_handler = sched_rt_handler,
360 }, 351 },
361 { 352 {
362 .ctl_name = CTL_UNNUMBERED,
363 .procname = "sched_compat_yield", 353 .procname = "sched_compat_yield",
364 .data = &sysctl_sched_compat_yield, 354 .data = &sysctl_sched_compat_yield,
365 .maxlen = sizeof(unsigned int), 355 .maxlen = sizeof(unsigned int),
366 .mode = 0644, 356 .mode = 0644,
367 .proc_handler = &proc_dointvec, 357 .proc_handler = proc_dointvec,
368 }, 358 },
369#ifdef CONFIG_PROVE_LOCKING 359#ifdef CONFIG_PROVE_LOCKING
370 { 360 {
371 .ctl_name = CTL_UNNUMBERED,
372 .procname = "prove_locking", 361 .procname = "prove_locking",
373 .data = &prove_locking, 362 .data = &prove_locking,
374 .maxlen = sizeof(int), 363 .maxlen = sizeof(int),
375 .mode = 0644, 364 .mode = 0644,
376 .proc_handler = &proc_dointvec, 365 .proc_handler = proc_dointvec,
377 }, 366 },
378#endif 367#endif
379#ifdef CONFIG_LOCK_STAT 368#ifdef CONFIG_LOCK_STAT
380 { 369 {
381 .ctl_name = CTL_UNNUMBERED,
382 .procname = "lock_stat", 370 .procname = "lock_stat",
383 .data = &lock_stat, 371 .data = &lock_stat,
384 .maxlen = sizeof(int), 372 .maxlen = sizeof(int),
385 .mode = 0644, 373 .mode = 0644,
386 .proc_handler = &proc_dointvec, 374 .proc_handler = proc_dointvec,
387 }, 375 },
388#endif 376#endif
389 { 377 {
390 .ctl_name = KERN_PANIC,
391 .procname = "panic", 378 .procname = "panic",
392 .data = &panic_timeout, 379 .data = &panic_timeout,
393 .maxlen = sizeof(int), 380 .maxlen = sizeof(int),
394 .mode = 0644, 381 .mode = 0644,
395 .proc_handler = &proc_dointvec, 382 .proc_handler = proc_dointvec,
396 }, 383 },
397 { 384 {
398 .ctl_name = KERN_CORE_USES_PID,
399 .procname = "core_uses_pid", 385 .procname = "core_uses_pid",
400 .data = &core_uses_pid, 386 .data = &core_uses_pid,
401 .maxlen = sizeof(int), 387 .maxlen = sizeof(int),
402 .mode = 0644, 388 .mode = 0644,
403 .proc_handler = &proc_dointvec, 389 .proc_handler = proc_dointvec,
404 }, 390 },
405 { 391 {
406 .ctl_name = KERN_CORE_PATTERN,
407 .procname = "core_pattern", 392 .procname = "core_pattern",
408 .data = core_pattern, 393 .data = core_pattern,
409 .maxlen = CORENAME_MAX_SIZE, 394 .maxlen = CORENAME_MAX_SIZE,
410 .mode = 0644, 395 .mode = 0644,
411 .proc_handler = &proc_dostring, 396 .proc_handler = proc_dostring,
412 .strategy = &sysctl_string, 397 },
398 {
399 .procname = "core_pipe_limit",
400 .data = &core_pipe_limit,
401 .maxlen = sizeof(unsigned int),
402 .mode = 0644,
403 .proc_handler = proc_dointvec,
413 }, 404 },
414#ifdef CONFIG_PROC_SYSCTL 405#ifdef CONFIG_PROC_SYSCTL
415 { 406 {
416 .procname = "tainted", 407 .procname = "tainted",
417 .maxlen = sizeof(long), 408 .maxlen = sizeof(long),
418 .mode = 0644, 409 .mode = 0644,
419 .proc_handler = &proc_taint, 410 .proc_handler = proc_taint,
420 }, 411 },
421#endif 412#endif
422#ifdef CONFIG_LATENCYTOP 413#ifdef CONFIG_LATENCYTOP
@@ -425,181 +416,160 @@ static struct ctl_table kern_table[] = {
425 .data = &latencytop_enabled, 416 .data = &latencytop_enabled,
426 .maxlen = sizeof(int), 417 .maxlen = sizeof(int),
427 .mode = 0644, 418 .mode = 0644,
428 .proc_handler = &proc_dointvec, 419 .proc_handler = proc_dointvec,
429 }, 420 },
430#endif 421#endif
431#ifdef CONFIG_BLK_DEV_INITRD 422#ifdef CONFIG_BLK_DEV_INITRD
432 { 423 {
433 .ctl_name = KERN_REALROOTDEV,
434 .procname = "real-root-dev", 424 .procname = "real-root-dev",
435 .data = &real_root_dev, 425 .data = &real_root_dev,
436 .maxlen = sizeof(int), 426 .maxlen = sizeof(int),
437 .mode = 0644, 427 .mode = 0644,
438 .proc_handler = &proc_dointvec, 428 .proc_handler = proc_dointvec,
439 }, 429 },
440#endif 430#endif
441 { 431 {
442 .ctl_name = CTL_UNNUMBERED,
443 .procname = "print-fatal-signals", 432 .procname = "print-fatal-signals",
444 .data = &print_fatal_signals, 433 .data = &print_fatal_signals,
445 .maxlen = sizeof(int), 434 .maxlen = sizeof(int),
446 .mode = 0644, 435 .mode = 0644,
447 .proc_handler = &proc_dointvec, 436 .proc_handler = proc_dointvec,
448 }, 437 },
449#ifdef CONFIG_SPARC 438#ifdef CONFIG_SPARC
450 { 439 {
451 .ctl_name = KERN_SPARC_REBOOT,
452 .procname = "reboot-cmd", 440 .procname = "reboot-cmd",
453 .data = reboot_command, 441 .data = reboot_command,
454 .maxlen = 256, 442 .maxlen = 256,
455 .mode = 0644, 443 .mode = 0644,
456 .proc_handler = &proc_dostring, 444 .proc_handler = proc_dostring,
457 .strategy = &sysctl_string,
458 }, 445 },
459 { 446 {
460 .ctl_name = KERN_SPARC_STOP_A,
461 .procname = "stop-a", 447 .procname = "stop-a",
462 .data = &stop_a_enabled, 448 .data = &stop_a_enabled,
463 .maxlen = sizeof (int), 449 .maxlen = sizeof (int),
464 .mode = 0644, 450 .mode = 0644,
465 .proc_handler = &proc_dointvec, 451 .proc_handler = proc_dointvec,
466 }, 452 },
467 { 453 {
468 .ctl_name = KERN_SPARC_SCONS_PWROFF,
469 .procname = "scons-poweroff", 454 .procname = "scons-poweroff",
470 .data = &scons_pwroff, 455 .data = &scons_pwroff,
471 .maxlen = sizeof (int), 456 .maxlen = sizeof (int),
472 .mode = 0644, 457 .mode = 0644,
473 .proc_handler = &proc_dointvec, 458 .proc_handler = proc_dointvec,
474 }, 459 },
475#endif 460#endif
476#ifdef CONFIG_SPARC64 461#ifdef CONFIG_SPARC64
477 { 462 {
478 .ctl_name = CTL_UNNUMBERED,
479 .procname = "tsb-ratio", 463 .procname = "tsb-ratio",
480 .data = &sysctl_tsb_ratio, 464 .data = &sysctl_tsb_ratio,
481 .maxlen = sizeof (int), 465 .maxlen = sizeof (int),
482 .mode = 0644, 466 .mode = 0644,
483 .proc_handler = &proc_dointvec, 467 .proc_handler = proc_dointvec,
484 }, 468 },
485#endif 469#endif
486#ifdef __hppa__ 470#ifdef __hppa__
487 { 471 {
488 .ctl_name = KERN_HPPA_PWRSW,
489 .procname = "soft-power", 472 .procname = "soft-power",
490 .data = &pwrsw_enabled, 473 .data = &pwrsw_enabled,
491 .maxlen = sizeof (int), 474 .maxlen = sizeof (int),
492 .mode = 0644, 475 .mode = 0644,
493 .proc_handler = &proc_dointvec, 476 .proc_handler = proc_dointvec,
494 }, 477 },
495 { 478 {
496 .ctl_name = KERN_HPPA_UNALIGNED,
497 .procname = "unaligned-trap", 479 .procname = "unaligned-trap",
498 .data = &unaligned_enabled, 480 .data = &unaligned_enabled,
499 .maxlen = sizeof (int), 481 .maxlen = sizeof (int),
500 .mode = 0644, 482 .mode = 0644,
501 .proc_handler = &proc_dointvec, 483 .proc_handler = proc_dointvec,
502 }, 484 },
503#endif 485#endif
504 { 486 {
505 .ctl_name = KERN_CTLALTDEL,
506 .procname = "ctrl-alt-del", 487 .procname = "ctrl-alt-del",
507 .data = &C_A_D, 488 .data = &C_A_D,
508 .maxlen = sizeof(int), 489 .maxlen = sizeof(int),
509 .mode = 0644, 490 .mode = 0644,
510 .proc_handler = &proc_dointvec, 491 .proc_handler = proc_dointvec,
511 }, 492 },
512#ifdef CONFIG_FUNCTION_TRACER 493#ifdef CONFIG_FUNCTION_TRACER
513 { 494 {
514 .ctl_name = CTL_UNNUMBERED,
515 .procname = "ftrace_enabled", 495 .procname = "ftrace_enabled",
516 .data = &ftrace_enabled, 496 .data = &ftrace_enabled,
517 .maxlen = sizeof(int), 497 .maxlen = sizeof(int),
518 .mode = 0644, 498 .mode = 0644,
519 .proc_handler = &ftrace_enable_sysctl, 499 .proc_handler = ftrace_enable_sysctl,
520 }, 500 },
521#endif 501#endif
522#ifdef CONFIG_STACK_TRACER 502#ifdef CONFIG_STACK_TRACER
523 { 503 {
524 .ctl_name = CTL_UNNUMBERED,
525 .procname = "stack_tracer_enabled", 504 .procname = "stack_tracer_enabled",
526 .data = &stack_tracer_enabled, 505 .data = &stack_tracer_enabled,
527 .maxlen = sizeof(int), 506 .maxlen = sizeof(int),
528 .mode = 0644, 507 .mode = 0644,
529 .proc_handler = &stack_trace_sysctl, 508 .proc_handler = stack_trace_sysctl,
530 }, 509 },
531#endif 510#endif
532#ifdef CONFIG_TRACING 511#ifdef CONFIG_TRACING
533 { 512 {
534 .ctl_name = CTL_UNNUMBERED,
535 .procname = "ftrace_dump_on_oops", 513 .procname = "ftrace_dump_on_oops",
536 .data = &ftrace_dump_on_oops, 514 .data = &ftrace_dump_on_oops,
537 .maxlen = sizeof(int), 515 .maxlen = sizeof(int),
538 .mode = 0644, 516 .mode = 0644,
539 .proc_handler = &proc_dointvec, 517 .proc_handler = proc_dointvec,
540 }, 518 },
541#endif 519#endif
542#ifdef CONFIG_MODULES 520#ifdef CONFIG_MODULES
543 { 521 {
544 .ctl_name = KERN_MODPROBE,
545 .procname = "modprobe", 522 .procname = "modprobe",
546 .data = &modprobe_path, 523 .data = &modprobe_path,
547 .maxlen = KMOD_PATH_LEN, 524 .maxlen = KMOD_PATH_LEN,
548 .mode = 0644, 525 .mode = 0644,
549 .proc_handler = &proc_dostring, 526 .proc_handler = proc_dostring,
550 .strategy = &sysctl_string,
551 }, 527 },
552 { 528 {
553 .ctl_name = CTL_UNNUMBERED,
554 .procname = "modules_disabled", 529 .procname = "modules_disabled",
555 .data = &modules_disabled, 530 .data = &modules_disabled,
556 .maxlen = sizeof(int), 531 .maxlen = sizeof(int),
557 .mode = 0644, 532 .mode = 0644,
558 /* only handle a transition from default "0" to "1" */ 533 /* only handle a transition from default "0" to "1" */
559 .proc_handler = &proc_dointvec_minmax, 534 .proc_handler = proc_dointvec_minmax,
560 .extra1 = &one, 535 .extra1 = &one,
561 .extra2 = &one, 536 .extra2 = &one,
562 }, 537 },
563#endif 538#endif
564#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 539#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
565 { 540 {
566 .ctl_name = KERN_HOTPLUG,
567 .procname = "hotplug", 541 .procname = "hotplug",
568 .data = &uevent_helper, 542 .data = &uevent_helper,
569 .maxlen = UEVENT_HELPER_PATH_LEN, 543 .maxlen = UEVENT_HELPER_PATH_LEN,
570 .mode = 0644, 544 .mode = 0644,
571 .proc_handler = &proc_dostring, 545 .proc_handler = proc_dostring,
572 .strategy = &sysctl_string,
573 }, 546 },
574#endif 547#endif
575#ifdef CONFIG_CHR_DEV_SG 548#ifdef CONFIG_CHR_DEV_SG
576 { 549 {
577 .ctl_name = KERN_SG_BIG_BUFF,
578 .procname = "sg-big-buff", 550 .procname = "sg-big-buff",
579 .data = &sg_big_buff, 551 .data = &sg_big_buff,
580 .maxlen = sizeof (int), 552 .maxlen = sizeof (int),
581 .mode = 0444, 553 .mode = 0444,
582 .proc_handler = &proc_dointvec, 554 .proc_handler = proc_dointvec,
583 }, 555 },
584#endif 556#endif
585#ifdef CONFIG_BSD_PROCESS_ACCT 557#ifdef CONFIG_BSD_PROCESS_ACCT
586 { 558 {
587 .ctl_name = KERN_ACCT,
588 .procname = "acct", 559 .procname = "acct",
589 .data = &acct_parm, 560 .data = &acct_parm,
590 .maxlen = 3*sizeof(int), 561 .maxlen = 3*sizeof(int),
591 .mode = 0644, 562 .mode = 0644,
592 .proc_handler = &proc_dointvec, 563 .proc_handler = proc_dointvec,
593 }, 564 },
594#endif 565#endif
595#ifdef CONFIG_MAGIC_SYSRQ 566#ifdef CONFIG_MAGIC_SYSRQ
596 { 567 {
597 .ctl_name = KERN_SYSRQ,
598 .procname = "sysrq", 568 .procname = "sysrq",
599 .data = &__sysrq_enabled, 569 .data = &__sysrq_enabled,
600 .maxlen = sizeof (int), 570 .maxlen = sizeof (int),
601 .mode = 0644, 571 .mode = 0644,
602 .proc_handler = &proc_dointvec, 572 .proc_handler = proc_dointvec,
603 }, 573 },
604#endif 574#endif
605#ifdef CONFIG_PROC_SYSCTL 575#ifdef CONFIG_PROC_SYSCTL
@@ -608,204 +578,188 @@ static struct ctl_table kern_table[] = {
608 .data = NULL, 578 .data = NULL,
609 .maxlen = sizeof (int), 579 .maxlen = sizeof (int),
610 .mode = 0600, 580 .mode = 0600,
611 .proc_handler = &proc_do_cad_pid, 581 .proc_handler = proc_do_cad_pid,
612 }, 582 },
613#endif 583#endif
614 { 584 {
615 .ctl_name = KERN_MAX_THREADS,
616 .procname = "threads-max", 585 .procname = "threads-max",
617 .data = &max_threads, 586 .data = &max_threads,
618 .maxlen = sizeof(int), 587 .maxlen = sizeof(int),
619 .mode = 0644, 588 .mode = 0644,
620 .proc_handler = &proc_dointvec, 589 .proc_handler = proc_dointvec,
621 }, 590 },
622 { 591 {
623 .ctl_name = KERN_RANDOM,
624 .procname = "random", 592 .procname = "random",
625 .mode = 0555, 593 .mode = 0555,
626 .child = random_table, 594 .child = random_table,
627 }, 595 },
628 { 596 {
629 .ctl_name = KERN_OVERFLOWUID,
630 .procname = "overflowuid", 597 .procname = "overflowuid",
631 .data = &overflowuid, 598 .data = &overflowuid,
632 .maxlen = sizeof(int), 599 .maxlen = sizeof(int),
633 .mode = 0644, 600 .mode = 0644,
634 .proc_handler = &proc_dointvec_minmax, 601 .proc_handler = proc_dointvec_minmax,
635 .strategy = &sysctl_intvec,
636 .extra1 = &minolduid, 602 .extra1 = &minolduid,
637 .extra2 = &maxolduid, 603 .extra2 = &maxolduid,
638 }, 604 },
639 { 605 {
640 .ctl_name = KERN_OVERFLOWGID,
641 .procname = "overflowgid", 606 .procname = "overflowgid",
642 .data = &overflowgid, 607 .data = &overflowgid,
643 .maxlen = sizeof(int), 608 .maxlen = sizeof(int),
644 .mode = 0644, 609 .mode = 0644,
645 .proc_handler = &proc_dointvec_minmax, 610 .proc_handler = proc_dointvec_minmax,
646 .strategy = &sysctl_intvec,
647 .extra1 = &minolduid, 611 .extra1 = &minolduid,
648 .extra2 = &maxolduid, 612 .extra2 = &maxolduid,
649 }, 613 },
650#ifdef CONFIG_S390 614#ifdef CONFIG_S390
651#ifdef CONFIG_MATHEMU 615#ifdef CONFIG_MATHEMU
652 { 616 {
653 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
654 .procname = "ieee_emulation_warnings", 617 .procname = "ieee_emulation_warnings",
655 .data = &sysctl_ieee_emulation_warnings, 618 .data = &sysctl_ieee_emulation_warnings,
656 .maxlen = sizeof(int), 619 .maxlen = sizeof(int),
657 .mode = 0644, 620 .mode = 0644,
658 .proc_handler = &proc_dointvec, 621 .proc_handler = proc_dointvec,
659 }, 622 },
660#endif 623#endif
661 { 624 {
662 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
663 .procname = "userprocess_debug", 625 .procname = "userprocess_debug",
664 .data = &sysctl_userprocess_debug, 626 .data = &sysctl_userprocess_debug,
665 .maxlen = sizeof(int), 627 .maxlen = sizeof(int),
666 .mode = 0644, 628 .mode = 0644,
667 .proc_handler = &proc_dointvec, 629 .proc_handler = proc_dointvec,
668 }, 630 },
669#endif 631#endif
670 { 632 {
671 .ctl_name = KERN_PIDMAX,
672 .procname = "pid_max", 633 .procname = "pid_max",
673 .data = &pid_max, 634 .data = &pid_max,
674 .maxlen = sizeof (int), 635 .maxlen = sizeof (int),
675 .mode = 0644, 636 .mode = 0644,
676 .proc_handler = &proc_dointvec_minmax, 637 .proc_handler = proc_dointvec_minmax,
677 .strategy = sysctl_intvec,
678 .extra1 = &pid_max_min, 638 .extra1 = &pid_max_min,
679 .extra2 = &pid_max_max, 639 .extra2 = &pid_max_max,
680 }, 640 },
681 { 641 {
682 .ctl_name = KERN_PANIC_ON_OOPS,
683 .procname = "panic_on_oops", 642 .procname = "panic_on_oops",
684 .data = &panic_on_oops, 643 .data = &panic_on_oops,
685 .maxlen = sizeof(int), 644 .maxlen = sizeof(int),
686 .mode = 0644, 645 .mode = 0644,
687 .proc_handler = &proc_dointvec, 646 .proc_handler = proc_dointvec,
688 }, 647 },
689#if defined CONFIG_PRINTK 648#if defined CONFIG_PRINTK
690 { 649 {
691 .ctl_name = KERN_PRINTK,
692 .procname = "printk", 650 .procname = "printk",
693 .data = &console_loglevel, 651 .data = &console_loglevel,
694 .maxlen = 4*sizeof(int), 652 .maxlen = 4*sizeof(int),
695 .mode = 0644, 653 .mode = 0644,
696 .proc_handler = &proc_dointvec, 654 .proc_handler = proc_dointvec,
697 }, 655 },
698 { 656 {
699 .ctl_name = KERN_PRINTK_RATELIMIT,
700 .procname = "printk_ratelimit", 657 .procname = "printk_ratelimit",
701 .data = &printk_ratelimit_state.interval, 658 .data = &printk_ratelimit_state.interval,
702 .maxlen = sizeof(int), 659 .maxlen = sizeof(int),
703 .mode = 0644, 660 .mode = 0644,
704 .proc_handler = &proc_dointvec_jiffies, 661 .proc_handler = proc_dointvec_jiffies,
705 .strategy = &sysctl_jiffies,
706 }, 662 },
707 { 663 {
708 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
709 .procname = "printk_ratelimit_burst", 664 .procname = "printk_ratelimit_burst",
710 .data = &printk_ratelimit_state.burst, 665 .data = &printk_ratelimit_state.burst,
711 .maxlen = sizeof(int), 666 .maxlen = sizeof(int),
712 .mode = 0644, 667 .mode = 0644,
713 .proc_handler = &proc_dointvec, 668 .proc_handler = proc_dointvec,
669 },
670 {
671 .procname = "printk_delay",
672 .data = &printk_delay_msec,
673 .maxlen = sizeof(int),
674 .mode = 0644,
675 .proc_handler = proc_dointvec_minmax,
676 .extra1 = &zero,
677 .extra2 = &ten_thousand,
714 }, 678 },
715#endif 679#endif
716 { 680 {
717 .ctl_name = KERN_NGROUPS_MAX,
718 .procname = "ngroups_max", 681 .procname = "ngroups_max",
719 .data = &ngroups_max, 682 .data = &ngroups_max,
720 .maxlen = sizeof (int), 683 .maxlen = sizeof (int),
721 .mode = 0444, 684 .mode = 0444,
722 .proc_handler = &proc_dointvec, 685 .proc_handler = proc_dointvec,
723 }, 686 },
724#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 687#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
725 { 688 {
726 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
727 .procname = "unknown_nmi_panic", 689 .procname = "unknown_nmi_panic",
728 .data = &unknown_nmi_panic, 690 .data = &unknown_nmi_panic,
729 .maxlen = sizeof (int), 691 .maxlen = sizeof (int),
730 .mode = 0644, 692 .mode = 0644,
731 .proc_handler = &proc_dointvec, 693 .proc_handler = proc_dointvec,
732 }, 694 },
733 { 695 {
734 .procname = "nmi_watchdog", 696 .procname = "nmi_watchdog",
735 .data = &nmi_watchdog_enabled, 697 .data = &nmi_watchdog_enabled,
736 .maxlen = sizeof (int), 698 .maxlen = sizeof (int),
737 .mode = 0644, 699 .mode = 0644,
738 .proc_handler = &proc_nmi_enabled, 700 .proc_handler = proc_nmi_enabled,
739 }, 701 },
740#endif 702#endif
741#if defined(CONFIG_X86) 703#if defined(CONFIG_X86)
742 { 704 {
743 .ctl_name = KERN_PANIC_ON_NMI,
744 .procname = "panic_on_unrecovered_nmi", 705 .procname = "panic_on_unrecovered_nmi",
745 .data = &panic_on_unrecovered_nmi, 706 .data = &panic_on_unrecovered_nmi,
746 .maxlen = sizeof(int), 707 .maxlen = sizeof(int),
747 .mode = 0644, 708 .mode = 0644,
748 .proc_handler = &proc_dointvec, 709 .proc_handler = proc_dointvec,
749 }, 710 },
750 { 711 {
751 .ctl_name = CTL_UNNUMBERED,
752 .procname = "panic_on_io_nmi", 712 .procname = "panic_on_io_nmi",
753 .data = &panic_on_io_nmi, 713 .data = &panic_on_io_nmi,
754 .maxlen = sizeof(int), 714 .maxlen = sizeof(int),
755 .mode = 0644, 715 .mode = 0644,
756 .proc_handler = &proc_dointvec, 716 .proc_handler = proc_dointvec,
757 }, 717 },
758 { 718 {
759 .ctl_name = KERN_BOOTLOADER_TYPE,
760 .procname = "bootloader_type", 719 .procname = "bootloader_type",
761 .data = &bootloader_type, 720 .data = &bootloader_type,
762 .maxlen = sizeof (int), 721 .maxlen = sizeof (int),
763 .mode = 0444, 722 .mode = 0444,
764 .proc_handler = &proc_dointvec, 723 .proc_handler = proc_dointvec,
765 }, 724 },
766 { 725 {
767 .ctl_name = CTL_UNNUMBERED,
768 .procname = "bootloader_version", 726 .procname = "bootloader_version",
769 .data = &bootloader_version, 727 .data = &bootloader_version,
770 .maxlen = sizeof (int), 728 .maxlen = sizeof (int),
771 .mode = 0444, 729 .mode = 0444,
772 .proc_handler = &proc_dointvec, 730 .proc_handler = proc_dointvec,
773 }, 731 },
774 { 732 {
775 .ctl_name = CTL_UNNUMBERED,
776 .procname = "kstack_depth_to_print", 733 .procname = "kstack_depth_to_print",
777 .data = &kstack_depth_to_print, 734 .data = &kstack_depth_to_print,
778 .maxlen = sizeof(int), 735 .maxlen = sizeof(int),
779 .mode = 0644, 736 .mode = 0644,
780 .proc_handler = &proc_dointvec, 737 .proc_handler = proc_dointvec,
781 }, 738 },
782 { 739 {
783 .ctl_name = CTL_UNNUMBERED,
784 .procname = "io_delay_type", 740 .procname = "io_delay_type",
785 .data = &io_delay_type, 741 .data = &io_delay_type,
786 .maxlen = sizeof(int), 742 .maxlen = sizeof(int),
787 .mode = 0644, 743 .mode = 0644,
788 .proc_handler = &proc_dointvec, 744 .proc_handler = proc_dointvec,
789 }, 745 },
790#endif 746#endif
791#if defined(CONFIG_MMU) 747#if defined(CONFIG_MMU)
792 { 748 {
793 .ctl_name = KERN_RANDOMIZE,
794 .procname = "randomize_va_space", 749 .procname = "randomize_va_space",
795 .data = &randomize_va_space, 750 .data = &randomize_va_space,
796 .maxlen = sizeof(int), 751 .maxlen = sizeof(int),
797 .mode = 0644, 752 .mode = 0644,
798 .proc_handler = &proc_dointvec, 753 .proc_handler = proc_dointvec,
799 }, 754 },
800#endif 755#endif
801#if defined(CONFIG_S390) && defined(CONFIG_SMP) 756#if defined(CONFIG_S390) && defined(CONFIG_SMP)
802 { 757 {
803 .ctl_name = KERN_SPIN_RETRY,
804 .procname = "spin_retry", 758 .procname = "spin_retry",
805 .data = &spin_retry, 759 .data = &spin_retry,
806 .maxlen = sizeof (int), 760 .maxlen = sizeof (int),
807 .mode = 0644, 761 .mode = 0644,
808 .proc_handler = &proc_dointvec, 762 .proc_handler = proc_dointvec,
809 }, 763 },
810#endif 764#endif
811#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 765#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
@@ -814,123 +768,104 @@ static struct ctl_table kern_table[] = {
814 .data = &acpi_realmode_flags, 768 .data = &acpi_realmode_flags,
815 .maxlen = sizeof (unsigned long), 769 .maxlen = sizeof (unsigned long),
816 .mode = 0644, 770 .mode = 0644,
817 .proc_handler = &proc_doulongvec_minmax, 771 .proc_handler = proc_doulongvec_minmax,
818 }, 772 },
819#endif 773#endif
820#ifdef CONFIG_IA64 774#ifdef CONFIG_IA64
821 { 775 {
822 .ctl_name = KERN_IA64_UNALIGNED,
823 .procname = "ignore-unaligned-usertrap", 776 .procname = "ignore-unaligned-usertrap",
824 .data = &no_unaligned_warning, 777 .data = &no_unaligned_warning,
825 .maxlen = sizeof (int), 778 .maxlen = sizeof (int),
826 .mode = 0644, 779 .mode = 0644,
827 .proc_handler = &proc_dointvec, 780 .proc_handler = proc_dointvec,
828 }, 781 },
829 { 782 {
830 .ctl_name = CTL_UNNUMBERED,
831 .procname = "unaligned-dump-stack", 783 .procname = "unaligned-dump-stack",
832 .data = &unaligned_dump_stack, 784 .data = &unaligned_dump_stack,
833 .maxlen = sizeof (int), 785 .maxlen = sizeof (int),
834 .mode = 0644, 786 .mode = 0644,
835 .proc_handler = &proc_dointvec, 787 .proc_handler = proc_dointvec,
836 }, 788 },
837#endif 789#endif
838#ifdef CONFIG_DETECT_SOFTLOCKUP 790#ifdef CONFIG_DETECT_SOFTLOCKUP
839 { 791 {
840 .ctl_name = CTL_UNNUMBERED,
841 .procname = "softlockup_panic", 792 .procname = "softlockup_panic",
842 .data = &softlockup_panic, 793 .data = &softlockup_panic,
843 .maxlen = sizeof(int), 794 .maxlen = sizeof(int),
844 .mode = 0644, 795 .mode = 0644,
845 .proc_handler = &proc_dointvec_minmax, 796 .proc_handler = proc_dointvec_minmax,
846 .strategy = &sysctl_intvec,
847 .extra1 = &zero, 797 .extra1 = &zero,
848 .extra2 = &one, 798 .extra2 = &one,
849 }, 799 },
850 { 800 {
851 .ctl_name = CTL_UNNUMBERED,
852 .procname = "softlockup_thresh", 801 .procname = "softlockup_thresh",
853 .data = &softlockup_thresh, 802 .data = &softlockup_thresh,
854 .maxlen = sizeof(int), 803 .maxlen = sizeof(int),
855 .mode = 0644, 804 .mode = 0644,
856 .proc_handler = &proc_dosoftlockup_thresh, 805 .proc_handler = proc_dosoftlockup_thresh,
857 .strategy = &sysctl_intvec,
858 .extra1 = &neg_one, 806 .extra1 = &neg_one,
859 .extra2 = &sixty, 807 .extra2 = &sixty,
860 }, 808 },
861#endif 809#endif
862#ifdef CONFIG_DETECT_HUNG_TASK 810#ifdef CONFIG_DETECT_HUNG_TASK
863 { 811 {
864 .ctl_name = CTL_UNNUMBERED,
865 .procname = "hung_task_panic", 812 .procname = "hung_task_panic",
866 .data = &sysctl_hung_task_panic, 813 .data = &sysctl_hung_task_panic,
867 .maxlen = sizeof(int), 814 .maxlen = sizeof(int),
868 .mode = 0644, 815 .mode = 0644,
869 .proc_handler = &proc_dointvec_minmax, 816 .proc_handler = proc_dointvec_minmax,
870 .strategy = &sysctl_intvec,
871 .extra1 = &zero, 817 .extra1 = &zero,
872 .extra2 = &one, 818 .extra2 = &one,
873 }, 819 },
874 { 820 {
875 .ctl_name = CTL_UNNUMBERED,
876 .procname = "hung_task_check_count", 821 .procname = "hung_task_check_count",
877 .data = &sysctl_hung_task_check_count, 822 .data = &sysctl_hung_task_check_count,
878 .maxlen = sizeof(unsigned long), 823 .maxlen = sizeof(unsigned long),
879 .mode = 0644, 824 .mode = 0644,
880 .proc_handler = &proc_doulongvec_minmax, 825 .proc_handler = proc_doulongvec_minmax,
881 .strategy = &sysctl_intvec,
882 }, 826 },
883 { 827 {
884 .ctl_name = CTL_UNNUMBERED,
885 .procname = "hung_task_timeout_secs", 828 .procname = "hung_task_timeout_secs",
886 .data = &sysctl_hung_task_timeout_secs, 829 .data = &sysctl_hung_task_timeout_secs,
887 .maxlen = sizeof(unsigned long), 830 .maxlen = sizeof(unsigned long),
888 .mode = 0644, 831 .mode = 0644,
889 .proc_handler = &proc_dohung_task_timeout_secs, 832 .proc_handler = proc_dohung_task_timeout_secs,
890 .strategy = &sysctl_intvec,
891 }, 833 },
892 { 834 {
893 .ctl_name = CTL_UNNUMBERED,
894 .procname = "hung_task_warnings", 835 .procname = "hung_task_warnings",
895 .data = &sysctl_hung_task_warnings, 836 .data = &sysctl_hung_task_warnings,
896 .maxlen = sizeof(unsigned long), 837 .maxlen = sizeof(unsigned long),
897 .mode = 0644, 838 .mode = 0644,
898 .proc_handler = &proc_doulongvec_minmax, 839 .proc_handler = proc_doulongvec_minmax,
899 .strategy = &sysctl_intvec,
900 }, 840 },
901#endif 841#endif
902#ifdef CONFIG_COMPAT 842#ifdef CONFIG_COMPAT
903 { 843 {
904 .ctl_name = KERN_COMPAT_LOG,
905 .procname = "compat-log", 844 .procname = "compat-log",
906 .data = &compat_log, 845 .data = &compat_log,
907 .maxlen = sizeof (int), 846 .maxlen = sizeof (int),
908 .mode = 0644, 847 .mode = 0644,
909 .proc_handler = &proc_dointvec, 848 .proc_handler = proc_dointvec,
910 }, 849 },
911#endif 850#endif
912#ifdef CONFIG_RT_MUTEXES 851#ifdef CONFIG_RT_MUTEXES
913 { 852 {
914 .ctl_name = KERN_MAX_LOCK_DEPTH,
915 .procname = "max_lock_depth", 853 .procname = "max_lock_depth",
916 .data = &max_lock_depth, 854 .data = &max_lock_depth,
917 .maxlen = sizeof(int), 855 .maxlen = sizeof(int),
918 .mode = 0644, 856 .mode = 0644,
919 .proc_handler = &proc_dointvec, 857 .proc_handler = proc_dointvec,
920 }, 858 },
921#endif 859#endif
922 { 860 {
923 .ctl_name = CTL_UNNUMBERED,
924 .procname = "poweroff_cmd", 861 .procname = "poweroff_cmd",
925 .data = &poweroff_cmd, 862 .data = &poweroff_cmd,
926 .maxlen = POWEROFF_CMD_PATH_LEN, 863 .maxlen = POWEROFF_CMD_PATH_LEN,
927 .mode = 0644, 864 .mode = 0644,
928 .proc_handler = &proc_dostring, 865 .proc_handler = proc_dostring,
929 .strategy = &sysctl_string,
930 }, 866 },
931#ifdef CONFIG_KEYS 867#ifdef CONFIG_KEYS
932 { 868 {
933 .ctl_name = CTL_UNNUMBERED,
934 .procname = "keys", 869 .procname = "keys",
935 .mode = 0555, 870 .mode = 0555,
936 .child = key_sysctls, 871 .child = key_sysctls,
@@ -938,155 +873,143 @@ static struct ctl_table kern_table[] = {
938#endif 873#endif
939#ifdef CONFIG_RCU_TORTURE_TEST 874#ifdef CONFIG_RCU_TORTURE_TEST
940 { 875 {
941 .ctl_name = CTL_UNNUMBERED,
942 .procname = "rcutorture_runnable", 876 .procname = "rcutorture_runnable",
943 .data = &rcutorture_runnable, 877 .data = &rcutorture_runnable,
944 .maxlen = sizeof(int), 878 .maxlen = sizeof(int),
945 .mode = 0644, 879 .mode = 0644,
946 .proc_handler = &proc_dointvec, 880 .proc_handler = proc_dointvec,
947 }, 881 },
948#endif 882#endif
949#ifdef CONFIG_SLOW_WORK 883#ifdef CONFIG_SLOW_WORK
950 { 884 {
951 .ctl_name = CTL_UNNUMBERED,
952 .procname = "slow-work", 885 .procname = "slow-work",
953 .mode = 0555, 886 .mode = 0555,
954 .child = slow_work_sysctls, 887 .child = slow_work_sysctls,
955 }, 888 },
956#endif 889#endif
957#ifdef CONFIG_PERF_COUNTERS 890#ifdef CONFIG_PERF_EVENTS
958 { 891 {
959 .ctl_name = CTL_UNNUMBERED, 892 .procname = "perf_event_paranoid",
960 .procname = "perf_counter_paranoid", 893 .data = &sysctl_perf_event_paranoid,
961 .data = &sysctl_perf_counter_paranoid, 894 .maxlen = sizeof(sysctl_perf_event_paranoid),
962 .maxlen = sizeof(sysctl_perf_counter_paranoid),
963 .mode = 0644, 895 .mode = 0644,
964 .proc_handler = &proc_dointvec, 896 .proc_handler = proc_dointvec,
965 }, 897 },
966 { 898 {
967 .ctl_name = CTL_UNNUMBERED, 899 .procname = "perf_event_mlock_kb",
968 .procname = "perf_counter_mlock_kb", 900 .data = &sysctl_perf_event_mlock,
969 .data = &sysctl_perf_counter_mlock, 901 .maxlen = sizeof(sysctl_perf_event_mlock),
970 .maxlen = sizeof(sysctl_perf_counter_mlock),
971 .mode = 0644, 902 .mode = 0644,
972 .proc_handler = &proc_dointvec, 903 .proc_handler = proc_dointvec,
973 }, 904 },
974 { 905 {
975 .ctl_name = CTL_UNNUMBERED, 906 .procname = "perf_event_max_sample_rate",
976 .procname = "perf_counter_max_sample_rate", 907 .data = &sysctl_perf_event_sample_rate,
977 .data = &sysctl_perf_counter_sample_rate, 908 .maxlen = sizeof(sysctl_perf_event_sample_rate),
978 .maxlen = sizeof(sysctl_perf_counter_sample_rate),
979 .mode = 0644, 909 .mode = 0644,
980 .proc_handler = &proc_dointvec, 910 .proc_handler = proc_dointvec,
981 }, 911 },
982#endif 912#endif
983#ifdef CONFIG_KMEMCHECK 913#ifdef CONFIG_KMEMCHECK
984 { 914 {
985 .ctl_name = CTL_UNNUMBERED,
986 .procname = "kmemcheck", 915 .procname = "kmemcheck",
987 .data = &kmemcheck_enabled, 916 .data = &kmemcheck_enabled,
988 .maxlen = sizeof(int), 917 .maxlen = sizeof(int),
989 .mode = 0644, 918 .mode = 0644,
990 .proc_handler = &proc_dointvec, 919 .proc_handler = proc_dointvec,
920 },
921#endif
922#ifdef CONFIG_BLOCK
923 {
924 .procname = "blk_iopoll",
925 .data = &blk_iopoll_enabled,
926 .maxlen = sizeof(int),
927 .mode = 0644,
928 .proc_handler = proc_dointvec,
991 }, 929 },
992#endif 930#endif
993
994/* 931/*
995 * NOTE: do not add new entries to this table unless you have read 932 * NOTE: do not add new entries to this table unless you have read
996 * Documentation/sysctl/ctl_unnumbered.txt 933 * Documentation/sysctl/ctl_unnumbered.txt
997 */ 934 */
998 { .ctl_name = 0 } 935 { }
999}; 936};
1000 937
1001static struct ctl_table vm_table[] = { 938static struct ctl_table vm_table[] = {
1002 { 939 {
1003 .ctl_name = VM_OVERCOMMIT_MEMORY,
1004 .procname = "overcommit_memory", 940 .procname = "overcommit_memory",
1005 .data = &sysctl_overcommit_memory, 941 .data = &sysctl_overcommit_memory,
1006 .maxlen = sizeof(sysctl_overcommit_memory), 942 .maxlen = sizeof(sysctl_overcommit_memory),
1007 .mode = 0644, 943 .mode = 0644,
1008 .proc_handler = &proc_dointvec, 944 .proc_handler = proc_dointvec,
1009 }, 945 },
1010 { 946 {
1011 .ctl_name = VM_PANIC_ON_OOM,
1012 .procname = "panic_on_oom", 947 .procname = "panic_on_oom",
1013 .data = &sysctl_panic_on_oom, 948 .data = &sysctl_panic_on_oom,
1014 .maxlen = sizeof(sysctl_panic_on_oom), 949 .maxlen = sizeof(sysctl_panic_on_oom),
1015 .mode = 0644, 950 .mode = 0644,
1016 .proc_handler = &proc_dointvec, 951 .proc_handler = proc_dointvec,
1017 }, 952 },
1018 { 953 {
1019 .ctl_name = CTL_UNNUMBERED,
1020 .procname = "oom_kill_allocating_task", 954 .procname = "oom_kill_allocating_task",
1021 .data = &sysctl_oom_kill_allocating_task, 955 .data = &sysctl_oom_kill_allocating_task,
1022 .maxlen = sizeof(sysctl_oom_kill_allocating_task), 956 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1023 .mode = 0644, 957 .mode = 0644,
1024 .proc_handler = &proc_dointvec, 958 .proc_handler = proc_dointvec,
1025 }, 959 },
1026 { 960 {
1027 .ctl_name = CTL_UNNUMBERED,
1028 .procname = "oom_dump_tasks", 961 .procname = "oom_dump_tasks",
1029 .data = &sysctl_oom_dump_tasks, 962 .data = &sysctl_oom_dump_tasks,
1030 .maxlen = sizeof(sysctl_oom_dump_tasks), 963 .maxlen = sizeof(sysctl_oom_dump_tasks),
1031 .mode = 0644, 964 .mode = 0644,
1032 .proc_handler = &proc_dointvec, 965 .proc_handler = proc_dointvec,
1033 }, 966 },
1034 { 967 {
1035 .ctl_name = VM_OVERCOMMIT_RATIO,
1036 .procname = "overcommit_ratio", 968 .procname = "overcommit_ratio",
1037 .data = &sysctl_overcommit_ratio, 969 .data = &sysctl_overcommit_ratio,
1038 .maxlen = sizeof(sysctl_overcommit_ratio), 970 .maxlen = sizeof(sysctl_overcommit_ratio),
1039 .mode = 0644, 971 .mode = 0644,
1040 .proc_handler = &proc_dointvec, 972 .proc_handler = proc_dointvec,
1041 }, 973 },
1042 { 974 {
1043 .ctl_name = VM_PAGE_CLUSTER,
1044 .procname = "page-cluster", 975 .procname = "page-cluster",
1045 .data = &page_cluster, 976 .data = &page_cluster,
1046 .maxlen = sizeof(int), 977 .maxlen = sizeof(int),
1047 .mode = 0644, 978 .mode = 0644,
1048 .proc_handler = &proc_dointvec, 979 .proc_handler = proc_dointvec,
1049 }, 980 },
1050 { 981 {
1051 .ctl_name = VM_DIRTY_BACKGROUND,
1052 .procname = "dirty_background_ratio", 982 .procname = "dirty_background_ratio",
1053 .data = &dirty_background_ratio, 983 .data = &dirty_background_ratio,
1054 .maxlen = sizeof(dirty_background_ratio), 984 .maxlen = sizeof(dirty_background_ratio),
1055 .mode = 0644, 985 .mode = 0644,
1056 .proc_handler = &dirty_background_ratio_handler, 986 .proc_handler = dirty_background_ratio_handler,
1057 .strategy = &sysctl_intvec,
1058 .extra1 = &zero, 987 .extra1 = &zero,
1059 .extra2 = &one_hundred, 988 .extra2 = &one_hundred,
1060 }, 989 },
1061 { 990 {
1062 .ctl_name = CTL_UNNUMBERED,
1063 .procname = "dirty_background_bytes", 991 .procname = "dirty_background_bytes",
1064 .data = &dirty_background_bytes, 992 .data = &dirty_background_bytes,
1065 .maxlen = sizeof(dirty_background_bytes), 993 .maxlen = sizeof(dirty_background_bytes),
1066 .mode = 0644, 994 .mode = 0644,
1067 .proc_handler = &dirty_background_bytes_handler, 995 .proc_handler = dirty_background_bytes_handler,
1068 .strategy = &sysctl_intvec,
1069 .extra1 = &one_ul, 996 .extra1 = &one_ul,
1070 }, 997 },
1071 { 998 {
1072 .ctl_name = VM_DIRTY_RATIO,
1073 .procname = "dirty_ratio", 999 .procname = "dirty_ratio",
1074 .data = &vm_dirty_ratio, 1000 .data = &vm_dirty_ratio,
1075 .maxlen = sizeof(vm_dirty_ratio), 1001 .maxlen = sizeof(vm_dirty_ratio),
1076 .mode = 0644, 1002 .mode = 0644,
1077 .proc_handler = &dirty_ratio_handler, 1003 .proc_handler = dirty_ratio_handler,
1078 .strategy = &sysctl_intvec,
1079 .extra1 = &zero, 1004 .extra1 = &zero,
1080 .extra2 = &one_hundred, 1005 .extra2 = &one_hundred,
1081 }, 1006 },
1082 { 1007 {
1083 .ctl_name = CTL_UNNUMBERED,
1084 .procname = "dirty_bytes", 1008 .procname = "dirty_bytes",
1085 .data = &vm_dirty_bytes, 1009 .data = &vm_dirty_bytes,
1086 .maxlen = sizeof(vm_dirty_bytes), 1010 .maxlen = sizeof(vm_dirty_bytes),
1087 .mode = 0644, 1011 .mode = 0644,
1088 .proc_handler = &dirty_bytes_handler, 1012 .proc_handler = dirty_bytes_handler,
1089 .strategy = &sysctl_intvec,
1090 .extra1 = &dirty_bytes_min, 1013 .extra1 = &dirty_bytes_min,
1091 }, 1014 },
1092 { 1015 {
@@ -1094,31 +1017,28 @@ static struct ctl_table vm_table[] = {
1094 .data = &dirty_writeback_interval, 1017 .data = &dirty_writeback_interval,
1095 .maxlen = sizeof(dirty_writeback_interval), 1018 .maxlen = sizeof(dirty_writeback_interval),
1096 .mode = 0644, 1019 .mode = 0644,
1097 .proc_handler = &dirty_writeback_centisecs_handler, 1020 .proc_handler = dirty_writeback_centisecs_handler,
1098 }, 1021 },
1099 { 1022 {
1100 .procname = "dirty_expire_centisecs", 1023 .procname = "dirty_expire_centisecs",
1101 .data = &dirty_expire_interval, 1024 .data = &dirty_expire_interval,
1102 .maxlen = sizeof(dirty_expire_interval), 1025 .maxlen = sizeof(dirty_expire_interval),
1103 .mode = 0644, 1026 .mode = 0644,
1104 .proc_handler = &proc_dointvec, 1027 .proc_handler = proc_dointvec,
1105 }, 1028 },
1106 { 1029 {
1107 .ctl_name = VM_NR_PDFLUSH_THREADS,
1108 .procname = "nr_pdflush_threads", 1030 .procname = "nr_pdflush_threads",
1109 .data = &nr_pdflush_threads, 1031 .data = &nr_pdflush_threads,
1110 .maxlen = sizeof nr_pdflush_threads, 1032 .maxlen = sizeof nr_pdflush_threads,
1111 .mode = 0444 /* read-only*/, 1033 .mode = 0444 /* read-only*/,
1112 .proc_handler = &proc_dointvec, 1034 .proc_handler = proc_dointvec,
1113 }, 1035 },
1114 { 1036 {
1115 .ctl_name = VM_SWAPPINESS,
1116 .procname = "swappiness", 1037 .procname = "swappiness",
1117 .data = &vm_swappiness, 1038 .data = &vm_swappiness,
1118 .maxlen = sizeof(vm_swappiness), 1039 .maxlen = sizeof(vm_swappiness),
1119 .mode = 0644, 1040 .mode = 0644,
1120 .proc_handler = &proc_dointvec_minmax, 1041 .proc_handler = proc_dointvec_minmax,
1121 .strategy = &sysctl_intvec,
1122 .extra1 = &zero, 1042 .extra1 = &zero,
1123 .extra2 = &one_hundred, 1043 .extra2 = &one_hundred,
1124 }, 1044 },
@@ -1128,349 +1048,320 @@ static struct ctl_table vm_table[] = {
1128 .data = NULL, 1048 .data = NULL,
1129 .maxlen = sizeof(unsigned long), 1049 .maxlen = sizeof(unsigned long),
1130 .mode = 0644, 1050 .mode = 0644,
1131 .proc_handler = &hugetlb_sysctl_handler, 1051 .proc_handler = hugetlb_sysctl_handler,
1132 .extra1 = (void *)&hugetlb_zero, 1052 .extra1 = (void *)&hugetlb_zero,
1133 .extra2 = (void *)&hugetlb_infinity, 1053 .extra2 = (void *)&hugetlb_infinity,
1134 }, 1054 },
1135 { 1055 {
1136 .ctl_name = VM_HUGETLB_GROUP,
1137 .procname = "hugetlb_shm_group", 1056 .procname = "hugetlb_shm_group",
1138 .data = &sysctl_hugetlb_shm_group, 1057 .data = &sysctl_hugetlb_shm_group,
1139 .maxlen = sizeof(gid_t), 1058 .maxlen = sizeof(gid_t),
1140 .mode = 0644, 1059 .mode = 0644,
1141 .proc_handler = &proc_dointvec, 1060 .proc_handler = proc_dointvec,
1142 }, 1061 },
1143 { 1062 {
1144 .ctl_name = CTL_UNNUMBERED,
1145 .procname = "hugepages_treat_as_movable", 1063 .procname = "hugepages_treat_as_movable",
1146 .data = &hugepages_treat_as_movable, 1064 .data = &hugepages_treat_as_movable,
1147 .maxlen = sizeof(int), 1065 .maxlen = sizeof(int),
1148 .mode = 0644, 1066 .mode = 0644,
1149 .proc_handler = &hugetlb_treat_movable_handler, 1067 .proc_handler = hugetlb_treat_movable_handler,
1150 }, 1068 },
1151 { 1069 {
1152 .ctl_name = CTL_UNNUMBERED,
1153 .procname = "nr_overcommit_hugepages", 1070 .procname = "nr_overcommit_hugepages",
1154 .data = NULL, 1071 .data = NULL,
1155 .maxlen = sizeof(unsigned long), 1072 .maxlen = sizeof(unsigned long),
1156 .mode = 0644, 1073 .mode = 0644,
1157 .proc_handler = &hugetlb_overcommit_handler, 1074 .proc_handler = hugetlb_overcommit_handler,
1158 .extra1 = (void *)&hugetlb_zero, 1075 .extra1 = (void *)&hugetlb_zero,
1159 .extra2 = (void *)&hugetlb_infinity, 1076 .extra2 = (void *)&hugetlb_infinity,
1160 }, 1077 },
1161#endif 1078#endif
1162 { 1079 {
1163 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
1164 .procname = "lowmem_reserve_ratio", 1080 .procname = "lowmem_reserve_ratio",
1165 .data = &sysctl_lowmem_reserve_ratio, 1081 .data = &sysctl_lowmem_reserve_ratio,
1166 .maxlen = sizeof(sysctl_lowmem_reserve_ratio), 1082 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1167 .mode = 0644, 1083 .mode = 0644,
1168 .proc_handler = &lowmem_reserve_ratio_sysctl_handler, 1084 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1169 .strategy = &sysctl_intvec,
1170 }, 1085 },
1171 { 1086 {
1172 .ctl_name = VM_DROP_PAGECACHE,
1173 .procname = "drop_caches", 1087 .procname = "drop_caches",
1174 .data = &sysctl_drop_caches, 1088 .data = &sysctl_drop_caches,
1175 .maxlen = sizeof(int), 1089 .maxlen = sizeof(int),
1176 .mode = 0644, 1090 .mode = 0644,
1177 .proc_handler = drop_caches_sysctl_handler, 1091 .proc_handler = drop_caches_sysctl_handler,
1178 .strategy = &sysctl_intvec,
1179 }, 1092 },
1180 { 1093 {
1181 .ctl_name = VM_MIN_FREE_KBYTES,
1182 .procname = "min_free_kbytes", 1094 .procname = "min_free_kbytes",
1183 .data = &min_free_kbytes, 1095 .data = &min_free_kbytes,
1184 .maxlen = sizeof(min_free_kbytes), 1096 .maxlen = sizeof(min_free_kbytes),
1185 .mode = 0644, 1097 .mode = 0644,
1186 .proc_handler = &min_free_kbytes_sysctl_handler, 1098 .proc_handler = min_free_kbytes_sysctl_handler,
1187 .strategy = &sysctl_intvec,
1188 .extra1 = &zero, 1099 .extra1 = &zero,
1189 }, 1100 },
1190 { 1101 {
1191 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1192 .procname = "percpu_pagelist_fraction", 1102 .procname = "percpu_pagelist_fraction",
1193 .data = &percpu_pagelist_fraction, 1103 .data = &percpu_pagelist_fraction,
1194 .maxlen = sizeof(percpu_pagelist_fraction), 1104 .maxlen = sizeof(percpu_pagelist_fraction),
1195 .mode = 0644, 1105 .mode = 0644,
1196 .proc_handler = &percpu_pagelist_fraction_sysctl_handler, 1106 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1197 .strategy = &sysctl_intvec,
1198 .extra1 = &min_percpu_pagelist_fract, 1107 .extra1 = &min_percpu_pagelist_fract,
1199 }, 1108 },
1200#ifdef CONFIG_MMU 1109#ifdef CONFIG_MMU
1201 { 1110 {
1202 .ctl_name = VM_MAX_MAP_COUNT,
1203 .procname = "max_map_count", 1111 .procname = "max_map_count",
1204 .data = &sysctl_max_map_count, 1112 .data = &sysctl_max_map_count,
1205 .maxlen = sizeof(sysctl_max_map_count), 1113 .maxlen = sizeof(sysctl_max_map_count),
1206 .mode = 0644, 1114 .mode = 0644,
1207 .proc_handler = &proc_dointvec 1115 .proc_handler = proc_dointvec
1208 }, 1116 },
1209#else 1117#else
1210 { 1118 {
1211 .ctl_name = CTL_UNNUMBERED,
1212 .procname = "nr_trim_pages", 1119 .procname = "nr_trim_pages",
1213 .data = &sysctl_nr_trim_pages, 1120 .data = &sysctl_nr_trim_pages,
1214 .maxlen = sizeof(sysctl_nr_trim_pages), 1121 .maxlen = sizeof(sysctl_nr_trim_pages),
1215 .mode = 0644, 1122 .mode = 0644,
1216 .proc_handler = &proc_dointvec_minmax, 1123 .proc_handler = proc_dointvec_minmax,
1217 .strategy = &sysctl_intvec,
1218 .extra1 = &zero, 1124 .extra1 = &zero,
1219 }, 1125 },
1220#endif 1126#endif
1221 { 1127 {
1222 .ctl_name = VM_LAPTOP_MODE,
1223 .procname = "laptop_mode", 1128 .procname = "laptop_mode",
1224 .data = &laptop_mode, 1129 .data = &laptop_mode,
1225 .maxlen = sizeof(laptop_mode), 1130 .maxlen = sizeof(laptop_mode),
1226 .mode = 0644, 1131 .mode = 0644,
1227 .proc_handler = &proc_dointvec_jiffies, 1132 .proc_handler = proc_dointvec_jiffies,
1228 .strategy = &sysctl_jiffies,
1229 }, 1133 },
1230 { 1134 {
1231 .ctl_name = VM_BLOCK_DUMP,
1232 .procname = "block_dump", 1135 .procname = "block_dump",
1233 .data = &block_dump, 1136 .data = &block_dump,
1234 .maxlen = sizeof(block_dump), 1137 .maxlen = sizeof(block_dump),
1235 .mode = 0644, 1138 .mode = 0644,
1236 .proc_handler = &proc_dointvec, 1139 .proc_handler = proc_dointvec,
1237 .strategy = &sysctl_intvec,
1238 .extra1 = &zero, 1140 .extra1 = &zero,
1239 }, 1141 },
1240 { 1142 {
1241 .ctl_name = VM_VFS_CACHE_PRESSURE,
1242 .procname = "vfs_cache_pressure", 1143 .procname = "vfs_cache_pressure",
1243 .data = &sysctl_vfs_cache_pressure, 1144 .data = &sysctl_vfs_cache_pressure,
1244 .maxlen = sizeof(sysctl_vfs_cache_pressure), 1145 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1245 .mode = 0644, 1146 .mode = 0644,
1246 .proc_handler = &proc_dointvec, 1147 .proc_handler = proc_dointvec,
1247 .strategy = &sysctl_intvec,
1248 .extra1 = &zero, 1148 .extra1 = &zero,
1249 }, 1149 },
1250#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 1150#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1251 { 1151 {
1252 .ctl_name = VM_LEGACY_VA_LAYOUT,
1253 .procname = "legacy_va_layout", 1152 .procname = "legacy_va_layout",
1254 .data = &sysctl_legacy_va_layout, 1153 .data = &sysctl_legacy_va_layout,
1255 .maxlen = sizeof(sysctl_legacy_va_layout), 1154 .maxlen = sizeof(sysctl_legacy_va_layout),
1256 .mode = 0644, 1155 .mode = 0644,
1257 .proc_handler = &proc_dointvec, 1156 .proc_handler = proc_dointvec,
1258 .strategy = &sysctl_intvec,
1259 .extra1 = &zero, 1157 .extra1 = &zero,
1260 }, 1158 },
1261#endif 1159#endif
1262#ifdef CONFIG_NUMA 1160#ifdef CONFIG_NUMA
1263 { 1161 {
1264 .ctl_name = VM_ZONE_RECLAIM_MODE,
1265 .procname = "zone_reclaim_mode", 1162 .procname = "zone_reclaim_mode",
1266 .data = &zone_reclaim_mode, 1163 .data = &zone_reclaim_mode,
1267 .maxlen = sizeof(zone_reclaim_mode), 1164 .maxlen = sizeof(zone_reclaim_mode),
1268 .mode = 0644, 1165 .mode = 0644,
1269 .proc_handler = &proc_dointvec, 1166 .proc_handler = proc_dointvec,
1270 .strategy = &sysctl_intvec,
1271 .extra1 = &zero, 1167 .extra1 = &zero,
1272 }, 1168 },
1273 { 1169 {
1274 .ctl_name = VM_MIN_UNMAPPED,
1275 .procname = "min_unmapped_ratio", 1170 .procname = "min_unmapped_ratio",
1276 .data = &sysctl_min_unmapped_ratio, 1171 .data = &sysctl_min_unmapped_ratio,
1277 .maxlen = sizeof(sysctl_min_unmapped_ratio), 1172 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1278 .mode = 0644, 1173 .mode = 0644,
1279 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler, 1174 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1280 .strategy = &sysctl_intvec,
1281 .extra1 = &zero, 1175 .extra1 = &zero,
1282 .extra2 = &one_hundred, 1176 .extra2 = &one_hundred,
1283 }, 1177 },
1284 { 1178 {
1285 .ctl_name = VM_MIN_SLAB,
1286 .procname = "min_slab_ratio", 1179 .procname = "min_slab_ratio",
1287 .data = &sysctl_min_slab_ratio, 1180 .data = &sysctl_min_slab_ratio,
1288 .maxlen = sizeof(sysctl_min_slab_ratio), 1181 .maxlen = sizeof(sysctl_min_slab_ratio),
1289 .mode = 0644, 1182 .mode = 0644,
1290 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler, 1183 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1291 .strategy = &sysctl_intvec,
1292 .extra1 = &zero, 1184 .extra1 = &zero,
1293 .extra2 = &one_hundred, 1185 .extra2 = &one_hundred,
1294 }, 1186 },
1295#endif 1187#endif
1296#ifdef CONFIG_SMP 1188#ifdef CONFIG_SMP
1297 { 1189 {
1298 .ctl_name = CTL_UNNUMBERED,
1299 .procname = "stat_interval", 1190 .procname = "stat_interval",
1300 .data = &sysctl_stat_interval, 1191 .data = &sysctl_stat_interval,
1301 .maxlen = sizeof(sysctl_stat_interval), 1192 .maxlen = sizeof(sysctl_stat_interval),
1302 .mode = 0644, 1193 .mode = 0644,
1303 .proc_handler = &proc_dointvec_jiffies, 1194 .proc_handler = proc_dointvec_jiffies,
1304 .strategy = &sysctl_jiffies,
1305 }, 1195 },
1306#endif 1196#endif
1307 { 1197 {
1308 .ctl_name = CTL_UNNUMBERED,
1309 .procname = "mmap_min_addr", 1198 .procname = "mmap_min_addr",
1310 .data = &dac_mmap_min_addr, 1199 .data = &dac_mmap_min_addr,
1311 .maxlen = sizeof(unsigned long), 1200 .maxlen = sizeof(unsigned long),
1312 .mode = 0644, 1201 .mode = 0644,
1313 .proc_handler = &mmap_min_addr_handler, 1202 .proc_handler = mmap_min_addr_handler,
1314 }, 1203 },
1315#ifdef CONFIG_NUMA 1204#ifdef CONFIG_NUMA
1316 { 1205 {
1317 .ctl_name = CTL_UNNUMBERED,
1318 .procname = "numa_zonelist_order", 1206 .procname = "numa_zonelist_order",
1319 .data = &numa_zonelist_order, 1207 .data = &numa_zonelist_order,
1320 .maxlen = NUMA_ZONELIST_ORDER_LEN, 1208 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1321 .mode = 0644, 1209 .mode = 0644,
1322 .proc_handler = &numa_zonelist_order_handler, 1210 .proc_handler = numa_zonelist_order_handler,
1323 .strategy = &sysctl_string,
1324 }, 1211 },
1325#endif 1212#endif
1326#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \ 1213#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1327 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1214 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1328 { 1215 {
1329 .ctl_name = VM_VDSO_ENABLED,
1330 .procname = "vdso_enabled", 1216 .procname = "vdso_enabled",
1331 .data = &vdso_enabled, 1217 .data = &vdso_enabled,
1332 .maxlen = sizeof(vdso_enabled), 1218 .maxlen = sizeof(vdso_enabled),
1333 .mode = 0644, 1219 .mode = 0644,
1334 .proc_handler = &proc_dointvec, 1220 .proc_handler = proc_dointvec,
1335 .strategy = &sysctl_intvec,
1336 .extra1 = &zero, 1221 .extra1 = &zero,
1337 }, 1222 },
1338#endif 1223#endif
1339#ifdef CONFIG_HIGHMEM 1224#ifdef CONFIG_HIGHMEM
1340 { 1225 {
1341 .ctl_name = CTL_UNNUMBERED,
1342 .procname = "highmem_is_dirtyable", 1226 .procname = "highmem_is_dirtyable",
1343 .data = &vm_highmem_is_dirtyable, 1227 .data = &vm_highmem_is_dirtyable,
1344 .maxlen = sizeof(vm_highmem_is_dirtyable), 1228 .maxlen = sizeof(vm_highmem_is_dirtyable),
1345 .mode = 0644, 1229 .mode = 0644,
1346 .proc_handler = &proc_dointvec_minmax, 1230 .proc_handler = proc_dointvec_minmax,
1347 .strategy = &sysctl_intvec,
1348 .extra1 = &zero, 1231 .extra1 = &zero,
1349 .extra2 = &one, 1232 .extra2 = &one,
1350 }, 1233 },
1351#endif 1234#endif
1352 { 1235 {
1353 .ctl_name = CTL_UNNUMBERED,
1354 .procname = "scan_unevictable_pages", 1236 .procname = "scan_unevictable_pages",
1355 .data = &scan_unevictable_pages, 1237 .data = &scan_unevictable_pages,
1356 .maxlen = sizeof(scan_unevictable_pages), 1238 .maxlen = sizeof(scan_unevictable_pages),
1357 .mode = 0644, 1239 .mode = 0644,
1358 .proc_handler = &scan_unevictable_handler, 1240 .proc_handler = scan_unevictable_handler,
1241 },
1242#ifdef CONFIG_MEMORY_FAILURE
1243 {
1244 .procname = "memory_failure_early_kill",
1245 .data = &sysctl_memory_failure_early_kill,
1246 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1247 .mode = 0644,
1248 .proc_handler = proc_dointvec_minmax,
1249 .extra1 = &zero,
1250 .extra2 = &one,
1359 }, 1251 },
1252 {
1253 .procname = "memory_failure_recovery",
1254 .data = &sysctl_memory_failure_recovery,
1255 .maxlen = sizeof(sysctl_memory_failure_recovery),
1256 .mode = 0644,
1257 .proc_handler = proc_dointvec_minmax,
1258 .extra1 = &zero,
1259 .extra2 = &one,
1260 },
1261#endif
1262
1360/* 1263/*
1361 * NOTE: do not add new entries to this table unless you have read 1264 * NOTE: do not add new entries to this table unless you have read
1362 * Documentation/sysctl/ctl_unnumbered.txt 1265 * Documentation/sysctl/ctl_unnumbered.txt
1363 */ 1266 */
1364 { .ctl_name = 0 } 1267 { }
1365}; 1268};
1366 1269
1367#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1270#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1368static struct ctl_table binfmt_misc_table[] = { 1271static struct ctl_table binfmt_misc_table[] = {
1369 { .ctl_name = 0 } 1272 { }
1370}; 1273};
1371#endif 1274#endif
1372 1275
1373static struct ctl_table fs_table[] = { 1276static struct ctl_table fs_table[] = {
1374 { 1277 {
1375 .ctl_name = FS_NRINODE,
1376 .procname = "inode-nr", 1278 .procname = "inode-nr",
1377 .data = &inodes_stat, 1279 .data = &inodes_stat,
1378 .maxlen = 2*sizeof(int), 1280 .maxlen = 2*sizeof(int),
1379 .mode = 0444, 1281 .mode = 0444,
1380 .proc_handler = &proc_dointvec, 1282 .proc_handler = proc_dointvec,
1381 }, 1283 },
1382 { 1284 {
1383 .ctl_name = FS_STATINODE,
1384 .procname = "inode-state", 1285 .procname = "inode-state",
1385 .data = &inodes_stat, 1286 .data = &inodes_stat,
1386 .maxlen = 7*sizeof(int), 1287 .maxlen = 7*sizeof(int),
1387 .mode = 0444, 1288 .mode = 0444,
1388 .proc_handler = &proc_dointvec, 1289 .proc_handler = proc_dointvec,
1389 }, 1290 },
1390 { 1291 {
1391 .procname = "file-nr", 1292 .procname = "file-nr",
1392 .data = &files_stat, 1293 .data = &files_stat,
1393 .maxlen = 3*sizeof(int), 1294 .maxlen = 3*sizeof(int),
1394 .mode = 0444, 1295 .mode = 0444,
1395 .proc_handler = &proc_nr_files, 1296 .proc_handler = proc_nr_files,
1396 }, 1297 },
1397 { 1298 {
1398 .ctl_name = FS_MAXFILE,
1399 .procname = "file-max", 1299 .procname = "file-max",
1400 .data = &files_stat.max_files, 1300 .data = &files_stat.max_files,
1401 .maxlen = sizeof(int), 1301 .maxlen = sizeof(int),
1402 .mode = 0644, 1302 .mode = 0644,
1403 .proc_handler = &proc_dointvec, 1303 .proc_handler = proc_dointvec,
1404 }, 1304 },
1405 { 1305 {
1406 .ctl_name = CTL_UNNUMBERED,
1407 .procname = "nr_open", 1306 .procname = "nr_open",
1408 .data = &sysctl_nr_open, 1307 .data = &sysctl_nr_open,
1409 .maxlen = sizeof(int), 1308 .maxlen = sizeof(int),
1410 .mode = 0644, 1309 .mode = 0644,
1411 .proc_handler = &proc_dointvec_minmax, 1310 .proc_handler = proc_dointvec_minmax,
1412 .extra1 = &sysctl_nr_open_min, 1311 .extra1 = &sysctl_nr_open_min,
1413 .extra2 = &sysctl_nr_open_max, 1312 .extra2 = &sysctl_nr_open_max,
1414 }, 1313 },
1415 { 1314 {
1416 .ctl_name = FS_DENTRY,
1417 .procname = "dentry-state", 1315 .procname = "dentry-state",
1418 .data = &dentry_stat, 1316 .data = &dentry_stat,
1419 .maxlen = 6*sizeof(int), 1317 .maxlen = 6*sizeof(int),
1420 .mode = 0444, 1318 .mode = 0444,
1421 .proc_handler = &proc_dointvec, 1319 .proc_handler = proc_dointvec,
1422 }, 1320 },
1423 { 1321 {
1424 .ctl_name = FS_OVERFLOWUID,
1425 .procname = "overflowuid", 1322 .procname = "overflowuid",
1426 .data = &fs_overflowuid, 1323 .data = &fs_overflowuid,
1427 .maxlen = sizeof(int), 1324 .maxlen = sizeof(int),
1428 .mode = 0644, 1325 .mode = 0644,
1429 .proc_handler = &proc_dointvec_minmax, 1326 .proc_handler = proc_dointvec_minmax,
1430 .strategy = &sysctl_intvec,
1431 .extra1 = &minolduid, 1327 .extra1 = &minolduid,
1432 .extra2 = &maxolduid, 1328 .extra2 = &maxolduid,
1433 }, 1329 },
1434 { 1330 {
1435 .ctl_name = FS_OVERFLOWGID,
1436 .procname = "overflowgid", 1331 .procname = "overflowgid",
1437 .data = &fs_overflowgid, 1332 .data = &fs_overflowgid,
1438 .maxlen = sizeof(int), 1333 .maxlen = sizeof(int),
1439 .mode = 0644, 1334 .mode = 0644,
1440 .proc_handler = &proc_dointvec_minmax, 1335 .proc_handler = proc_dointvec_minmax,
1441 .strategy = &sysctl_intvec,
1442 .extra1 = &minolduid, 1336 .extra1 = &minolduid,
1443 .extra2 = &maxolduid, 1337 .extra2 = &maxolduid,
1444 }, 1338 },
1445#ifdef CONFIG_FILE_LOCKING 1339#ifdef CONFIG_FILE_LOCKING
1446 { 1340 {
1447 .ctl_name = FS_LEASES,
1448 .procname = "leases-enable", 1341 .procname = "leases-enable",
1449 .data = &leases_enable, 1342 .data = &leases_enable,
1450 .maxlen = sizeof(int), 1343 .maxlen = sizeof(int),
1451 .mode = 0644, 1344 .mode = 0644,
1452 .proc_handler = &proc_dointvec, 1345 .proc_handler = proc_dointvec,
1453 }, 1346 },
1454#endif 1347#endif
1455#ifdef CONFIG_DNOTIFY 1348#ifdef CONFIG_DNOTIFY
1456 { 1349 {
1457 .ctl_name = FS_DIR_NOTIFY,
1458 .procname = "dir-notify-enable", 1350 .procname = "dir-notify-enable",
1459 .data = &dir_notify_enable, 1351 .data = &dir_notify_enable,
1460 .maxlen = sizeof(int), 1352 .maxlen = sizeof(int),
1461 .mode = 0644, 1353 .mode = 0644,
1462 .proc_handler = &proc_dointvec, 1354 .proc_handler = proc_dointvec,
1463 }, 1355 },
1464#endif 1356#endif
1465#ifdef CONFIG_MMU 1357#ifdef CONFIG_MMU
1466#ifdef CONFIG_FILE_LOCKING 1358#ifdef CONFIG_FILE_LOCKING
1467 { 1359 {
1468 .ctl_name = FS_LEASE_TIME,
1469 .procname = "lease-break-time", 1360 .procname = "lease-break-time",
1470 .data = &lease_break_time, 1361 .data = &lease_break_time,
1471 .maxlen = sizeof(int), 1362 .maxlen = sizeof(int),
1472 .mode = 0644, 1363 .mode = 0644,
1473 .proc_handler = &proc_dointvec, 1364 .proc_handler = proc_dointvec,
1474 }, 1365 },
1475#endif 1366#endif
1476#ifdef CONFIG_AIO 1367#ifdef CONFIG_AIO
@@ -1479,19 +1370,18 @@ static struct ctl_table fs_table[] = {
1479 .data = &aio_nr, 1370 .data = &aio_nr,
1480 .maxlen = sizeof(aio_nr), 1371 .maxlen = sizeof(aio_nr),
1481 .mode = 0444, 1372 .mode = 0444,
1482 .proc_handler = &proc_doulongvec_minmax, 1373 .proc_handler = proc_doulongvec_minmax,
1483 }, 1374 },
1484 { 1375 {
1485 .procname = "aio-max-nr", 1376 .procname = "aio-max-nr",
1486 .data = &aio_max_nr, 1377 .data = &aio_max_nr,
1487 .maxlen = sizeof(aio_max_nr), 1378 .maxlen = sizeof(aio_max_nr),
1488 .mode = 0644, 1379 .mode = 0644,
1489 .proc_handler = &proc_doulongvec_minmax, 1380 .proc_handler = proc_doulongvec_minmax,
1490 }, 1381 },
1491#endif /* CONFIG_AIO */ 1382#endif /* CONFIG_AIO */
1492#ifdef CONFIG_INOTIFY_USER 1383#ifdef CONFIG_INOTIFY_USER
1493 { 1384 {
1494 .ctl_name = FS_INOTIFY,
1495 .procname = "inotify", 1385 .procname = "inotify",
1496 .mode = 0555, 1386 .mode = 0555,
1497 .child = inotify_table, 1387 .child = inotify_table,
@@ -1506,19 +1396,16 @@ static struct ctl_table fs_table[] = {
1506#endif 1396#endif
1507#endif 1397#endif
1508 { 1398 {
1509 .ctl_name = KERN_SETUID_DUMPABLE,
1510 .procname = "suid_dumpable", 1399 .procname = "suid_dumpable",
1511 .data = &suid_dumpable, 1400 .data = &suid_dumpable,
1512 .maxlen = sizeof(int), 1401 .maxlen = sizeof(int),
1513 .mode = 0644, 1402 .mode = 0644,
1514 .proc_handler = &proc_dointvec_minmax, 1403 .proc_handler = proc_dointvec_minmax,
1515 .strategy = &sysctl_intvec,
1516 .extra1 = &zero, 1404 .extra1 = &zero,
1517 .extra2 = &two, 1405 .extra2 = &two,
1518 }, 1406 },
1519#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1407#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1520 { 1408 {
1521 .ctl_name = CTL_UNNUMBERED,
1522 .procname = "binfmt_misc", 1409 .procname = "binfmt_misc",
1523 .mode = 0555, 1410 .mode = 0555,
1524 .child = binfmt_misc_table, 1411 .child = binfmt_misc_table,
@@ -1528,13 +1415,12 @@ static struct ctl_table fs_table[] = {
1528 * NOTE: do not add new entries to this table unless you have read 1415 * NOTE: do not add new entries to this table unless you have read
1529 * Documentation/sysctl/ctl_unnumbered.txt 1416 * Documentation/sysctl/ctl_unnumbered.txt
1530 */ 1417 */
1531 { .ctl_name = 0 } 1418 { }
1532}; 1419};
1533 1420
1534static struct ctl_table debug_table[] = { 1421static struct ctl_table debug_table[] = {
1535#if defined(CONFIG_X86) || defined(CONFIG_PPC) 1422#if defined(CONFIG_X86) || defined(CONFIG_PPC)
1536 { 1423 {
1537 .ctl_name = CTL_UNNUMBERED,
1538 .procname = "exception-trace", 1424 .procname = "exception-trace",
1539 .data = &show_unhandled_signals, 1425 .data = &show_unhandled_signals,
1540 .maxlen = sizeof(int), 1426 .maxlen = sizeof(int),
@@ -1542,11 +1428,11 @@ static struct ctl_table debug_table[] = {
1542 .proc_handler = proc_dointvec 1428 .proc_handler = proc_dointvec
1543 }, 1429 },
1544#endif 1430#endif
1545 { .ctl_name = 0 } 1431 { }
1546}; 1432};
1547 1433
1548static struct ctl_table dev_table[] = { 1434static struct ctl_table dev_table[] = {
1549 { .ctl_name = 0 } 1435 { }
1550}; 1436};
1551 1437
1552static DEFINE_SPINLOCK(sysctl_lock); 1438static DEFINE_SPINLOCK(sysctl_lock);
@@ -1700,122 +1586,6 @@ void register_sysctl_root(struct ctl_table_root *root)
1700 spin_unlock(&sysctl_lock); 1586 spin_unlock(&sysctl_lock);
1701} 1587}
1702 1588
1703#ifdef CONFIG_SYSCTL_SYSCALL
1704/* Perform the actual read/write of a sysctl table entry. */
1705static int do_sysctl_strategy(struct ctl_table_root *root,
1706 struct ctl_table *table,
1707 void __user *oldval, size_t __user *oldlenp,
1708 void __user *newval, size_t newlen)
1709{
1710 int op = 0, rc;
1711
1712 if (oldval)
1713 op |= MAY_READ;
1714 if (newval)
1715 op |= MAY_WRITE;
1716 if (sysctl_perm(root, table, op))
1717 return -EPERM;
1718
1719 if (table->strategy) {
1720 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1721 if (rc < 0)
1722 return rc;
1723 if (rc > 0)
1724 return 0;
1725 }
1726
1727 /* If there is no strategy routine, or if the strategy returns
1728 * zero, proceed with automatic r/w */
1729 if (table->data && table->maxlen) {
1730 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1731 if (rc < 0)
1732 return rc;
1733 }
1734 return 0;
1735}
1736
1737static int parse_table(int __user *name, int nlen,
1738 void __user *oldval, size_t __user *oldlenp,
1739 void __user *newval, size_t newlen,
1740 struct ctl_table_root *root,
1741 struct ctl_table *table)
1742{
1743 int n;
1744repeat:
1745 if (!nlen)
1746 return -ENOTDIR;
1747 if (get_user(n, name))
1748 return -EFAULT;
1749 for ( ; table->ctl_name || table->procname; table++) {
1750 if (!table->ctl_name)
1751 continue;
1752 if (n == table->ctl_name) {
1753 int error;
1754 if (table->child) {
1755 if (sysctl_perm(root, table, MAY_EXEC))
1756 return -EPERM;
1757 name++;
1758 nlen--;
1759 table = table->child;
1760 goto repeat;
1761 }
1762 error = do_sysctl_strategy(root, table,
1763 oldval, oldlenp,
1764 newval, newlen);
1765 return error;
1766 }
1767 }
1768 return -ENOTDIR;
1769}
1770
1771int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1772 void __user *newval, size_t newlen)
1773{
1774 struct ctl_table_header *head;
1775 int error = -ENOTDIR;
1776
1777 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1778 return -ENOTDIR;
1779 if (oldval) {
1780 int old_len;
1781 if (!oldlenp || get_user(old_len, oldlenp))
1782 return -EFAULT;
1783 }
1784
1785 for (head = sysctl_head_next(NULL); head;
1786 head = sysctl_head_next(head)) {
1787 error = parse_table(name, nlen, oldval, oldlenp,
1788 newval, newlen,
1789 head->root, head->ctl_table);
1790 if (error != -ENOTDIR) {
1791 sysctl_head_finish(head);
1792 break;
1793 }
1794 }
1795 return error;
1796}
1797
1798SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1799{
1800 struct __sysctl_args tmp;
1801 int error;
1802
1803 if (copy_from_user(&tmp, args, sizeof(tmp)))
1804 return -EFAULT;
1805
1806 error = deprecated_sysctl_warning(&tmp);
1807 if (error)
1808 goto out;
1809
1810 lock_kernel();
1811 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1812 tmp.newval, tmp.newlen);
1813 unlock_kernel();
1814out:
1815 return error;
1816}
1817#endif /* CONFIG_SYSCTL_SYSCALL */
1818
1819/* 1589/*
1820 * sysctl_perm does NOT grant the superuser all rights automatically, because 1590 * sysctl_perm does NOT grant the superuser all rights automatically, because
1821 * some sysctl variables are readonly even to root. 1591 * some sysctl variables are readonly even to root.
@@ -1851,7 +1621,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1851 1621
1852static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) 1622static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1853{ 1623{
1854 for (; table->ctl_name || table->procname; table++) { 1624 for (; table->procname; table++) {
1855 table->parent = parent; 1625 table->parent = parent;
1856 if (table->child) 1626 if (table->child)
1857 sysctl_set_parent(table, table->child); 1627 sysctl_set_parent(table, table->child);
@@ -1883,11 +1653,11 @@ static struct ctl_table *is_branch_in(struct ctl_table *branch,
1883 return NULL; 1653 return NULL;
1884 1654
1885 /* ... and nothing else */ 1655 /* ... and nothing else */
1886 if (branch[1].procname || branch[1].ctl_name) 1656 if (branch[1].procname)
1887 return NULL; 1657 return NULL;
1888 1658
1889 /* table should contain subdirectory with the same name */ 1659 /* table should contain subdirectory with the same name */
1890 for (p = table; p->procname || p->ctl_name; p++) { 1660 for (p = table; p->procname; p++) {
1891 if (!p->child) 1661 if (!p->child)
1892 continue; 1662 continue;
1893 if (p->procname && strcmp(p->procname, s) == 0) 1663 if (p->procname && strcmp(p->procname, s) == 0)
@@ -1932,9 +1702,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1932 * 1702 *
1933 * The members of the &struct ctl_table structure are used as follows: 1703 * The members of the &struct ctl_table structure are used as follows:
1934 * 1704 *
1935 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1936 * must be unique within that level of sysctl
1937 *
1938 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not 1705 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1939 * enter a sysctl file 1706 * enter a sysctl file
1940 * 1707 *
@@ -1949,8 +1716,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1949 * 1716 *
1950 * proc_handler - the text handler routine (described below) 1717 * proc_handler - the text handler routine (described below)
1951 * 1718 *
1952 * strategy - the strategy routine (described below)
1953 *
1954 * de - for internal use by the sysctl routines 1719 * de - for internal use by the sysctl routines
1955 * 1720 *
1956 * extra1, extra2 - extra pointers usable by the proc handler routines 1721 * extra1, extra2 - extra pointers usable by the proc handler routines
@@ -1963,19 +1728,6 @@ static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1963 * struct enable minimal validation of the values being written to be 1728 * struct enable minimal validation of the values being written to be
1964 * performed, and the mode field allows minimal authentication. 1729 * performed, and the mode field allows minimal authentication.
1965 * 1730 *
1966 * More sophisticated management can be enabled by the provision of a
1967 * strategy routine with the table entry. This will be called before
1968 * any automatic read or write of the data is performed.
1969 *
1970 * The strategy routine may return
1971 *
1972 * < 0 - Error occurred (error is passed to user process)
1973 *
1974 * 0 - OK - proceed with automatic read or write.
1975 *
1976 * > 0 - OK - read or write has been done by the strategy routine, so
1977 * return immediately.
1978 *
1979 * There must be a proc_handler routine for any terminal nodes 1731 * There must be a proc_handler routine for any terminal nodes
1980 * mirrored under /proc/sys (non-terminals are handled by a built-in 1732 * mirrored under /proc/sys (non-terminals are handled by a built-in
1981 * directory handler). Several default handlers are available to 1733 * directory handler). Several default handlers are available to
@@ -2002,13 +1754,13 @@ struct ctl_table_header *__register_sysctl_paths(
2002 struct ctl_table_set *set; 1754 struct ctl_table_set *set;
2003 1755
2004 /* Count the path components */ 1756 /* Count the path components */
2005 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath) 1757 for (npath = 0; path[npath].procname; ++npath)
2006 ; 1758 ;
2007 1759
2008 /* 1760 /*
2009 * For each path component, allocate a 2-element ctl_table array. 1761 * For each path component, allocate a 2-element ctl_table array.
2010 * The first array element will be filled with the sysctl entry 1762 * The first array element will be filled with the sysctl entry
2011 * for this, the second will be the sentinel (ctl_name == 0). 1763 * for this, the second will be the sentinel (procname == 0).
2012 * 1764 *
2013 * We allocate everything in one go so that we don't have to 1765 * We allocate everything in one go so that we don't have to
2014 * worry about freeing additional memory in unregister_sysctl_table. 1766 * worry about freeing additional memory in unregister_sysctl_table.
@@ -2025,7 +1777,6 @@ struct ctl_table_header *__register_sysctl_paths(
2025 for (n = 0; n < npath; ++n, ++path) { 1777 for (n = 0; n < npath; ++n, ++path) {
2026 /* Copy the procname */ 1778 /* Copy the procname */
2027 new->procname = path->procname; 1779 new->procname = path->procname;
2028 new->ctl_name = path->ctl_name;
2029 new->mode = 0555; 1780 new->mode = 0555;
2030 1781
2031 *prevp = new; 1782 *prevp = new;
@@ -2185,7 +1936,7 @@ void sysctl_head_put(struct ctl_table_header *head)
2185#ifdef CONFIG_PROC_SYSCTL 1936#ifdef CONFIG_PROC_SYSCTL
2186 1937
2187static int _proc_do_string(void* data, int maxlen, int write, 1938static int _proc_do_string(void* data, int maxlen, int write,
2188 struct file *filp, void __user *buffer, 1939 void __user *buffer,
2189 size_t *lenp, loff_t *ppos) 1940 size_t *lenp, loff_t *ppos)
2190{ 1941{
2191 size_t len; 1942 size_t len;
@@ -2246,7 +1997,6 @@ static int _proc_do_string(void* data, int maxlen, int write,
2246 * proc_dostring - read a string sysctl 1997 * proc_dostring - read a string sysctl
2247 * @table: the sysctl table 1998 * @table: the sysctl table
2248 * @write: %TRUE if this is a write to the sysctl file 1999 * @write: %TRUE if this is a write to the sysctl file
2249 * @filp: the file structure
2250 * @buffer: the user buffer 2000 * @buffer: the user buffer
2251 * @lenp: the size of the user buffer 2001 * @lenp: the size of the user buffer
2252 * @ppos: file position 2002 * @ppos: file position
@@ -2260,10 +2010,10 @@ static int _proc_do_string(void* data, int maxlen, int write,
2260 * 2010 *
2261 * Returns 0 on success. 2011 * Returns 0 on success.
2262 */ 2012 */
2263int proc_dostring(struct ctl_table *table, int write, struct file *filp, 2013int proc_dostring(struct ctl_table *table, int write,
2264 void __user *buffer, size_t *lenp, loff_t *ppos) 2014 void __user *buffer, size_t *lenp, loff_t *ppos)
2265{ 2015{
2266 return _proc_do_string(table->data, table->maxlen, write, filp, 2016 return _proc_do_string(table->data, table->maxlen, write,
2267 buffer, lenp, ppos); 2017 buffer, lenp, ppos);
2268} 2018}
2269 2019
@@ -2288,7 +2038,7 @@ static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
2288} 2038}
2289 2039
2290static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table, 2040static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2291 int write, struct file *filp, void __user *buffer, 2041 int write, void __user *buffer,
2292 size_t *lenp, loff_t *ppos, 2042 size_t *lenp, loff_t *ppos,
2293 int (*conv)(int *negp, unsigned long *lvalp, int *valp, 2043 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2294 int write, void *data), 2044 int write, void *data),
@@ -2395,13 +2145,13 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2395#undef TMPBUFLEN 2145#undef TMPBUFLEN
2396} 2146}
2397 2147
2398static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp, 2148static int do_proc_dointvec(struct ctl_table *table, int write,
2399 void __user *buffer, size_t *lenp, loff_t *ppos, 2149 void __user *buffer, size_t *lenp, loff_t *ppos,
2400 int (*conv)(int *negp, unsigned long *lvalp, int *valp, 2150 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2401 int write, void *data), 2151 int write, void *data),
2402 void *data) 2152 void *data)
2403{ 2153{
2404 return __do_proc_dointvec(table->data, table, write, filp, 2154 return __do_proc_dointvec(table->data, table, write,
2405 buffer, lenp, ppos, conv, data); 2155 buffer, lenp, ppos, conv, data);
2406} 2156}
2407 2157
@@ -2409,7 +2159,6 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil
2409 * proc_dointvec - read a vector of integers 2159 * proc_dointvec - read a vector of integers
2410 * @table: the sysctl table 2160 * @table: the sysctl table
2411 * @write: %TRUE if this is a write to the sysctl file 2161 * @write: %TRUE if this is a write to the sysctl file
2412 * @filp: the file structure
2413 * @buffer: the user buffer 2162 * @buffer: the user buffer
2414 * @lenp: the size of the user buffer 2163 * @lenp: the size of the user buffer
2415 * @ppos: file position 2164 * @ppos: file position
@@ -2419,10 +2168,10 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil
2419 * 2168 *
2420 * Returns 0 on success. 2169 * Returns 0 on success.
2421 */ 2170 */
2422int proc_dointvec(struct ctl_table *table, int write, struct file *filp, 2171int proc_dointvec(struct ctl_table *table, int write,
2423 void __user *buffer, size_t *lenp, loff_t *ppos) 2172 void __user *buffer, size_t *lenp, loff_t *ppos)
2424{ 2173{
2425 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2174 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2426 NULL,NULL); 2175 NULL,NULL);
2427} 2176}
2428 2177
@@ -2430,7 +2179,7 @@ int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2430 * Taint values can only be increased 2179 * Taint values can only be increased
2431 * This means we can safely use a temporary. 2180 * This means we can safely use a temporary.
2432 */ 2181 */
2433static int proc_taint(struct ctl_table *table, int write, struct file *filp, 2182static int proc_taint(struct ctl_table *table, int write,
2434 void __user *buffer, size_t *lenp, loff_t *ppos) 2183 void __user *buffer, size_t *lenp, loff_t *ppos)
2435{ 2184{
2436 struct ctl_table t; 2185 struct ctl_table t;
@@ -2442,7 +2191,7 @@ static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2442 2191
2443 t = *table; 2192 t = *table;
2444 t.data = &tmptaint; 2193 t.data = &tmptaint;
2445 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos); 2194 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2446 if (err < 0) 2195 if (err < 0)
2447 return err; 2196 return err;
2448 2197
@@ -2494,7 +2243,6 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2494 * proc_dointvec_minmax - read a vector of integers with min/max values 2243 * proc_dointvec_minmax - read a vector of integers with min/max values
2495 * @table: the sysctl table 2244 * @table: the sysctl table
2496 * @write: %TRUE if this is a write to the sysctl file 2245 * @write: %TRUE if this is a write to the sysctl file
2497 * @filp: the file structure
2498 * @buffer: the user buffer 2246 * @buffer: the user buffer
2499 * @lenp: the size of the user buffer 2247 * @lenp: the size of the user buffer
2500 * @ppos: file position 2248 * @ppos: file position
@@ -2507,19 +2255,18 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2507 * 2255 *
2508 * Returns 0 on success. 2256 * Returns 0 on success.
2509 */ 2257 */
2510int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp, 2258int proc_dointvec_minmax(struct ctl_table *table, int write,
2511 void __user *buffer, size_t *lenp, loff_t *ppos) 2259 void __user *buffer, size_t *lenp, loff_t *ppos)
2512{ 2260{
2513 struct do_proc_dointvec_minmax_conv_param param = { 2261 struct do_proc_dointvec_minmax_conv_param param = {
2514 .min = (int *) table->extra1, 2262 .min = (int *) table->extra1,
2515 .max = (int *) table->extra2, 2263 .max = (int *) table->extra2,
2516 }; 2264 };
2517 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, 2265 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2518 do_proc_dointvec_minmax_conv, &param); 2266 do_proc_dointvec_minmax_conv, &param);
2519} 2267}
2520 2268
2521static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, 2269static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2522 struct file *filp,
2523 void __user *buffer, 2270 void __user *buffer,
2524 size_t *lenp, loff_t *ppos, 2271 size_t *lenp, loff_t *ppos,
2525 unsigned long convmul, 2272 unsigned long convmul,
@@ -2624,21 +2371,19 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
2624} 2371}
2625 2372
2626static int do_proc_doulongvec_minmax(struct ctl_table *table, int write, 2373static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2627 struct file *filp,
2628 void __user *buffer, 2374 void __user *buffer,
2629 size_t *lenp, loff_t *ppos, 2375 size_t *lenp, loff_t *ppos,
2630 unsigned long convmul, 2376 unsigned long convmul,
2631 unsigned long convdiv) 2377 unsigned long convdiv)
2632{ 2378{
2633 return __do_proc_doulongvec_minmax(table->data, table, write, 2379 return __do_proc_doulongvec_minmax(table->data, table, write,
2634 filp, buffer, lenp, ppos, convmul, convdiv); 2380 buffer, lenp, ppos, convmul, convdiv);
2635} 2381}
2636 2382
2637/** 2383/**
2638 * proc_doulongvec_minmax - read a vector of long integers with min/max values 2384 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2639 * @table: the sysctl table 2385 * @table: the sysctl table
2640 * @write: %TRUE if this is a write to the sysctl file 2386 * @write: %TRUE if this is a write to the sysctl file
2641 * @filp: the file structure
2642 * @buffer: the user buffer 2387 * @buffer: the user buffer
2643 * @lenp: the size of the user buffer 2388 * @lenp: the size of the user buffer
2644 * @ppos: file position 2389 * @ppos: file position
@@ -2651,17 +2396,16 @@ static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2651 * 2396 *
2652 * Returns 0 on success. 2397 * Returns 0 on success.
2653 */ 2398 */
2654int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp, 2399int proc_doulongvec_minmax(struct ctl_table *table, int write,
2655 void __user *buffer, size_t *lenp, loff_t *ppos) 2400 void __user *buffer, size_t *lenp, loff_t *ppos)
2656{ 2401{
2657 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l); 2402 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2658} 2403}
2659 2404
2660/** 2405/**
2661 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values 2406 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2662 * @table: the sysctl table 2407 * @table: the sysctl table
2663 * @write: %TRUE if this is a write to the sysctl file 2408 * @write: %TRUE if this is a write to the sysctl file
2664 * @filp: the file structure
2665 * @buffer: the user buffer 2409 * @buffer: the user buffer
2666 * @lenp: the size of the user buffer 2410 * @lenp: the size of the user buffer
2667 * @ppos: file position 2411 * @ppos: file position
@@ -2676,11 +2420,10 @@ int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp
2676 * Returns 0 on success. 2420 * Returns 0 on success.
2677 */ 2421 */
2678int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 2422int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2679 struct file *filp,
2680 void __user *buffer, 2423 void __user *buffer,
2681 size_t *lenp, loff_t *ppos) 2424 size_t *lenp, loff_t *ppos)
2682{ 2425{
2683 return do_proc_doulongvec_minmax(table, write, filp, buffer, 2426 return do_proc_doulongvec_minmax(table, write, buffer,
2684 lenp, ppos, HZ, 1000l); 2427 lenp, ppos, HZ, 1000l);
2685} 2428}
2686 2429
@@ -2756,7 +2499,6 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2756 * proc_dointvec_jiffies - read a vector of integers as seconds 2499 * proc_dointvec_jiffies - read a vector of integers as seconds
2757 * @table: the sysctl table 2500 * @table: the sysctl table
2758 * @write: %TRUE if this is a write to the sysctl file 2501 * @write: %TRUE if this is a write to the sysctl file
2759 * @filp: the file structure
2760 * @buffer: the user buffer 2502 * @buffer: the user buffer
2761 * @lenp: the size of the user buffer 2503 * @lenp: the size of the user buffer
2762 * @ppos: file position 2504 * @ppos: file position
@@ -2768,10 +2510,10 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2768 * 2510 *
2769 * Returns 0 on success. 2511 * Returns 0 on success.
2770 */ 2512 */
2771int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, 2513int proc_dointvec_jiffies(struct ctl_table *table, int write,
2772 void __user *buffer, size_t *lenp, loff_t *ppos) 2514 void __user *buffer, size_t *lenp, loff_t *ppos)
2773{ 2515{
2774 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2516 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2775 do_proc_dointvec_jiffies_conv,NULL); 2517 do_proc_dointvec_jiffies_conv,NULL);
2776} 2518}
2777 2519
@@ -2779,7 +2521,6 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2779 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds 2521 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2780 * @table: the sysctl table 2522 * @table: the sysctl table
2781 * @write: %TRUE if this is a write to the sysctl file 2523 * @write: %TRUE if this is a write to the sysctl file
2782 * @filp: the file structure
2783 * @buffer: the user buffer 2524 * @buffer: the user buffer
2784 * @lenp: the size of the user buffer 2525 * @lenp: the size of the user buffer
2785 * @ppos: pointer to the file position 2526 * @ppos: pointer to the file position
@@ -2791,10 +2532,10 @@ int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2791 * 2532 *
2792 * Returns 0 on success. 2533 * Returns 0 on success.
2793 */ 2534 */
2794int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp, 2535int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2795 void __user *buffer, size_t *lenp, loff_t *ppos) 2536 void __user *buffer, size_t *lenp, loff_t *ppos)
2796{ 2537{
2797 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2538 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2798 do_proc_dointvec_userhz_jiffies_conv,NULL); 2539 do_proc_dointvec_userhz_jiffies_conv,NULL);
2799} 2540}
2800 2541
@@ -2802,7 +2543,6 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file
2802 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds 2543 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2803 * @table: the sysctl table 2544 * @table: the sysctl table
2804 * @write: %TRUE if this is a write to the sysctl file 2545 * @write: %TRUE if this is a write to the sysctl file
2805 * @filp: the file structure
2806 * @buffer: the user buffer 2546 * @buffer: the user buffer
2807 * @lenp: the size of the user buffer 2547 * @lenp: the size of the user buffer
2808 * @ppos: file position 2548 * @ppos: file position
@@ -2815,14 +2555,14 @@ int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file
2815 * 2555 *
2816 * Returns 0 on success. 2556 * Returns 0 on success.
2817 */ 2557 */
2818int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp, 2558int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2819 void __user *buffer, size_t *lenp, loff_t *ppos) 2559 void __user *buffer, size_t *lenp, loff_t *ppos)
2820{ 2560{
2821 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, 2561 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2822 do_proc_dointvec_ms_jiffies_conv, NULL); 2562 do_proc_dointvec_ms_jiffies_conv, NULL);
2823} 2563}
2824 2564
2825static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, 2565static int proc_do_cad_pid(struct ctl_table *table, int write,
2826 void __user *buffer, size_t *lenp, loff_t *ppos) 2566 void __user *buffer, size_t *lenp, loff_t *ppos)
2827{ 2567{
2828 struct pid *new_pid; 2568 struct pid *new_pid;
@@ -2831,7 +2571,7 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp
2831 2571
2832 tmp = pid_vnr(cad_pid); 2572 tmp = pid_vnr(cad_pid);
2833 2573
2834 r = __do_proc_dointvec(&tmp, table, write, filp, buffer, 2574 r = __do_proc_dointvec(&tmp, table, write, buffer,
2835 lenp, ppos, NULL, NULL); 2575 lenp, ppos, NULL, NULL);
2836 if (r || !write) 2576 if (r || !write)
2837 return r; 2577 return r;
@@ -2846,50 +2586,49 @@ static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp
2846 2586
2847#else /* CONFIG_PROC_FS */ 2587#else /* CONFIG_PROC_FS */
2848 2588
2849int proc_dostring(struct ctl_table *table, int write, struct file *filp, 2589int proc_dostring(struct ctl_table *table, int write,
2850 void __user *buffer, size_t *lenp, loff_t *ppos) 2590 void __user *buffer, size_t *lenp, loff_t *ppos)
2851{ 2591{
2852 return -ENOSYS; 2592 return -ENOSYS;
2853} 2593}
2854 2594
2855int proc_dointvec(struct ctl_table *table, int write, struct file *filp, 2595int proc_dointvec(struct ctl_table *table, int write,
2856 void __user *buffer, size_t *lenp, loff_t *ppos) 2596 void __user *buffer, size_t *lenp, loff_t *ppos)
2857{ 2597{
2858 return -ENOSYS; 2598 return -ENOSYS;
2859} 2599}
2860 2600
2861int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp, 2601int proc_dointvec_minmax(struct ctl_table *table, int write,
2862 void __user *buffer, size_t *lenp, loff_t *ppos) 2602 void __user *buffer, size_t *lenp, loff_t *ppos)
2863{ 2603{
2864 return -ENOSYS; 2604 return -ENOSYS;
2865} 2605}
2866 2606
2867int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp, 2607int proc_dointvec_jiffies(struct ctl_table *table, int write,
2868 void __user *buffer, size_t *lenp, loff_t *ppos) 2608 void __user *buffer, size_t *lenp, loff_t *ppos)
2869{ 2609{
2870 return -ENOSYS; 2610 return -ENOSYS;
2871} 2611}
2872 2612
2873int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp, 2613int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2874 void __user *buffer, size_t *lenp, loff_t *ppos) 2614 void __user *buffer, size_t *lenp, loff_t *ppos)
2875{ 2615{
2876 return -ENOSYS; 2616 return -ENOSYS;
2877} 2617}
2878 2618
2879int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp, 2619int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2880 void __user *buffer, size_t *lenp, loff_t *ppos) 2620 void __user *buffer, size_t *lenp, loff_t *ppos)
2881{ 2621{
2882 return -ENOSYS; 2622 return -ENOSYS;
2883} 2623}
2884 2624
2885int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp, 2625int proc_doulongvec_minmax(struct ctl_table *table, int write,
2886 void __user *buffer, size_t *lenp, loff_t *ppos) 2626 void __user *buffer, size_t *lenp, loff_t *ppos)
2887{ 2627{
2888 return -ENOSYS; 2628 return -ENOSYS;
2889} 2629}
2890 2630
2891int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, 2631int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2892 struct file *filp,
2893 void __user *buffer, 2632 void __user *buffer,
2894 size_t *lenp, loff_t *ppos) 2633 size_t *lenp, loff_t *ppos)
2895{ 2634{
@@ -2899,286 +2638,6 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2899 2638
2900#endif /* CONFIG_PROC_FS */ 2639#endif /* CONFIG_PROC_FS */
2901 2640
2902
2903#ifdef CONFIG_SYSCTL_SYSCALL
2904/*
2905 * General sysctl support routines
2906 */
2907
2908/* The generic sysctl data routine (used if no strategy routine supplied) */
2909int sysctl_data(struct ctl_table *table,
2910 void __user *oldval, size_t __user *oldlenp,
2911 void __user *newval, size_t newlen)
2912{
2913 size_t len;
2914
2915 /* Get out of I don't have a variable */
2916 if (!table->data || !table->maxlen)
2917 return -ENOTDIR;
2918
2919 if (oldval && oldlenp) {
2920 if (get_user(len, oldlenp))
2921 return -EFAULT;
2922 if (len) {
2923 if (len > table->maxlen)
2924 len = table->maxlen;
2925 if (copy_to_user(oldval, table->data, len))
2926 return -EFAULT;
2927 if (put_user(len, oldlenp))
2928 return -EFAULT;
2929 }
2930 }
2931
2932 if (newval && newlen) {
2933 if (newlen > table->maxlen)
2934 newlen = table->maxlen;
2935
2936 if (copy_from_user(table->data, newval, newlen))
2937 return -EFAULT;
2938 }
2939 return 1;
2940}
2941
2942/* The generic string strategy routine: */
2943int sysctl_string(struct ctl_table *table,
2944 void __user *oldval, size_t __user *oldlenp,
2945 void __user *newval, size_t newlen)
2946{
2947 if (!table->data || !table->maxlen)
2948 return -ENOTDIR;
2949
2950 if (oldval && oldlenp) {
2951 size_t bufsize;
2952 if (get_user(bufsize, oldlenp))
2953 return -EFAULT;
2954 if (bufsize) {
2955 size_t len = strlen(table->data), copied;
2956
2957 /* This shouldn't trigger for a well-formed sysctl */
2958 if (len > table->maxlen)
2959 len = table->maxlen;
2960
2961 /* Copy up to a max of bufsize-1 bytes of the string */
2962 copied = (len >= bufsize) ? bufsize - 1 : len;
2963
2964 if (copy_to_user(oldval, table->data, copied) ||
2965 put_user(0, (char __user *)(oldval + copied)))
2966 return -EFAULT;
2967 if (put_user(len, oldlenp))
2968 return -EFAULT;
2969 }
2970 }
2971 if (newval && newlen) {
2972 size_t len = newlen;
2973 if (len > table->maxlen)
2974 len = table->maxlen;
2975 if(copy_from_user(table->data, newval, len))
2976 return -EFAULT;
2977 if (len == table->maxlen)
2978 len--;
2979 ((char *) table->data)[len] = 0;
2980 }
2981 return 1;
2982}
2983
2984/*
2985 * This function makes sure that all of the integers in the vector
2986 * are between the minimum and maximum values given in the arrays
2987 * table->extra1 and table->extra2, respectively.
2988 */
2989int sysctl_intvec(struct ctl_table *table,
2990 void __user *oldval, size_t __user *oldlenp,
2991 void __user *newval, size_t newlen)
2992{
2993
2994 if (newval && newlen) {
2995 int __user *vec = (int __user *) newval;
2996 int *min = (int *) table->extra1;
2997 int *max = (int *) table->extra2;
2998 size_t length;
2999 int i;
3000
3001 if (newlen % sizeof(int) != 0)
3002 return -EINVAL;
3003
3004 if (!table->extra1 && !table->extra2)
3005 return 0;
3006
3007 if (newlen > table->maxlen)
3008 newlen = table->maxlen;
3009 length = newlen / sizeof(int);
3010
3011 for (i = 0; i < length; i++) {
3012 int value;
3013 if (get_user(value, vec + i))
3014 return -EFAULT;
3015 if (min && value < min[i])
3016 return -EINVAL;
3017 if (max && value > max[i])
3018 return -EINVAL;
3019 }
3020 }
3021 return 0;
3022}
3023
3024/* Strategy function to convert jiffies to seconds */
3025int sysctl_jiffies(struct ctl_table *table,
3026 void __user *oldval, size_t __user *oldlenp,
3027 void __user *newval, size_t newlen)
3028{
3029 if (oldval && oldlenp) {
3030 size_t olen;
3031
3032 if (get_user(olen, oldlenp))
3033 return -EFAULT;
3034 if (olen) {
3035 int val;
3036
3037 if (olen < sizeof(int))
3038 return -EINVAL;
3039
3040 val = *(int *)(table->data) / HZ;
3041 if (put_user(val, (int __user *)oldval))
3042 return -EFAULT;
3043 if (put_user(sizeof(int), oldlenp))
3044 return -EFAULT;
3045 }
3046 }
3047 if (newval && newlen) {
3048 int new;
3049 if (newlen != sizeof(int))
3050 return -EINVAL;
3051 if (get_user(new, (int __user *)newval))
3052 return -EFAULT;
3053 *(int *)(table->data) = new*HZ;
3054 }
3055 return 1;
3056}
3057
3058/* Strategy function to convert jiffies to seconds */
3059int sysctl_ms_jiffies(struct ctl_table *table,
3060 void __user *oldval, size_t __user *oldlenp,
3061 void __user *newval, size_t newlen)
3062{
3063 if (oldval && oldlenp) {
3064 size_t olen;
3065
3066 if (get_user(olen, oldlenp))
3067 return -EFAULT;
3068 if (olen) {
3069 int val;
3070
3071 if (olen < sizeof(int))
3072 return -EINVAL;
3073
3074 val = jiffies_to_msecs(*(int *)(table->data));
3075 if (put_user(val, (int __user *)oldval))
3076 return -EFAULT;
3077 if (put_user(sizeof(int), oldlenp))
3078 return -EFAULT;
3079 }
3080 }
3081 if (newval && newlen) {
3082 int new;
3083 if (newlen != sizeof(int))
3084 return -EINVAL;
3085 if (get_user(new, (int __user *)newval))
3086 return -EFAULT;
3087 *(int *)(table->data) = msecs_to_jiffies(new);
3088 }
3089 return 1;
3090}
3091
3092
3093
3094#else /* CONFIG_SYSCTL_SYSCALL */
3095
3096
3097SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
3098{
3099 struct __sysctl_args tmp;
3100 int error;
3101
3102 if (copy_from_user(&tmp, args, sizeof(tmp)))
3103 return -EFAULT;
3104
3105 error = deprecated_sysctl_warning(&tmp);
3106
3107 /* If no error reading the parameters then just -ENOSYS ... */
3108 if (!error)
3109 error = -ENOSYS;
3110
3111 return error;
3112}
3113
3114int sysctl_data(struct ctl_table *table,
3115 void __user *oldval, size_t __user *oldlenp,
3116 void __user *newval, size_t newlen)
3117{
3118 return -ENOSYS;
3119}
3120
3121int sysctl_string(struct ctl_table *table,
3122 void __user *oldval, size_t __user *oldlenp,
3123 void __user *newval, size_t newlen)
3124{
3125 return -ENOSYS;
3126}
3127
3128int sysctl_intvec(struct ctl_table *table,
3129 void __user *oldval, size_t __user *oldlenp,
3130 void __user *newval, size_t newlen)
3131{
3132 return -ENOSYS;
3133}
3134
3135int sysctl_jiffies(struct ctl_table *table,
3136 void __user *oldval, size_t __user *oldlenp,
3137 void __user *newval, size_t newlen)
3138{
3139 return -ENOSYS;
3140}
3141
3142int sysctl_ms_jiffies(struct ctl_table *table,
3143 void __user *oldval, size_t __user *oldlenp,
3144 void __user *newval, size_t newlen)
3145{
3146 return -ENOSYS;
3147}
3148
3149#endif /* CONFIG_SYSCTL_SYSCALL */
3150
3151static int deprecated_sysctl_warning(struct __sysctl_args *args)
3152{
3153 static int msg_count;
3154 int name[CTL_MAXNAME];
3155 int i;
3156
3157 /* Check args->nlen. */
3158 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
3159 return -ENOTDIR;
3160
3161 /* Read in the sysctl name for better debug message logging */
3162 for (i = 0; i < args->nlen; i++)
3163 if (get_user(name[i], args->name + i))
3164 return -EFAULT;
3165
3166 /* Ignore accesses to kernel.version */
3167 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
3168 return 0;
3169
3170 if (msg_count < 5) {
3171 msg_count++;
3172 printk(KERN_INFO
3173 "warning: process `%s' used the deprecated sysctl "
3174 "system call with ", current->comm);
3175 for (i = 0; i < args->nlen; i++)
3176 printk("%d.", name[i]);
3177 printk("\n");
3178 }
3179 return 0;
3180}
3181
3182/* 2641/*
3183 * No sense putting this after each symbol definition, twice, 2642 * No sense putting this after each symbol definition, twice,
3184 * exception granted :-) 2643 * exception granted :-)
@@ -3193,9 +2652,4 @@ EXPORT_SYMBOL(proc_doulongvec_minmax);
3193EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); 2652EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3194EXPORT_SYMBOL(register_sysctl_table); 2653EXPORT_SYMBOL(register_sysctl_table);
3195EXPORT_SYMBOL(register_sysctl_paths); 2654EXPORT_SYMBOL(register_sysctl_paths);
3196EXPORT_SYMBOL(sysctl_intvec);
3197EXPORT_SYMBOL(sysctl_jiffies);
3198EXPORT_SYMBOL(sysctl_ms_jiffies);
3199EXPORT_SYMBOL(sysctl_string);
3200EXPORT_SYMBOL(sysctl_data);
3201EXPORT_SYMBOL(unregister_sysctl_table); 2655EXPORT_SYMBOL(unregister_sysctl_table);