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