Blame view

kernel/sysctl.c 66.5 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  /*
   * sysctl.c: General linux system control interface
   *
   * Begun 24 March 1995, Stephen Tweedie
   * Added /proc support, Dec 1995
   * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
   * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
   * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
   * Dynamic registration fixes, Stephen Tweedie.
   * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
   * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
   *  Horn.
   * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
   * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
   * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
   *  Wendling.
   * The list_for_each() macro wasn't appropriate for the sysctl loop.
   *  Removed it and replaced it with older style, 03/23/00, Bill Wendling
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
  #include <linux/module.h>
e2e40f2c1   Christoph Hellwig   fs: move struct k...
21
  #include <linux/aio.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
24
25
  #include <linux/mm.h>
  #include <linux/swap.h>
  #include <linux/slab.h>
  #include <linux/sysctl.h>
5a04cca6c   Akinobu Mita   sysctl: use bitma...
26
  #include <linux/bitmap.h>
d33ed52d5   Dave Young   sysctl extern cle...
27
  #include <linux/signal.h>
455cd5ab3   Dan Rosenberg   kptr_restrict for...
28
  #include <linux/printk.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
  #include <linux/proc_fs.h>
72c2d5823   Andrew Morgan   V3 file capabilit...
30
  #include <linux/security.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  #include <linux/ctype.h>
dfec072ec   Vegard Nossum   kmemcheck: add th...
32
  #include <linux/kmemcheck.h>
fd4b616b0   Steven Rostedt   sysctl: suppress ...
33
  #include <linux/kmemleak.h>
62239ac2b   Adrian Bunk   proper prototype ...
34
  #include <linux/fs.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
36
  #include <linux/init.h>
  #include <linux/kernel.h>
0296b2281   Kay Sievers   [PATCH] remove CO...
37
  #include <linux/kobject.h>
20380731b   Arnaldo Carvalho de Melo   [NET]: Fix sparse...
38
  #include <linux/net.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
41
  #include <linux/sysrq.h>
  #include <linux/highuid.h>
  #include <linux/writeback.h>
3fff4c42b   Ingo Molnar   printk: Remove ra...
42
  #include <linux/ratelimit.h>
76ab0f530   Mel Gorman   mm: compaction: a...
43
  #include <linux/compaction.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
  #include <linux/hugetlb.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
  #include <linux/initrd.h>
0b77f5bfb   David Howells   keys: make the ke...
46
  #include <linux/key.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
  #include <linux/times.h>
  #include <linux/limits.h>
  #include <linux/dcache.h>
6e006701c   Alexey Dobriyan   dnotify: move dir...
50
  #include <linux/dnotify.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
  #include <linux/syscalls.h>
c748e1340   Adrian Bunk   mm/vmstat.c: prop...
52
  #include <linux/vmstat.h>
c255d844d   Pavel Machek   [PATCH] suspend-t...
53
54
  #include <linux/nfs_fs.h>
  #include <linux/acpi.h>
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
55
  #include <linux/reboot.h>
b0fc494fa   Steven Rostedt   ftrace: add ftrac...
56
  #include <linux/ftrace.h>
cdd6c482c   Ingo Molnar   perf: Do the big ...
57
  #include <linux/perf_event.h>
b2be84df9   Masami Hiramatsu   kprobes: Jump opt...
58
  #include <linux/kprobes.h>
b492e95be   Jens Axboe   pipe: set lower a...
59
  #include <linux/pipe_fs_i.h>
8e4228e1e   David Rientjes   oom: move sysctl ...
60
  #include <linux/oom.h>
17f60a7da   Eric Paris   capabilites: allo...
61
  #include <linux/kmod.h>
73efc0394   Dan Ballard   kernel/sysctl.c: ...
62
  #include <linux/capability.h>
404015308   Al Viro   security: trim se...
63
  #include <linux/binfmts.h>
cf4aebc29   Clark Williams   sched: Move sched...
64
  #include <linux/sched/sysctl.h>
7984754b9   Kees Cook   kexec: add sysctl...
65
  #include <linux/kexec.h>
1be7f75d1   Alexei Starovoitov   bpf: enable non-r...
66
  #include <linux/bpf.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
69
  
  #include <asm/uaccess.h>
  #include <asm/processor.h>
29cbc78b9   Andi Kleen   [PATCH] x86: Clea...
70
71
  #ifdef CONFIG_X86
  #include <asm/nmi.h>
0741f4d20   Chuck Ebbert   [PATCH] x86: add ...
72
  #include <asm/stacktrace.h>
6e7c40259   Ingo Molnar   x86: various chan...
73
  #include <asm/io.h>
29cbc78b9   Andi Kleen   [PATCH] x86: Clea...
74
  #endif
d550bbd40   David Howells   Disintegrate asm/...
75
76
77
  #ifdef CONFIG_SPARC
  #include <asm/setup.h>
  #endif
c55b7c3e8   Dave Young   sysctl extern cle...
78
79
80
  #ifdef CONFIG_BSD_PROCESS_ACCT
  #include <linux/acct.h>
  #endif
4f0e056fd   Dave Young   sysctl extern cle...
81
82
83
  #ifdef CONFIG_RT_MUTEXES
  #include <linux/rtmutex.h>
  #endif
2edf5e498   Dave Young   sysctl extern cle...
84
85
86
  #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
  #include <linux/lockdep.h>
  #endif
15485a468   Dave Young   sysctl extern cle...
87
88
89
  #ifdef CONFIG_CHR_DEV_SG
  #include <scsi/sg.h>
  #endif
29cbc78b9   Andi Kleen   [PATCH] x86: Clea...
90

58687acba   Don Zickus   lockup_detector: ...
91
  #ifdef CONFIG_LOCKUP_DETECTOR
504d7cf10   Don Zickus   nmi_watchdog: Com...
92
93
  #include <linux/nmi.h>
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
95
96
  #if defined(CONFIG_SYSCTL)
  
  /* External variables not in a header file. */
d6e711448   Alan Cox   [PATCH] setuid co...
97
  extern int suid_dumpable;
046d662f4   Alex Kelly   coredump: make co...
98
99
  #ifdef CONFIG_COREDUMP
  extern int core_uses_pid;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
100
  extern char core_pattern[];
a293980c2   Neil Horman   exec: let do_core...
101
  extern unsigned int core_pipe_limit;
046d662f4   Alex Kelly   coredump: make co...
102
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
103
  extern int pid_max;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
  extern int pid_max_min, pid_max_max;
8ad4b1fb8   Rohit Seth   [PATCH] Make high...
105
  extern int percpu_pagelist_fraction;
bebfa1013   Andi Kleen   [PATCH] x86_64: A...
106
  extern int compat_log;
9745512ce   Arjan van de Ven   sched: latencytop...
107
  extern int latencytop_enabled;
eceea0b3d   Al Viro   [PATCH] avoid mul...
108
  extern int sysctl_nr_open_min, sysctl_nr_open_max;
dd8632a12   Paul Mundt   NOMMU: Make mmap ...
109
110
111
  #ifndef CONFIG_MMU
  extern int sysctl_nr_trim_pages;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112

c4f3b63fe   Ravikiran G Thirumalai   softlockup: add a...
113
  /* Constants used for minimum and  maximum */
2508ce184   Don Zickus   lockup_detector: ...
114
  #ifdef CONFIG_LOCKUP_DETECTOR
c4f3b63fe   Ravikiran G Thirumalai   softlockup: add a...
115
116
  static int sixty = 60;
  #endif
270750dbc   Aaron Tomlin   hung_task: Displa...
117
  static int __maybe_unused neg_one = -1;
c4f3b63fe   Ravikiran G Thirumalai   softlockup: add a...
118
  static int zero;
cd5f9a4c3   Linus Torvalds   kernel/sysctl.c: ...
119
120
  static int __maybe_unused one = 1;
  static int __maybe_unused two = 2;
5509a5d27   Dave Hansen   drop_caches: add ...
121
  static int __maybe_unused four = 4;
fc3501d41   Sven Wegener   mm: fix dirty_byt...
122
  static unsigned long one_ul = 1;
c4f3b63fe   Ravikiran G Thirumalai   softlockup: add a...
123
  static int one_hundred = 100;
795ae7a0d   Johannes Weiner   mm: scale kswapd ...
124
  static int one_thousand = 1000;
af91322ef   Dave Young   printk: add print...
125
126
127
  #ifdef CONFIG_PRINTK
  static int ten_thousand = 10000;
  #endif
c5dfd78eb   Arnaldo Carvalho de Melo   perf core: Allow ...
128
129
130
  #ifdef CONFIG_PERF_EVENTS
  static int six_hundred_forty_kb = 640 * 1024;
  #endif
c4f3b63fe   Ravikiran G Thirumalai   softlockup: add a...
131

9e4a5bda8   Andrea Righi   mm: prevent divid...
132
133
  /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
  static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
134
135
136
137
138
  /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
  static int maxolduid = 65535;
  static int minolduid;
  
  static int ngroups_max = NGROUPS_MAX;
73efc0394   Dan Ballard   kernel/sysctl.c: ...
139
  static const int cap_last_cap = CAP_LAST_CAP;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140

80df28476   Liu Hua   hung_task: check ...
141
142
143
144
  /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
  #ifdef CONFIG_DETECT_HUNG_TASK
  static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
  #endif
d14f17294   Dave Young   sysctl extern cle...
145
146
147
  #ifdef CONFIG_INOTIFY_USER
  #include <linux/inotify.h>
  #endif
72c57ed50   David S. Miller   sysctl: Use CONFI...
148
  #ifdef CONFIG_SPARC
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
149
150
151
152
  #endif
  
  #ifdef __hppa__
  extern int pwrsw_enabled;
bf14e3b97   Vineet Gupta   sysctl: Enable PA...
153
154
155
  #endif
  
  #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
157
  extern int unaligned_enabled;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
158

d2b176ed8   Jes Sorensen   [IA64] sysctl opt...
159
  #ifdef CONFIG_IA64
88fc241f5   Doug Chapman   [IA64] dump stack...
160
  extern int unaligned_dump_stack;
d2b176ed8   Jes Sorensen   [IA64] sysctl opt...
161
  #endif
b6fca7253   Vineet Gupta   sysctl: Enable IA...
162
163
164
  #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
  extern int no_unaligned_warning;
  #endif
d6f8ff738   Randy Dunlap   [PATCH] cad_pid s...
165
  #ifdef CONFIG_PROC_SYSCTL
f4aacea2f   Kees Cook   sysctl: allow for...
166
167
168
169
  
  #define SYSCTL_WRITES_LEGACY	-1
  #define SYSCTL_WRITES_WARN	 0
  #define SYSCTL_WRITES_STRICT	 1
41662f5cc   Kees Cook   sysctl: enable st...
170
  static int sysctl_writes_strict = SYSCTL_WRITES_STRICT;
f4aacea2f   Kees Cook   sysctl: allow for...
171

8d65af789   Alexey Dobriyan   sysctl: remove "s...
172
  static int proc_do_cad_pid(struct ctl_table *table, int write,
9ec52099e   Cedric Le Goater   [PATCH] replace c...
173
  		  void __user *buffer, size_t *lenp, loff_t *ppos);
8d65af789   Alexey Dobriyan   sysctl: remove "s...
174
  static int proc_taint(struct ctl_table *table, int write,
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
175
  			       void __user *buffer, size_t *lenp, loff_t *ppos);
d6f8ff738   Randy Dunlap   [PATCH] cad_pid s...
176
  #endif
9ec52099e   Cedric Le Goater   [PATCH] replace c...
177

bfdc0b497   Richard Weinberger   sysctl: restrict ...
178
  #ifdef CONFIG_PRINTK
620f6e8e8   Kees Cook   sysctl: fix write...
179
  static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
bfdc0b497   Richard Weinberger   sysctl: restrict ...
180
181
  				void __user *buffer, size_t *lenp, loff_t *ppos);
  #endif
54b501992   Kees Cook   coredump: warn ab...
182
183
  static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
  		void __user *buffer, size_t *lenp, loff_t *ppos);
046d662f4   Alex Kelly   coredump: make co...
184
  #ifdef CONFIG_COREDUMP
54b501992   Kees Cook   coredump: warn ab...
185
186
  static int proc_dostring_coredump(struct ctl_table *table, int write,
  		void __user *buffer, size_t *lenp, loff_t *ppos);
046d662f4   Alex Kelly   coredump: make co...
187
  #endif
54b501992   Kees Cook   coredump: warn ab...
188

97f5f0cd8   Dmitry Torokhov   Input: implement ...
189
  #ifdef CONFIG_MAGIC_SYSRQ
8c6a98b22   Andy Whitcroft   Input: sysrq - en...
190
  /* Note: sysrq code uses it's own private copy */
8eaede49d   Ben Hutchings   sysrq: Allow magi...
191
  static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
97f5f0cd8   Dmitry Torokhov   Input: implement ...
192

6f8fd1d77   Joe Perches   sysctl: convert u...
193
  static int sysrq_sysctl_handler(struct ctl_table *table, int write,
97f5f0cd8   Dmitry Torokhov   Input: implement ...
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
  				void __user *buffer, size_t *lenp,
  				loff_t *ppos)
  {
  	int error;
  
  	error = proc_dointvec(table, write, buffer, lenp, ppos);
  	if (error)
  		return error;
  
  	if (write)
  		sysrq_toggle_support(__sysrq_enabled);
  
  	return 0;
  }
  
  #endif
d8217f076   Eric W. Biederman   sysctl core: Stop...
210
211
212
213
214
215
  static struct ctl_table kern_table[];
  static struct ctl_table vm_table[];
  static struct ctl_table fs_table[];
  static struct ctl_table debug_table[];
  static struct ctl_table dev_table[];
  extern struct ctl_table random_table[];
7ef9964e6   Davide Libenzi   epoll: introduce ...
216
217
218
  #ifdef CONFIG_EPOLL
  extern struct ctl_table epoll_table[];
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
219
220
221
222
  
  #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  int sysctl_legacy_va_layout;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
223
  /* The default sysctl tables: */
de4e83bd6   Eric W. Biederman   sysctl: Register ...
224
  static struct ctl_table sysctl_base_table[] = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
225
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
226
227
228
229
230
  		.procname	= "kernel",
  		.mode		= 0555,
  		.child		= kern_table,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
231
232
233
234
  		.procname	= "vm",
  		.mode		= 0555,
  		.child		= vm_table,
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
235
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
236
237
238
239
240
  		.procname	= "fs",
  		.mode		= 0555,
  		.child		= fs_table,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
241
242
243
244
245
  		.procname	= "debug",
  		.mode		= 0555,
  		.child		= debug_table,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
246
247
248
249
  		.procname	= "dev",
  		.mode		= 0555,
  		.child		= dev_table,
  	},
6fce56ec9   Eric W. Biederman   sysctl: Remove re...
250
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
251
  };
77e54a1f8   Ingo Molnar   sched: add CFS de...
252
  #ifdef CONFIG_SCHED_DEBUG
73c4efd2c   Eric Dumazet   sched: sysctl, pr...
253
254
255
256
  static int min_sched_granularity_ns = 100000;		/* 100 usecs */
  static int max_sched_granularity_ns = NSEC_PER_SEC;	/* 1 second */
  static int min_wakeup_granularity_ns;			/* 0 usecs */
  static int max_wakeup_granularity_ns = NSEC_PER_SEC;	/* 1 second */
cbee9f88e   Peter Zijlstra   mm: numa: Add fau...
257
  #ifdef CONFIG_SMP
1983a922a   Christian Ehrhardt   sched: Make tunab...
258
259
  static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
  static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
cbee9f88e   Peter Zijlstra   mm: numa: Add fau...
260
261
  #endif /* CONFIG_SMP */
  #endif /* CONFIG_SCHED_DEBUG */
77e54a1f8   Ingo Molnar   sched: add CFS de...
262

5e7719058   Mel Gorman   mm: compaction: a...
263
264
265
266
  #ifdef CONFIG_COMPACTION
  static int min_extfrag_threshold;
  static int max_extfrag_threshold = 1000;
  #endif
d8217f076   Eric W. Biederman   sysctl core: Stop...
267
  static struct ctl_table kern_table[] = {
2bba22c50   Mike Galbraith   sched: Turn off c...
268
  	{
2bba22c50   Mike Galbraith   sched: Turn off c...
269
270
271
272
  		.procname	= "sched_child_runs_first",
  		.data		= &sysctl_sched_child_runs_first,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
273
  		.proc_handler	= proc_dointvec,
2bba22c50   Mike Galbraith   sched: Turn off c...
274
  	},
77e54a1f8   Ingo Molnar   sched: add CFS de...
275
276
  #ifdef CONFIG_SCHED_DEBUG
  	{
b2be5e96d   Peter Zijlstra   sched: reintroduc...
277
278
  		.procname	= "sched_min_granularity_ns",
  		.data		= &sysctl_sched_min_granularity,
77e54a1f8   Ingo Molnar   sched: add CFS de...
279
280
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
702a7c760   Linus Torvalds   Merge branch 'sch...
281
  		.proc_handler	= sched_proc_update_handler,
b2be5e96d   Peter Zijlstra   sched: reintroduc...
282
283
  		.extra1		= &min_sched_granularity_ns,
  		.extra2		= &max_sched_granularity_ns,
77e54a1f8   Ingo Molnar   sched: add CFS de...
284
285
  	},
  	{
218050855   Peter Zijlstra   sched: adaptive s...
286
287
288
289
  		.procname	= "sched_latency_ns",
  		.data		= &sysctl_sched_latency,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
702a7c760   Linus Torvalds   Merge branch 'sch...
290
  		.proc_handler	= sched_proc_update_handler,
218050855   Peter Zijlstra   sched: adaptive s...
291
292
293
294
  		.extra1		= &min_sched_granularity_ns,
  		.extra2		= &max_sched_granularity_ns,
  	},
  	{
77e54a1f8   Ingo Molnar   sched: add CFS de...
295
296
297
298
  		.procname	= "sched_wakeup_granularity_ns",
  		.data		= &sysctl_sched_wakeup_granularity,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
702a7c760   Linus Torvalds   Merge branch 'sch...
299
  		.proc_handler	= sched_proc_update_handler,
77e54a1f8   Ingo Molnar   sched: add CFS de...
300
301
302
  		.extra1		= &min_wakeup_granularity_ns,
  		.extra2		= &max_wakeup_granularity_ns,
  	},
cbee9f88e   Peter Zijlstra   mm: numa: Add fau...
303
  #ifdef CONFIG_SMP
77e54a1f8   Ingo Molnar   sched: add CFS de...
304
  	{
1983a922a   Christian Ehrhardt   sched: Make tunab...
305
306
307
308
  		.procname	= "sched_tunable_scaling",
  		.data		= &sysctl_sched_tunable_scaling,
  		.maxlen		= sizeof(enum sched_tunable_scaling),
  		.mode		= 0644,
702a7c760   Linus Torvalds   Merge branch 'sch...
309
  		.proc_handler	= sched_proc_update_handler,
1983a922a   Christian Ehrhardt   sched: Make tunab...
310
311
  		.extra1		= &min_sched_tunable_scaling,
  		.extra2		= &max_sched_tunable_scaling,
2398f2c6d   Peter Zijlstra   sched: update sha...
312
313
  	},
  	{
d00535db4   Namhyung Kim   sched: Add time u...
314
  		.procname	= "sched_migration_cost_ns",
da84d9617   Ingo Molnar   sched: reintroduc...
315
316
317
  		.data		= &sysctl_sched_migration_cost,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
318
  		.proc_handler	= proc_dointvec,
da84d9617   Ingo Molnar   sched: reintroduc...
319
  	},
b82d9fdd8   Peter Zijlstra   sched: avoid larg...
320
  	{
b82d9fdd8   Peter Zijlstra   sched: avoid larg...
321
322
323
  		.procname	= "sched_nr_migrate",
  		.data		= &sysctl_sched_nr_migrate,
  		.maxlen		= sizeof(unsigned int),
fa85ae241   Peter Zijlstra   sched: rt time limit
324
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
325
  		.proc_handler	= proc_dointvec,
fa85ae241   Peter Zijlstra   sched: rt time limit
326
  	},
cd1bb94b4   Arun R Bharadwaj   timers: /proc/sys...
327
  	{
d00535db4   Namhyung Kim   sched: Add time u...
328
  		.procname	= "sched_time_avg_ms",
e9e9250bc   Peter Zijlstra   sched: Scale down...
329
330
331
  		.data		= &sysctl_sched_time_avg,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
332
  		.proc_handler	= proc_dointvec,
e9e9250bc   Peter Zijlstra   sched: Scale down...
333
334
  	},
  	{
d00535db4   Namhyung Kim   sched: Add time u...
335
  		.procname	= "sched_shares_window_ns",
a7a4f8a75   Paul Turner   sched: Add sysctl...
336
337
338
339
340
  		.data		= &sysctl_sched_shares_window,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
cb2517653   Mel Gorman   sched/debug: Make...
341
342
343
344
345
346
347
348
349
350
351
  #ifdef CONFIG_SCHEDSTATS
  	{
  		.procname	= "sched_schedstats",
  		.data		= NULL,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= sysctl_schedstats,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif /* CONFIG_SCHEDSTATS */
cbee9f88e   Peter Zijlstra   mm: numa: Add fau...
352
353
354
  #endif /* CONFIG_SMP */
  #ifdef CONFIG_NUMA_BALANCING
  	{
4b96a29ba   Peter Zijlstra   mm: sched: numa: ...
355
356
357
358
359
360
361
  		.procname	= "numa_balancing_scan_delay_ms",
  		.data		= &sysctl_numa_balancing_scan_delay,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
  	{
cbee9f88e   Peter Zijlstra   mm: numa: Add fau...
362
363
364
365
366
367
368
369
370
371
372
373
374
  		.procname	= "numa_balancing_scan_period_min_ms",
  		.data		= &sysctl_numa_balancing_scan_period_min,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
  	{
  		.procname	= "numa_balancing_scan_period_max_ms",
  		.data		= &sysctl_numa_balancing_scan_period_max,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
6e5fb223e   Peter Zijlstra   mm: sched: numa: ...
375
376
377
378
379
  	{
  		.procname	= "numa_balancing_scan_size_mb",
  		.data		= &sysctl_numa_balancing_scan_size,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
641926589   Kirill Tkhai   sched/fair: Fix d...
380
381
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &one,
6e5fb223e   Peter Zijlstra   mm: sched: numa: ...
382
  	},
3a7053b32   Mel Gorman   sched/numa: Favou...
383
  	{
54a43d549   Andi Kleen   numa: add a sysct...
384
385
386
387
388
389
390
391
  		.procname	= "numa_balancing",
  		.data		= NULL, /* filled in by handler */
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= sysctl_numa_balancing,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
cbee9f88e   Peter Zijlstra   mm: numa: Add fau...
392
393
  #endif /* CONFIG_NUMA_BALANCING */
  #endif /* CONFIG_SCHED_DEBUG */
1799e35d5   Ingo Molnar   sched: add /proc/...
394
  	{
9f0c1e560   Peter Zijlstra   sched: rt-group: ...
395
396
397
398
  		.procname	= "sched_rt_period_us",
  		.data		= &sysctl_sched_rt_period,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
399
  		.proc_handler	= sched_rt_handler,
9f0c1e560   Peter Zijlstra   sched: rt-group: ...
400
401
  	},
  	{
9f0c1e560   Peter Zijlstra   sched: rt-group: ...
402
403
404
405
  		.procname	= "sched_rt_runtime_us",
  		.data		= &sysctl_sched_rt_runtime,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
406
  		.proc_handler	= sched_rt_handler,
9f0c1e560   Peter Zijlstra   sched: rt-group: ...
407
  	},
ce0dbbbb3   Clark Williams   sched/rt: Add a t...
408
409
410
411
412
413
414
  	{
  		.procname	= "sched_rr_timeslice_ms",
  		.data		= &sched_rr_timeslice,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= sched_rr_handler,
  	},
5091faa44   Mike Galbraith   sched: Add 'autog...
415
416
417
418
419
420
  #ifdef CONFIG_SCHED_AUTOGROUP
  	{
  		.procname	= "sched_autogroup_enabled",
  		.data		= &sysctl_sched_autogroup_enabled,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
1747b21fe   Yong Zhang   sched, autogroup,...
421
  		.proc_handler	= proc_dointvec_minmax,
5091faa44   Mike Galbraith   sched: Add 'autog...
422
423
424
425
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif
ec12cb7f3   Paul Turner   sched: Accumulate...
426
427
428
429
430
431
432
433
434
435
  #ifdef CONFIG_CFS_BANDWIDTH
  	{
  		.procname	= "sched_cfs_bandwidth_slice_us",
  		.data		= &sysctl_sched_cfs_bandwidth_slice,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &one,
  	},
  #endif
f20786ff4   Peter Zijlstra   lockstat: core in...
436
437
  #ifdef CONFIG_PROVE_LOCKING
  	{
f20786ff4   Peter Zijlstra   lockstat: core in...
438
439
440
441
  		.procname	= "prove_locking",
  		.data		= &prove_locking,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
442
  		.proc_handler	= proc_dointvec,
f20786ff4   Peter Zijlstra   lockstat: core in...
443
444
445
446
  	},
  #endif
  #ifdef CONFIG_LOCK_STAT
  	{
f20786ff4   Peter Zijlstra   lockstat: core in...
447
448
449
450
  		.procname	= "lock_stat",
  		.data		= &lock_stat,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
451
  		.proc_handler	= proc_dointvec,
f20786ff4   Peter Zijlstra   lockstat: core in...
452
453
  	},
  #endif
77e54a1f8   Ingo Molnar   sched: add CFS de...
454
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
455
456
457
458
  		.procname	= "panic",
  		.data		= &panic_timeout,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
459
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
460
  	},
046d662f4   Alex Kelly   coredump: make co...
461
  #ifdef CONFIG_COREDUMP
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
462
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
463
464
465
466
  		.procname	= "core_uses_pid",
  		.data		= &core_uses_pid,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
467
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
468
469
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
470
471
  		.procname	= "core_pattern",
  		.data		= core_pattern,
71ce92f3f   Dan Aloni   make sysctl/kerne...
472
  		.maxlen		= CORENAME_MAX_SIZE,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
473
  		.mode		= 0644,
54b501992   Kees Cook   coredump: warn ab...
474
  		.proc_handler	= proc_dostring_coredump,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
475
  	},
a293980c2   Neil Horman   exec: let do_core...
476
  	{
a293980c2   Neil Horman   exec: let do_core...
477
478
479
480
  		.procname	= "core_pipe_limit",
  		.data		= &core_pipe_limit,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
481
  		.proc_handler	= proc_dointvec,
a293980c2   Neil Horman   exec: let do_core...
482
  	},
046d662f4   Alex Kelly   coredump: make co...
483
  #endif
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
484
  #ifdef CONFIG_PROC_SYSCTL
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
485
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
486
  		.procname	= "tainted",
25ddbb18a   Andi Kleen   Make the taint fl...
487
  		.maxlen 	= sizeof(long),
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
488
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
489
  		.proc_handler	= proc_taint,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
490
  	},
f4aacea2f   Kees Cook   sysctl: allow for...
491
492
493
494
495
496
497
498
499
  	{
  		.procname	= "sysctl_writes_strict",
  		.data		= &sysctl_writes_strict,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &neg_one,
  		.extra2		= &one,
  	},
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
500
  #endif
9745512ce   Arjan van de Ven   sched: latencytop...
501
502
503
504
505
506
  #ifdef CONFIG_LATENCYTOP
  	{
  		.procname	= "latencytop",
  		.data		= &latencytop_enabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
cb2517653   Mel Gorman   sched/debug: Make...
507
  		.proc_handler	= sysctl_latencytop,
9745512ce   Arjan van de Ven   sched: latencytop...
508
509
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
510
511
  #ifdef CONFIG_BLK_DEV_INITRD
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
512
513
514
515
  		.procname	= "real-root-dev",
  		.data		= &real_root_dev,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
516
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
517
518
  	},
  #endif
45807a1df   Ingo Molnar   vdso: print fatal...
519
  	{
45807a1df   Ingo Molnar   vdso: print fatal...
520
521
522
523
  		.procname	= "print-fatal-signals",
  		.data		= &print_fatal_signals,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
524
  		.proc_handler	= proc_dointvec,
45807a1df   Ingo Molnar   vdso: print fatal...
525
  	},
72c57ed50   David S. Miller   sysctl: Use CONFI...
526
  #ifdef CONFIG_SPARC
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
527
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
528
529
530
531
  		.procname	= "reboot-cmd",
  		.data		= reboot_command,
  		.maxlen		= 256,
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
532
  		.proc_handler	= proc_dostring,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
533
534
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
535
536
537
538
  		.procname	= "stop-a",
  		.data		= &stop_a_enabled,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
539
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
540
541
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
542
543
544
545
  		.procname	= "scons-poweroff",
  		.data		= &scons_pwroff,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
546
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
547
548
  	},
  #endif
0871420fa   David S. Miller   sparc64: Add tsb-...
549
550
  #ifdef CONFIG_SPARC64
  	{
0871420fa   David S. Miller   sparc64: Add tsb-...
551
552
553
554
  		.procname	= "tsb-ratio",
  		.data		= &sysctl_tsb_ratio,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
555
  		.proc_handler	= proc_dointvec,
0871420fa   David S. Miller   sparc64: Add tsb-...
556
557
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
558
559
  #ifdef __hppa__
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
560
561
562
563
  		.procname	= "soft-power",
  		.data		= &pwrsw_enabled,
  		.maxlen		= sizeof (int),
  	 	.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
564
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
565
  	},
bf14e3b97   Vineet Gupta   sysctl: Enable PA...
566
567
  #endif
  #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
568
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
569
570
571
572
  		.procname	= "unaligned-trap",
  		.data		= &unaligned_enabled,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
573
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
574
575
576
  	},
  #endif
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
577
578
579
580
  		.procname	= "ctrl-alt-del",
  		.data		= &C_A_D,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
581
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
582
  	},
606576ce8   Steven Rostedt   ftrace: rename FT...
583
  #ifdef CONFIG_FUNCTION_TRACER
b0fc494fa   Steven Rostedt   ftrace: add ftrac...
584
  	{
b0fc494fa   Steven Rostedt   ftrace: add ftrac...
585
586
587
588
  		.procname	= "ftrace_enabled",
  		.data		= &ftrace_enabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
589
  		.proc_handler	= ftrace_enable_sysctl,
b0fc494fa   Steven Rostedt   ftrace: add ftrac...
590
591
  	},
  #endif
f38f1d2aa   Steven Rostedt   trace: add a way ...
592
593
  #ifdef CONFIG_STACK_TRACER
  	{
f38f1d2aa   Steven Rostedt   trace: add a way ...
594
595
596
597
  		.procname	= "stack_tracer_enabled",
  		.data		= &stack_tracer_enabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
598
  		.proc_handler	= stack_trace_sysctl,
f38f1d2aa   Steven Rostedt   trace: add a way ...
599
600
  	},
  #endif
944ac4259   Steven Rostedt   ftrace: ftrace du...
601
602
  #ifdef CONFIG_TRACING
  	{
3299b4dd1   Peter Zijlstra   ftrace: sysctl typo
603
  		.procname	= "ftrace_dump_on_oops",
944ac4259   Steven Rostedt   ftrace: ftrace du...
604
605
606
  		.data		= &ftrace_dump_on_oops,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
607
  		.proc_handler	= proc_dointvec,
944ac4259   Steven Rostedt   ftrace: ftrace du...
608
  	},
de7edd314   Steven Rostedt (Red Hat)   tracing: Disable ...
609
610
611
612
613
614
615
  	{
  		.procname	= "traceoff_on_warning",
  		.data		= &__disable_trace_on_warning,
  		.maxlen		= sizeof(__disable_trace_on_warning),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
0daa23029   Steven Rostedt (Red Hat)   tracing: Add tp_p...
616
617
618
619
620
621
622
  	{
  		.procname	= "tracepoint_printk",
  		.data		= &tracepoint_printk,
  		.maxlen		= sizeof(tracepoint_printk),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
944ac4259   Steven Rostedt   ftrace: ftrace du...
623
  #endif
2965faa5e   Dave Young   kexec: split kexe...
624
  #ifdef CONFIG_KEXEC_CORE
7984754b9   Kees Cook   kexec: add sysctl...
625
626
627
628
629
630
631
632
633
634
635
  	{
  		.procname	= "kexec_load_disabled",
  		.data		= &kexec_load_disabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		/* only handle a transition from default "0" to "1" */
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &one,
  		.extra2		= &one,
  	},
  #endif
a1ef5adb4   Johannes Berg   remove CONFIG_KMO...
636
  #ifdef CONFIG_MODULES
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
637
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
638
639
640
641
  		.procname	= "modprobe",
  		.data		= &modprobe_path,
  		.maxlen		= KMOD_PATH_LEN,
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
642
  		.proc_handler	= proc_dostring,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
643
  	},
3d43321b7   Kees Cook   modules: sysctl t...
644
  	{
3d43321b7   Kees Cook   modules: sysctl t...
645
646
647
648
649
  		.procname	= "modules_disabled",
  		.data		= &modules_disabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		/* only handle a transition from default "0" to "1" */
6d4561110   Eric W. Biederman   sysctl: Drop & in...
650
  		.proc_handler	= proc_dointvec_minmax,
3d43321b7   Kees Cook   modules: sysctl t...
651
652
653
  		.extra1		= &one,
  		.extra2		= &one,
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
654
  #endif
86d56134f   Michael Marineau   kobject: Make sup...
655
  #ifdef CONFIG_UEVENT_HELPER
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
656
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
657
  		.procname	= "hotplug",
312c004d3   Kay Sievers   [PATCH] driver co...
658
659
  		.data		= &uevent_helper,
  		.maxlen		= UEVENT_HELPER_PATH_LEN,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
660
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
661
  		.proc_handler	= proc_dostring,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
662
  	},
86d56134f   Michael Marineau   kobject: Make sup...
663
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
664
665
  #ifdef CONFIG_CHR_DEV_SG
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
666
667
668
669
  		.procname	= "sg-big-buff",
  		.data		= &sg_big_buff,
  		.maxlen		= sizeof (int),
  		.mode		= 0444,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
670
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
671
672
673
674
  	},
  #endif
  #ifdef CONFIG_BSD_PROCESS_ACCT
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
675
676
677
678
  		.procname	= "acct",
  		.data		= &acct_parm,
  		.maxlen		= 3*sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
679
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
680
681
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
682
683
  #ifdef CONFIG_MAGIC_SYSRQ
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
684
  		.procname	= "sysrq",
5d6f647fc   Ingo Molnar   [PATCH] debug: ad...
685
  		.data		= &__sysrq_enabled,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
686
687
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
97f5f0cd8   Dmitry Torokhov   Input: implement ...
688
  		.proc_handler	= sysrq_sysctl_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
689
690
  	},
  #endif
d6f8ff738   Randy Dunlap   [PATCH] cad_pid s...
691
  #ifdef CONFIG_PROC_SYSCTL
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
692
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
693
  		.procname	= "cad_pid",
9ec52099e   Cedric Le Goater   [PATCH] replace c...
694
  		.data		= NULL,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
695
696
  		.maxlen		= sizeof (int),
  		.mode		= 0600,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
697
  		.proc_handler	= proc_do_cad_pid,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
698
  	},
d6f8ff738   Randy Dunlap   [PATCH] cad_pid s...
699
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
700
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
701
  		.procname	= "threads-max",
16db3d3f1   Heinrich Schuchardt   kernel/sysctl.c: ...
702
  		.data		= NULL,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
703
704
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
16db3d3f1   Heinrich Schuchardt   kernel/sysctl.c: ...
705
  		.proc_handler	= sysctl_max_threads,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
706
707
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
708
709
710
711
  		.procname	= "random",
  		.mode		= 0555,
  		.child		= random_table,
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
712
  	{
17f60a7da   Eric Paris   capabilites: allo...
713
714
715
716
717
  		.procname	= "usermodehelper",
  		.mode		= 0555,
  		.child		= usermodehelper_table,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
718
719
720
721
  		.procname	= "overflowuid",
  		.data		= &overflowuid,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
722
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
723
724
725
726
  		.extra1		= &minolduid,
  		.extra2		= &maxolduid,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
727
728
729
730
  		.procname	= "overflowgid",
  		.data		= &overflowgid,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
731
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
732
733
734
  		.extra1		= &minolduid,
  		.extra2		= &maxolduid,
  	},
347a8dc3b   Martin Schwidefsky   [PATCH] s390: cle...
735
  #ifdef CONFIG_S390
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
736
737
  #ifdef CONFIG_MATHEMU
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
738
739
740
741
  		.procname	= "ieee_emulation_warnings",
  		.data		= &sysctl_ieee_emulation_warnings,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
742
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
743
744
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
745
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
746
  		.procname	= "userprocess_debug",
ab3c68ee5   Heiko Carstens   [S390] debug: ena...
747
  		.data		= &show_unhandled_signals,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
748
749
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
750
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
751
752
753
  	},
  #endif
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
754
755
756
757
  		.procname	= "pid_max",
  		.data		= &pid_max,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
758
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
759
760
761
762
  		.extra1		= &pid_max_min,
  		.extra2		= &pid_max_max,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
763
764
765
766
  		.procname	= "panic_on_oops",
  		.data		= &panic_on_oops,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
767
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
768
  	},
7ef3d2fd1   Joe Perches   printk_ratelimit(...
769
770
  #if defined CONFIG_PRINTK
  	{
7ef3d2fd1   Joe Perches   printk_ratelimit(...
771
772
773
774
  		.procname	= "printk",
  		.data		= &console_loglevel,
  		.maxlen		= 4*sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
775
  		.proc_handler	= proc_dointvec,
7ef3d2fd1   Joe Perches   printk_ratelimit(...
776
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
777
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
778
  		.procname	= "printk_ratelimit",
717115e1a   Dave Young   printk ratelimiti...
779
  		.data		= &printk_ratelimit_state.interval,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
780
781
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
782
  		.proc_handler	= proc_dointvec_jiffies,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
783
784
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
785
  		.procname	= "printk_ratelimit_burst",
717115e1a   Dave Young   printk ratelimiti...
786
  		.data		= &printk_ratelimit_state.burst,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
787
788
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
789
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
790
  	},
af91322ef   Dave Young   printk: add print...
791
  	{
af91322ef   Dave Young   printk: add print...
792
793
794
795
  		.procname	= "printk_delay",
  		.data		= &printk_delay_msec,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
796
  		.proc_handler	= proc_dointvec_minmax,
af91322ef   Dave Young   printk: add print...
797
798
799
  		.extra1		= &zero,
  		.extra2		= &ten_thousand,
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
800
  	{
750afe7ba   Borislav Petkov   printk: add kerne...
801
802
803
804
805
806
807
  		.procname	= "printk_devkmsg",
  		.data		= devkmsg_log_str,
  		.maxlen		= DEVKMSG_STR_MAX_SIZE,
  		.mode		= 0644,
  		.proc_handler	= devkmsg_sysctl_set_loglvl,
  	},
  	{
eaf06b241   Dan Rosenberg   Restrict unprivil...
808
809
810
811
  		.procname	= "dmesg_restrict",
  		.data		= &dmesg_restrict,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
620f6e8e8   Kees Cook   sysctl: fix write...
812
  		.proc_handler	= proc_dointvec_minmax_sysadmin,
eaf06b241   Dan Rosenberg   Restrict unprivil...
813
814
815
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
455cd5ab3   Dan Rosenberg   kptr_restrict for...
816
817
818
819
820
  	{
  		.procname	= "kptr_restrict",
  		.data		= &kptr_restrict,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
620f6e8e8   Kees Cook   sysctl: fix write...
821
  		.proc_handler	= proc_dointvec_minmax_sysadmin,
455cd5ab3   Dan Rosenberg   kptr_restrict for...
822
823
824
  		.extra1		= &zero,
  		.extra2		= &two,
  	},
df6e61d4c   Joe Perches   kernel/sysctl.c: ...
825
  #endif
eaf06b241   Dan Rosenberg   Restrict unprivil...
826
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
827
828
829
830
  		.procname	= "ngroups_max",
  		.data		= &ngroups_max,
  		.maxlen		= sizeof (int),
  		.mode		= 0444,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
831
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
832
  	},
73efc0394   Dan Ballard   kernel/sysctl.c: ...
833
834
835
836
837
838
839
  	{
  		.procname	= "cap_last_cap",
  		.data		= (void *)&cap_last_cap,
  		.maxlen		= sizeof(int),
  		.mode		= 0444,
  		.proc_handler	= proc_dointvec,
  	},
58687acba   Don Zickus   lockup_detector: ...
840
  #if defined(CONFIG_LOCKUP_DETECTOR)
504d7cf10   Don Zickus   nmi_watchdog: Com...
841
  	{
58687acba   Don Zickus   lockup_detector: ...
842
  		.procname       = "watchdog",
3c00ea82c   Frederic Weisbecker   watchdog: Rename ...
843
  		.data           = &watchdog_user_enabled,
504d7cf10   Don Zickus   nmi_watchdog: Com...
844
845
  		.maxlen         = sizeof (int),
  		.mode           = 0644,
195daf665   Ulrich Obergfell   watchdog: enable ...
846
  		.proc_handler   = proc_watchdog,
586692a5a   Mandeep Singh Baines   watchdog: Disable...
847
848
  		.extra1		= &zero,
  		.extra2		= &one,
58687acba   Don Zickus   lockup_detector: ...
849
850
851
  	},
  	{
  		.procname	= "watchdog_thresh",
586692a5a   Mandeep Singh Baines   watchdog: Disable...
852
  		.data		= &watchdog_thresh,
58687acba   Don Zickus   lockup_detector: ...
853
854
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
195daf665   Ulrich Obergfell   watchdog: enable ...
855
  		.proc_handler	= proc_watchdog_thresh,
a6572f84c   Li Zefan   watchdog: Disallo...
856
  		.extra1		= &zero,
58687acba   Don Zickus   lockup_detector: ...
857
  		.extra2		= &sixty,
504d7cf10   Don Zickus   nmi_watchdog: Com...
858
  	},
2508ce184   Don Zickus   lockup_detector: ...
859
  	{
195daf665   Ulrich Obergfell   watchdog: enable ...
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
  		.procname       = "nmi_watchdog",
  		.data           = &nmi_watchdog_enabled,
  		.maxlen         = sizeof (int),
  		.mode           = 0644,
  		.proc_handler   = proc_nmi_watchdog,
  		.extra1		= &zero,
  #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
  		.extra2		= &one,
  #else
  		.extra2		= &zero,
  #endif
  	},
  	{
  		.procname       = "soft_watchdog",
  		.data           = &soft_watchdog_enabled,
  		.maxlen         = sizeof (int),
  		.mode           = 0644,
  		.proc_handler   = proc_soft_watchdog,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  	{
fe4ba3c34   Chris Metcalf   watchdog: add wat...
882
883
884
885
886
887
888
  		.procname	= "watchdog_cpumask",
  		.data		= &watchdog_cpumask_bits,
  		.maxlen		= NR_CPUS,
  		.mode		= 0644,
  		.proc_handler	= proc_watchdog_cpumask,
  	},
  	{
2508ce184   Don Zickus   lockup_detector: ...
889
890
891
892
893
894
895
896
  		.procname	= "softlockup_panic",
  		.data		= &softlockup_panic,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
ac1f59124   Don Zickus   kernel/watchdog.c...
897
898
899
900
901
902
903
904
905
906
907
  #ifdef CONFIG_HARDLOCKUP_DETECTOR
  	{
  		.procname	= "hardlockup_panic",
  		.data		= &hardlockup_panic,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif
ed235875e   Aaron Tomlin   kernel/watchdog.c...
908
909
910
911
912
913
914
915
916
917
  #ifdef CONFIG_SMP
  	{
  		.procname	= "softlockup_all_cpu_backtrace",
  		.data		= &sysctl_softlockup_all_cpu_backtrace,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
55537871e   Jiri Kosina   kernel/watchdog.c...
918
919
920
921
922
923
924
925
926
  	{
  		.procname	= "hardlockup_all_cpu_backtrace",
  		.data		= &sysctl_hardlockup_all_cpu_backtrace,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
ed235875e   Aaron Tomlin   kernel/watchdog.c...
927
  #endif /* CONFIG_SMP */
5dc305587   Don Zickus   x86, NMI: Add bac...
928
929
930
931
932
933
934
935
936
  #endif
  #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
  	{
  		.procname       = "unknown_nmi_panic",
  		.data           = &unknown_nmi_panic,
  		.maxlen         = sizeof (int),
  		.mode           = 0644,
  		.proc_handler   = proc_dointvec,
  	},
504d7cf10   Don Zickus   nmi_watchdog: Com...
937
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
938
939
  #if defined(CONFIG_X86)
  	{
8da5adda9   Don Zickus   [PATCH] x86: Allo...
940
941
942
943
  		.procname	= "panic_on_unrecovered_nmi",
  		.data		= &panic_on_unrecovered_nmi,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
944
  		.proc_handler	= proc_dointvec,
8da5adda9   Don Zickus   [PATCH] x86: Allo...
945
946
  	},
  	{
5211a242d   Kurt Garloff   x86: Add sysctl t...
947
948
949
950
  		.procname	= "panic_on_io_nmi",
  		.data		= &panic_on_io_nmi,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
951
  		.proc_handler	= proc_dointvec,
5211a242d   Kurt Garloff   x86: Add sysctl t...
952
  	},
55af77969   Mitsuo Hayasaka   x86: Panic on det...
953
954
955
956
957
958
959
960
961
  #ifdef CONFIG_DEBUG_STACKOVERFLOW
  	{
  		.procname	= "panic_on_stackoverflow",
  		.data		= &sysctl_panic_on_stackoverflow,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
  #endif
5211a242d   Kurt Garloff   x86: Add sysctl t...
962
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
963
964
965
966
  		.procname	= "bootloader_type",
  		.data		= &bootloader_type,
  		.maxlen		= sizeof (int),
  		.mode		= 0444,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
967
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
968
  	},
0741f4d20   Chuck Ebbert   [PATCH] x86: add ...
969
  	{
5031296c5   H. Peter Anvin   x86: add extensio...
970
971
972
973
  		.procname	= "bootloader_version",
  		.data		= &bootloader_version,
  		.maxlen		= sizeof (int),
  		.mode		= 0444,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
974
  		.proc_handler	= proc_dointvec,
5031296c5   H. Peter Anvin   x86: add extensio...
975
976
  	},
  	{
0741f4d20   Chuck Ebbert   [PATCH] x86: add ...
977
978
979
980
  		.procname	= "kstack_depth_to_print",
  		.data		= &kstack_depth_to_print,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
981
  		.proc_handler	= proc_dointvec,
0741f4d20   Chuck Ebbert   [PATCH] x86: add ...
982
  	},
6e7c40259   Ingo Molnar   x86: various chan...
983
  	{
6e7c40259   Ingo Molnar   x86: various chan...
984
985
986
987
  		.procname	= "io_delay_type",
  		.data		= &io_delay_type,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
988
  		.proc_handler	= proc_dointvec,
6e7c40259   Ingo Molnar   x86: various chan...
989
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
990
  #endif
7a9166e3b   Luke Yang   [PATCH] Fix undef...
991
  #if defined(CONFIG_MMU)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
992
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
993
994
995
996
  		.procname	= "randomize_va_space",
  		.data		= &randomize_va_space,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
997
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
998
  	},
7a9166e3b   Luke Yang   [PATCH] Fix undef...
999
  #endif
0152fb376   Martin Schwidefsky   [PATCH] s390: spi...
1000
  #if defined(CONFIG_S390) && defined(CONFIG_SMP)
951f22d5b   Martin Schwidefsky   [PATCH] s390: spi...
1001
  	{
951f22d5b   Martin Schwidefsky   [PATCH] s390: spi...
1002
1003
1004
1005
  		.procname	= "spin_retry",
  		.data		= &spin_retry,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1006
  		.proc_handler	= proc_dointvec,
951f22d5b   Martin Schwidefsky   [PATCH] s390: spi...
1007
1008
  	},
  #endif
673d5b43d   Len Brown   ACPI: restore CON...
1009
  #if	defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
c255d844d   Pavel Machek   [PATCH] suspend-t...
1010
  	{
c255d844d   Pavel Machek   [PATCH] suspend-t...
1011
  		.procname	= "acpi_video_flags",
77afcf78a   Pavel Machek   PM: Integrate bee...
1012
  		.data		= &acpi_realmode_flags,
c255d844d   Pavel Machek   [PATCH] suspend-t...
1013
1014
  		.maxlen		= sizeof (unsigned long),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1015
  		.proc_handler	= proc_doulongvec_minmax,
c255d844d   Pavel Machek   [PATCH] suspend-t...
1016
1017
  	},
  #endif
b6fca7253   Vineet Gupta   sysctl: Enable IA...
1018
  #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
d2b176ed8   Jes Sorensen   [IA64] sysctl opt...
1019
  	{
d2b176ed8   Jes Sorensen   [IA64] sysctl opt...
1020
1021
1022
1023
  		.procname	= "ignore-unaligned-usertrap",
  		.data		= &no_unaligned_warning,
  		.maxlen		= sizeof (int),
  	 	.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1024
  		.proc_handler	= proc_dointvec,
d2b176ed8   Jes Sorensen   [IA64] sysctl opt...
1025
  	},
b6fca7253   Vineet Gupta   sysctl: Enable IA...
1026
1027
  #endif
  #ifdef CONFIG_IA64
88fc241f5   Doug Chapman   [IA64] dump stack...
1028
  	{
88fc241f5   Doug Chapman   [IA64] dump stack...
1029
1030
1031
1032
  		.procname	= "unaligned-dump-stack",
  		.data		= &unaligned_dump_stack,
  		.maxlen		= sizeof (int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1033
  		.proc_handler	= proc_dointvec,
88fc241f5   Doug Chapman   [IA64] dump stack...
1034
  	},
d2b176ed8   Jes Sorensen   [IA64] sysctl opt...
1035
  #endif
e162b39a3   Mandeep Singh Baines   softlockup: decou...
1036
1037
  #ifdef CONFIG_DETECT_HUNG_TASK
  	{
e162b39a3   Mandeep Singh Baines   softlockup: decou...
1038
1039
1040
1041
  		.procname	= "hung_task_panic",
  		.data		= &sysctl_hung_task_panic,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1042
  		.proc_handler	= proc_dointvec_minmax,
e162b39a3   Mandeep Singh Baines   softlockup: decou...
1043
1044
1045
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
82a1fcb90   Ingo Molnar   softlockup: autom...
1046
  	{
82a1fcb90   Ingo Molnar   softlockup: autom...
1047
1048
  		.procname	= "hung_task_check_count",
  		.data		= &sysctl_hung_task_check_count,
cd64647f0   Li Zefan   hung_task: Change...
1049
  		.maxlen		= sizeof(int),
82a1fcb90   Ingo Molnar   softlockup: autom...
1050
  		.mode		= 0644,
cd64647f0   Li Zefan   hung_task: Change...
1051
1052
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
82a1fcb90   Ingo Molnar   softlockup: autom...
1053
1054
  	},
  	{
82a1fcb90   Ingo Molnar   softlockup: autom...
1055
1056
  		.procname	= "hung_task_timeout_secs",
  		.data		= &sysctl_hung_task_timeout_secs,
90739081e   Ingo Molnar   softlockup: fix s...
1057
  		.maxlen		= sizeof(unsigned long),
82a1fcb90   Ingo Molnar   softlockup: autom...
1058
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1059
  		.proc_handler	= proc_dohung_task_timeout_secs,
80df28476   Liu Hua   hung_task: check ...
1060
  		.extra2		= &hung_task_timeout_max,
82a1fcb90   Ingo Molnar   softlockup: autom...
1061
1062
  	},
  	{
82a1fcb90   Ingo Molnar   softlockup: autom...
1063
1064
  		.procname	= "hung_task_warnings",
  		.data		= &sysctl_hung_task_warnings,
270750dbc   Aaron Tomlin   hung_task: Displa...
1065
  		.maxlen		= sizeof(int),
82a1fcb90   Ingo Molnar   softlockup: autom...
1066
  		.mode		= 0644,
270750dbc   Aaron Tomlin   hung_task: Displa...
1067
1068
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &neg_one,
82a1fcb90   Ingo Molnar   softlockup: autom...
1069
  	},
c4f3b63fe   Ravikiran G Thirumalai   softlockup: add a...
1070
  #endif
bebfa1013   Andi Kleen   [PATCH] x86_64: A...
1071
1072
  #ifdef CONFIG_COMPAT
  	{
bebfa1013   Andi Kleen   [PATCH] x86_64: A...
1073
1074
1075
1076
  		.procname	= "compat-log",
  		.data		= &compat_log,
  		.maxlen		= sizeof (int),
  	 	.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1077
  		.proc_handler	= proc_dointvec,
bebfa1013   Andi Kleen   [PATCH] x86_64: A...
1078
1079
  	},
  #endif
23f78d4a0   Ingo Molnar   [PATCH] pi-futex:...
1080
1081
  #ifdef CONFIG_RT_MUTEXES
  	{
23f78d4a0   Ingo Molnar   [PATCH] pi-futex:...
1082
1083
1084
1085
  		.procname	= "max_lock_depth",
  		.data		= &max_lock_depth,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1086
  		.proc_handler	= proc_dointvec,
23f78d4a0   Ingo Molnar   [PATCH] pi-futex:...
1087
1088
  	},
  #endif
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
1089
  	{
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
1090
1091
1092
1093
  		.procname	= "poweroff_cmd",
  		.data		= &poweroff_cmd,
  		.maxlen		= POWEROFF_CMD_PATH_LEN,
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1094
  		.proc_handler	= proc_dostring,
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
1095
  	},
0b77f5bfb   David Howells   keys: make the ke...
1096
1097
  #ifdef CONFIG_KEYS
  	{
0b77f5bfb   David Howells   keys: make the ke...
1098
1099
1100
1101
1102
  		.procname	= "keys",
  		.mode		= 0555,
  		.child		= key_sysctls,
  	},
  #endif
cdd6c482c   Ingo Molnar   perf: Do the big ...
1103
  #ifdef CONFIG_PERF_EVENTS
aa4a22187   Vince Weaver   perf: Comment /pr...
1104
1105
1106
1107
1108
1109
  	/*
  	 * User-space scripts rely on the existence of this file
  	 * as a feature check for perf_events being enabled.
  	 *
  	 * So it's an ABI, do not remove!
  	 */
1ccd15497   Peter Zijlstra   perf_counter: sys...
1110
  	{
cdd6c482c   Ingo Molnar   perf: Do the big ...
1111
1112
1113
  		.procname	= "perf_event_paranoid",
  		.data		= &sysctl_perf_event_paranoid,
  		.maxlen		= sizeof(sysctl_perf_event_paranoid),
1ccd15497   Peter Zijlstra   perf_counter: sys...
1114
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1115
  		.proc_handler	= proc_dointvec,
1ccd15497   Peter Zijlstra   perf_counter: sys...
1116
  	},
c5078f78b   Peter Zijlstra   perf_counter: pro...
1117
  	{
cdd6c482c   Ingo Molnar   perf: Do the big ...
1118
1119
1120
  		.procname	= "perf_event_mlock_kb",
  		.data		= &sysctl_perf_event_mlock,
  		.maxlen		= sizeof(sysctl_perf_event_mlock),
c5078f78b   Peter Zijlstra   perf_counter: pro...
1121
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1122
  		.proc_handler	= proc_dointvec,
c5078f78b   Peter Zijlstra   perf_counter: pro...
1123
  	},
a78ac3258   Peter Zijlstra   perf_counter: Gen...
1124
  	{
cdd6c482c   Ingo Molnar   perf: Do the big ...
1125
1126
1127
  		.procname	= "perf_event_max_sample_rate",
  		.data		= &sysctl_perf_event_sample_rate,
  		.maxlen		= sizeof(sysctl_perf_event_sample_rate),
a78ac3258   Peter Zijlstra   perf_counter: Gen...
1128
  		.mode		= 0644,
163ec4354   Peter Zijlstra   perf: Optimize th...
1129
  		.proc_handler	= perf_proc_update_handler,
723478c8a   Knut Petersen   perf: Enforce 1 a...
1130
  		.extra1		= &one,
a78ac3258   Peter Zijlstra   perf_counter: Gen...
1131
  	},
14c63f17b   Dave Hansen   perf: Drop sample...
1132
1133
1134
1135
1136
1137
1138
1139
1140
  	{
  		.procname	= "perf_cpu_time_max_percent",
  		.data		= &sysctl_perf_cpu_time_max_percent,
  		.maxlen		= sizeof(sysctl_perf_cpu_time_max_percent),
  		.mode		= 0644,
  		.proc_handler	= perf_cpu_time_max_percent_handler,
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
c5dfd78eb   Arnaldo Carvalho de Melo   perf core: Allow ...
1141
1142
  	{
  		.procname	= "perf_event_max_stack",
a831100ae   Arnaldo Carvalho de Melo   perf core: Genera...
1143
  		.data		= &sysctl_perf_event_max_stack,
c5dfd78eb   Arnaldo Carvalho de Melo   perf core: Allow ...
1144
1145
1146
1147
1148
1149
  		.maxlen		= sizeof(sysctl_perf_event_max_stack),
  		.mode		= 0644,
  		.proc_handler	= perf_event_max_stack_handler,
  		.extra1		= &zero,
  		.extra2		= &six_hundred_forty_kb,
  	},
c85b03349   Arnaldo Carvalho de Melo   perf core: Separa...
1150
1151
1152
1153
1154
1155
1156
1157
1158
  	{
  		.procname	= "perf_event_max_contexts_per_stack",
  		.data		= &sysctl_perf_event_max_contexts_per_stack,
  		.maxlen		= sizeof(sysctl_perf_event_max_contexts_per_stack),
  		.mode		= 0644,
  		.proc_handler	= perf_event_max_stack_handler,
  		.extra1		= &zero,
  		.extra2		= &one_thousand,
  	},
1ccd15497   Peter Zijlstra   perf_counter: sys...
1159
  #endif
dfec072ec   Vegard Nossum   kmemcheck: add th...
1160
1161
  #ifdef CONFIG_KMEMCHECK
  	{
dfec072ec   Vegard Nossum   kmemcheck: add th...
1162
1163
1164
1165
  		.procname	= "kmemcheck",
  		.data		= &kmemcheck_enabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1166
  		.proc_handler	= proc_dointvec,
dfec072ec   Vegard Nossum   kmemcheck: add th...
1167
1168
  	},
  #endif
9e3961a09   Prarit Bhargava   kernel: add panic...
1169
1170
1171
1172
1173
1174
1175
1176
1177
  	{
  		.procname	= "panic_on_warn",
  		.data		= &panic_on_warn,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
bc7a34b8b   Thomas Gleixner   timer: Reduce tim...
1178
1179
1180
1181
1182
1183
1184
1185
1186
  #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
  	{
  		.procname	= "timer_migration",
  		.data		= &sysctl_timer_migration,
  		.maxlen		= sizeof(unsigned int),
  		.mode		= 0644,
  		.proc_handler	= timer_migration_handler,
  	},
  #endif
1be7f75d1   Alexei Starovoitov   bpf: enable non-r...
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
  #ifdef CONFIG_BPF_SYSCALL
  	{
  		.procname	= "unprivileged_bpf_disabled",
  		.data		= &sysctl_unprivileged_bpf_disabled,
  		.maxlen		= sizeof(sysctl_unprivileged_bpf_disabled),
  		.mode		= 0644,
  		/* only handle a transition from default "0" to "1" */
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &one,
  		.extra2		= &one,
  	},
  #endif
088e9d253   Daniel Bristot de Oliveira   rcu: sysctl: Pani...
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
  #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
  	{
  		.procname	= "panic_on_rcu_stall",
  		.data		= &sysctl_panic_on_rcu_stall,
  		.maxlen		= sizeof(sysctl_panic_on_rcu_stall),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif
6fce56ec9   Eric W. Biederman   sysctl: Remove re...
1210
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1211
  };
d8217f076   Eric W. Biederman   sysctl core: Stop...
1212
  static struct ctl_table vm_table[] = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1213
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1214
1215
1216
1217
  		.procname	= "overcommit_memory",
  		.data		= &sysctl_overcommit_memory,
  		.maxlen		= sizeof(sysctl_overcommit_memory),
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1218
1219
1220
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &two,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1221
1222
  	},
  	{
fadd8fbd1   KAMEZAWA Hiroyuki   [PATCH] support f...
1223
1224
1225
1226
  		.procname	= "panic_on_oom",
  		.data		= &sysctl_panic_on_oom,
  		.maxlen		= sizeof(sysctl_panic_on_oom),
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1227
1228
1229
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &two,
fadd8fbd1   KAMEZAWA Hiroyuki   [PATCH] support f...
1230
1231
  	},
  	{
fe071d7e8   David Rientjes   oom: add oom_kill...
1232
1233
1234
1235
  		.procname	= "oom_kill_allocating_task",
  		.data		= &sysctl_oom_kill_allocating_task,
  		.maxlen		= sizeof(sysctl_oom_kill_allocating_task),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1236
  		.proc_handler	= proc_dointvec,
fe071d7e8   David Rientjes   oom: add oom_kill...
1237
1238
  	},
  	{
fef1bdd68   David Rientjes   oom: add sysctl t...
1239
1240
1241
1242
  		.procname	= "oom_dump_tasks",
  		.data		= &sysctl_oom_dump_tasks,
  		.maxlen		= sizeof(sysctl_oom_dump_tasks),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1243
  		.proc_handler	= proc_dointvec,
fef1bdd68   David Rientjes   oom: add sysctl t...
1244
1245
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1246
1247
1248
1249
  		.procname	= "overcommit_ratio",
  		.data		= &sysctl_overcommit_ratio,
  		.maxlen		= sizeof(sysctl_overcommit_ratio),
  		.mode		= 0644,
49f0ce5f9   Jerome Marchand   mm: add overcommi...
1250
1251
1252
1253
1254
1255
1256
1257
  		.proc_handler	= overcommit_ratio_handler,
  	},
  	{
  		.procname	= "overcommit_kbytes",
  		.data		= &sysctl_overcommit_kbytes,
  		.maxlen		= sizeof(sysctl_overcommit_kbytes),
  		.mode		= 0644,
  		.proc_handler	= overcommit_kbytes_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1258
1259
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1260
1261
1262
1263
  		.procname	= "page-cluster", 
  		.data		= &page_cluster,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1264
1265
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1266
1267
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1268
1269
1270
1271
  		.procname	= "dirty_background_ratio",
  		.data		= &dirty_background_ratio,
  		.maxlen		= sizeof(dirty_background_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1272
  		.proc_handler	= dirty_background_ratio_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1273
1274
1275
1276
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
  	{
2da02997e   David Rientjes   mm: add dirty_bac...
1277
1278
1279
1280
  		.procname	= "dirty_background_bytes",
  		.data		= &dirty_background_bytes,
  		.maxlen		= sizeof(dirty_background_bytes),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1281
  		.proc_handler	= dirty_background_bytes_handler,
fc3501d41   Sven Wegener   mm: fix dirty_byt...
1282
  		.extra1		= &one_ul,
2da02997e   David Rientjes   mm: add dirty_bac...
1283
1284
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1285
1286
1287
1288
  		.procname	= "dirty_ratio",
  		.data		= &vm_dirty_ratio,
  		.maxlen		= sizeof(vm_dirty_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1289
  		.proc_handler	= dirty_ratio_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1290
1291
1292
1293
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
  	{
2da02997e   David Rientjes   mm: add dirty_bac...
1294
1295
1296
1297
  		.procname	= "dirty_bytes",
  		.data		= &vm_dirty_bytes,
  		.maxlen		= sizeof(vm_dirty_bytes),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1298
  		.proc_handler	= dirty_bytes_handler,
9e4a5bda8   Andrea Righi   mm: prevent divid...
1299
  		.extra1		= &dirty_bytes_min,
2da02997e   David Rientjes   mm: add dirty_bac...
1300
1301
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1302
  		.procname	= "dirty_writeback_centisecs",
f6ef94381   Bart Samwel   [PATCH] Represent...
1303
1304
  		.data		= &dirty_writeback_interval,
  		.maxlen		= sizeof(dirty_writeback_interval),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1305
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1306
  		.proc_handler	= dirty_writeback_centisecs_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1307
1308
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1309
  		.procname	= "dirty_expire_centisecs",
f6ef94381   Bart Samwel   [PATCH] Represent...
1310
1311
  		.data		= &dirty_expire_interval,
  		.maxlen		= sizeof(dirty_expire_interval),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1312
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1313
1314
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1315
1316
  	},
  	{
1efff914a   Theodore Ts'o   fs: add dirtytime...
1317
1318
1319
1320
1321
1322
1323
1324
  		.procname	= "dirtytime_expire_seconds",
  		.data		= &dirtytime_expire_interval,
  		.maxlen		= sizeof(dirty_expire_interval),
  		.mode		= 0644,
  		.proc_handler	= dirtytime_interval_handler,
  		.extra1		= &zero,
  	},
  	{
3965c9ae4   Wanpeng Li   mm: prepare for r...
1325
1326
1327
  		.procname       = "nr_pdflush_threads",
  		.mode           = 0444 /* read-only */,
  		.proc_handler   = pdflush_proc_obsolete,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1328
1329
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1330
1331
1332
1333
  		.procname	= "swappiness",
  		.data		= &vm_swappiness,
  		.maxlen		= sizeof(vm_swappiness),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1334
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1335
1336
1337
1338
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
  #ifdef CONFIG_HUGETLB_PAGE
06808b082   Lee Schermerhorn   hugetlb: derive h...
1339
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1340
  		.procname	= "nr_hugepages",
e5ff21594   Andi Kleen   hugetlb: multiple...
1341
  		.data		= NULL,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1342
1343
  		.maxlen		= sizeof(unsigned long),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1344
  		.proc_handler	= hugetlb_sysctl_handler,
06808b082   Lee Schermerhorn   hugetlb: derive h...
1345
1346
1347
1348
1349
1350
1351
1352
  	},
  #ifdef CONFIG_NUMA
  	{
  		.procname       = "nr_hugepages_mempolicy",
  		.data           = NULL,
  		.maxlen         = sizeof(unsigned long),
  		.mode           = 0644,
  		.proc_handler   = &hugetlb_mempolicy_sysctl_handler,
06808b082   Lee Schermerhorn   hugetlb: derive h...
1353
1354
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1355
  	 {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1356
1357
1358
1359
  		.procname	= "hugetlb_shm_group",
  		.data		= &sysctl_hugetlb_shm_group,
  		.maxlen		= sizeof(gid_t),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1360
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1361
  	 },
396faf030   Mel Gorman   Allow huge page a...
1362
  	 {
396faf030   Mel Gorman   Allow huge page a...
1363
1364
1365
1366
  		.procname	= "hugepages_treat_as_movable",
  		.data		= &hugepages_treat_as_movable,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
86cdb465c   Naoya Horiguchi   mm: prepare to re...
1367
  		.proc_handler	= proc_dointvec,
396faf030   Mel Gorman   Allow huge page a...
1368
  	},
54f9f80d6   Adam Litke   hugetlb: Add huge...
1369
  	{
d1c3fb1f8   Nishanth Aravamudan   hugetlb: introduc...
1370
  		.procname	= "nr_overcommit_hugepages",
e5ff21594   Andi Kleen   hugetlb: multiple...
1371
1372
  		.data		= NULL,
  		.maxlen		= sizeof(unsigned long),
d1c3fb1f8   Nishanth Aravamudan   hugetlb: introduc...
1373
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1374
  		.proc_handler	= hugetlb_overcommit_handler,
d1c3fb1f8   Nishanth Aravamudan   hugetlb: introduc...
1375
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1376
1377
  #endif
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1378
1379
1380
1381
  		.procname	= "lowmem_reserve_ratio",
  		.data		= &sysctl_lowmem_reserve_ratio,
  		.maxlen		= sizeof(sysctl_lowmem_reserve_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1382
  		.proc_handler	= lowmem_reserve_ratio_sysctl_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1383
1384
  	},
  	{
9d0243bca   Andrew Morton   [PATCH] drop-page...
1385
1386
1387
1388
1389
  		.procname	= "drop_caches",
  		.data		= &sysctl_drop_caches,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= drop_caches_sysctl_handler,
cb16e95fa   Petr Holasek   sysctl: add some ...
1390
  		.extra1		= &one,
5509a5d27   Dave Hansen   drop_caches: add ...
1391
  		.extra2		= &four,
9d0243bca   Andrew Morton   [PATCH] drop-page...
1392
  	},
76ab0f530   Mel Gorman   mm: compaction: a...
1393
1394
1395
1396
1397
1398
1399
1400
  #ifdef CONFIG_COMPACTION
  	{
  		.procname	= "compact_memory",
  		.data		= &sysctl_compact_memory,
  		.maxlen		= sizeof(int),
  		.mode		= 0200,
  		.proc_handler	= sysctl_compaction_handler,
  	},
5e7719058   Mel Gorman   mm: compaction: a...
1401
1402
1403
1404
1405
1406
1407
1408
1409
  	{
  		.procname	= "extfrag_threshold",
  		.data		= &sysctl_extfrag_threshold,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= sysctl_extfrag_handler,
  		.extra1		= &min_extfrag_threshold,
  		.extra2		= &max_extfrag_threshold,
  	},
5bbe3547a   Eric B Munson   mm: allow compact...
1410
1411
1412
1413
1414
1415
1416
1417
1418
  	{
  		.procname	= "compact_unevictable_allowed",
  		.data		= &sysctl_compact_unevictable_allowed,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
5e7719058   Mel Gorman   mm: compaction: a...
1419

76ab0f530   Mel Gorman   mm: compaction: a...
1420
  #endif /* CONFIG_COMPACTION */
9d0243bca   Andrew Morton   [PATCH] drop-page...
1421
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1422
1423
1424
1425
  		.procname	= "min_free_kbytes",
  		.data		= &min_free_kbytes,
  		.maxlen		= sizeof(min_free_kbytes),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1426
  		.proc_handler	= min_free_kbytes_sysctl_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1427
1428
  		.extra1		= &zero,
  	},
8ad4b1fb8   Rohit Seth   [PATCH] Make high...
1429
  	{
795ae7a0d   Johannes Weiner   mm: scale kswapd ...
1430
1431
1432
1433
1434
1435
1436
1437
1438
  		.procname	= "watermark_scale_factor",
  		.data		= &watermark_scale_factor,
  		.maxlen		= sizeof(watermark_scale_factor),
  		.mode		= 0644,
  		.proc_handler	= watermark_scale_factor_sysctl_handler,
  		.extra1		= &one,
  		.extra2		= &one_thousand,
  	},
  	{
8ad4b1fb8   Rohit Seth   [PATCH] Make high...
1439
1440
1441
1442
  		.procname	= "percpu_pagelist_fraction",
  		.data		= &percpu_pagelist_fraction,
  		.maxlen		= sizeof(percpu_pagelist_fraction),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1443
  		.proc_handler	= percpu_pagelist_fraction_sysctl_handler,
7cd2b0a34   David Rientjes   mm, pcp: allow re...
1444
  		.extra1		= &zero,
8ad4b1fb8   Rohit Seth   [PATCH] Make high...
1445
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1446
1447
  #ifdef CONFIG_MMU
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1448
1449
1450
1451
  		.procname	= "max_map_count",
  		.data		= &sysctl_max_map_count,
  		.maxlen		= sizeof(sysctl_max_map_count),
  		.mode		= 0644,
3e26120cc   WANG Cong   kernel/sysctl.c: ...
1452
  		.proc_handler	= proc_dointvec_minmax,
70da2340f   Amerigo Wang   'sysctl_max_map_c...
1453
  		.extra1		= &zero,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1454
  	},
dd8632a12   Paul Mundt   NOMMU: Make mmap ...
1455
1456
  #else
  	{
dd8632a12   Paul Mundt   NOMMU: Make mmap ...
1457
1458
1459
1460
  		.procname	= "nr_trim_pages",
  		.data		= &sysctl_nr_trim_pages,
  		.maxlen		= sizeof(sysctl_nr_trim_pages),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1461
  		.proc_handler	= proc_dointvec_minmax,
dd8632a12   Paul Mundt   NOMMU: Make mmap ...
1462
1463
  		.extra1		= &zero,
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1464
1465
  #endif
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1466
1467
1468
1469
  		.procname	= "laptop_mode",
  		.data		= &laptop_mode,
  		.maxlen		= sizeof(laptop_mode),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1470
  		.proc_handler	= proc_dointvec_jiffies,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1471
1472
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1473
1474
1475
1476
  		.procname	= "block_dump",
  		.data		= &block_dump,
  		.maxlen		= sizeof(block_dump),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1477
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1478
1479
1480
  		.extra1		= &zero,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1481
1482
1483
1484
  		.procname	= "vfs_cache_pressure",
  		.data		= &sysctl_vfs_cache_pressure,
  		.maxlen		= sizeof(sysctl_vfs_cache_pressure),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1485
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1486
1487
1488
1489
  		.extra1		= &zero,
  	},
  #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1490
1491
1492
1493
  		.procname	= "legacy_va_layout",
  		.data		= &sysctl_legacy_va_layout,
  		.maxlen		= sizeof(sysctl_legacy_va_layout),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1494
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1495
1496
1497
  		.extra1		= &zero,
  	},
  #endif
1743660b9   Christoph Lameter   [PATCH] Zone recl...
1498
1499
  #ifdef CONFIG_NUMA
  	{
1743660b9   Christoph Lameter   [PATCH] Zone recl...
1500
  		.procname	= "zone_reclaim_mode",
a5f5f91da   Mel Gorman   mm: convert zone_...
1501
1502
  		.data		= &node_reclaim_mode,
  		.maxlen		= sizeof(node_reclaim_mode),
1743660b9   Christoph Lameter   [PATCH] Zone recl...
1503
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1504
  		.proc_handler	= proc_dointvec,
c84db23c6   Christoph Lameter   [PATCH] zone_recl...
1505
  		.extra1		= &zero,
1743660b9   Christoph Lameter   [PATCH] Zone recl...
1506
  	},
9614634fe   Christoph Lameter   [PATCH] ZVC/zone_...
1507
  	{
9614634fe   Christoph Lameter   [PATCH] ZVC/zone_...
1508
1509
1510
1511
  		.procname	= "min_unmapped_ratio",
  		.data		= &sysctl_min_unmapped_ratio,
  		.maxlen		= sizeof(sysctl_min_unmapped_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1512
  		.proc_handler	= sysctl_min_unmapped_ratio_sysctl_handler,
9614634fe   Christoph Lameter   [PATCH] ZVC/zone_...
1513
1514
1515
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
0ff38490c   Christoph Lameter   [PATCH] zone_recl...
1516
  	{
0ff38490c   Christoph Lameter   [PATCH] zone_recl...
1517
1518
1519
1520
  		.procname	= "min_slab_ratio",
  		.data		= &sysctl_min_slab_ratio,
  		.maxlen		= sizeof(sysctl_min_slab_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1521
  		.proc_handler	= sysctl_min_slab_ratio_sysctl_handler,
0ff38490c   Christoph Lameter   [PATCH] zone_recl...
1522
1523
1524
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
1743660b9   Christoph Lameter   [PATCH] Zone recl...
1525
  #endif
77461ab33   Christoph Lameter   Make vm statistic...
1526
1527
  #ifdef CONFIG_SMP
  	{
77461ab33   Christoph Lameter   Make vm statistic...
1528
1529
1530
1531
  		.procname	= "stat_interval",
  		.data		= &sysctl_stat_interval,
  		.maxlen		= sizeof(sysctl_stat_interval),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1532
  		.proc_handler	= proc_dointvec_jiffies,
77461ab33   Christoph Lameter   Make vm statistic...
1533
  	},
52b6f46bc   Hugh Dickins   mm: /proc/sys/vm/...
1534
1535
1536
1537
1538
1539
1540
  	{
  		.procname	= "stat_refresh",
  		.data		= NULL,
  		.maxlen		= 0,
  		.mode		= 0600,
  		.proc_handler	= vmstat_refresh,
  	},
77461ab33   Christoph Lameter   Make vm statistic...
1541
  #endif
6e1415467   David Howells   NOMMU: Optimise a...
1542
  #ifdef CONFIG_MMU
ed0321895   Eric Paris   security: Protect...
1543
  	{
ed0321895   Eric Paris   security: Protect...
1544
  		.procname	= "mmap_min_addr",
788084aba   Eric Paris   Security/SELinux:...
1545
1546
  		.data		= &dac_mmap_min_addr,
  		.maxlen		= sizeof(unsigned long),
ed0321895   Eric Paris   security: Protect...
1547
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1548
  		.proc_handler	= mmap_min_addr_handler,
ed0321895   Eric Paris   security: Protect...
1549
  	},
6e1415467   David Howells   NOMMU: Optimise a...
1550
  #endif
f0c0b2b80   KAMEZAWA Hiroyuki   change zonelist o...
1551
1552
  #ifdef CONFIG_NUMA
  	{
f0c0b2b80   KAMEZAWA Hiroyuki   change zonelist o...
1553
1554
1555
1556
  		.procname	= "numa_zonelist_order",
  		.data		= &numa_zonelist_order,
  		.maxlen		= NUMA_ZONELIST_ORDER_LEN,
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1557
  		.proc_handler	= numa_zonelist_order_handler,
f0c0b2b80   KAMEZAWA Hiroyuki   change zonelist o...
1558
1559
  	},
  #endif
2b8232ce5   Al Viro   minimal build fix...
1560
  #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
5c36e6578   Paul Mundt   sysctl: Support v...
1561
     (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
e6e5494cb   Ingo Molnar   [PATCH] vdso: ran...
1562
  	{
e6e5494cb   Ingo Molnar   [PATCH] vdso: ran...
1563
  		.procname	= "vdso_enabled",
3d7ee969b   Andy Lutomirski   x86, vdso: Clean ...
1564
1565
1566
1567
  #ifdef CONFIG_X86_32
  		.data		= &vdso32_enabled,
  		.maxlen		= sizeof(vdso32_enabled),
  #else
e6e5494cb   Ingo Molnar   [PATCH] vdso: ran...
1568
1569
  		.data		= &vdso_enabled,
  		.maxlen		= sizeof(vdso_enabled),
3d7ee969b   Andy Lutomirski   x86, vdso: Clean ...
1570
  #endif
e6e5494cb   Ingo Molnar   [PATCH] vdso: ran...
1571
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1572
  		.proc_handler	= proc_dointvec,
e6e5494cb   Ingo Molnar   [PATCH] vdso: ran...
1573
1574
1575
  		.extra1		= &zero,
  	},
  #endif
195cf453d   Bron Gondwana   mm/page-writeback...
1576
1577
  #ifdef CONFIG_HIGHMEM
  	{
195cf453d   Bron Gondwana   mm/page-writeback...
1578
1579
1580
1581
  		.procname	= "highmem_is_dirtyable",
  		.data		= &vm_highmem_is_dirtyable,
  		.maxlen		= sizeof(vm_highmem_is_dirtyable),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1582
  		.proc_handler	= proc_dointvec_minmax,
195cf453d   Bron Gondwana   mm/page-writeback...
1583
1584
1585
1586
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif
6a46079cf   Andi Kleen   HWPOISON: The hig...
1587
1588
  #ifdef CONFIG_MEMORY_FAILURE
  	{
6a46079cf   Andi Kleen   HWPOISON: The hig...
1589
1590
1591
1592
  		.procname	= "memory_failure_early_kill",
  		.data		= &sysctl_memory_failure_early_kill,
  		.maxlen		= sizeof(sysctl_memory_failure_early_kill),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1593
  		.proc_handler	= proc_dointvec_minmax,
6a46079cf   Andi Kleen   HWPOISON: The hig...
1594
1595
1596
1597
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  	{
6a46079cf   Andi Kleen   HWPOISON: The hig...
1598
1599
1600
1601
  		.procname	= "memory_failure_recovery",
  		.data		= &sysctl_memory_failure_recovery,
  		.maxlen		= sizeof(sysctl_memory_failure_recovery),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1602
  		.proc_handler	= proc_dointvec_minmax,
6a46079cf   Andi Kleen   HWPOISON: The hig...
1603
1604
1605
1606
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif
c9b1d0981   Andrew Shewmaker   mm: limit growth ...
1607
1608
1609
1610
1611
1612
1613
  	{
  		.procname	= "user_reserve_kbytes",
  		.data		= &sysctl_user_reserve_kbytes,
  		.maxlen		= sizeof(sysctl_user_reserve_kbytes),
  		.mode		= 0644,
  		.proc_handler	= proc_doulongvec_minmax,
  	},
4eeab4f55   Andrew Shewmaker   mm: replace hardc...
1614
1615
1616
1617
1618
1619
1620
  	{
  		.procname	= "admin_reserve_kbytes",
  		.data		= &sysctl_admin_reserve_kbytes,
  		.maxlen		= sizeof(sysctl_admin_reserve_kbytes),
  		.mode		= 0644,
  		.proc_handler	= proc_doulongvec_minmax,
  	},
d07e22597   Daniel Cashman   mm: mmap: add new...
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
  #ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
  	{
  		.procname	= "mmap_rnd_bits",
  		.data		= &mmap_rnd_bits,
  		.maxlen		= sizeof(mmap_rnd_bits),
  		.mode		= 0600,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= (void *)&mmap_rnd_bits_min,
  		.extra2		= (void *)&mmap_rnd_bits_max,
  	},
  #endif
  #ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
  	{
  		.procname	= "mmap_rnd_compat_bits",
  		.data		= &mmap_rnd_compat_bits,
  		.maxlen		= sizeof(mmap_rnd_compat_bits),
  		.mode		= 0600,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= (void *)&mmap_rnd_compat_bits_min,
  		.extra2		= (void *)&mmap_rnd_compat_bits_max,
  	},
  #endif
6fce56ec9   Eric W. Biederman   sysctl: Remove re...
1643
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1644
  };
d8217f076   Eric W. Biederman   sysctl core: Stop...
1645
  static struct ctl_table fs_table[] = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1646
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1647
1648
  		.procname	= "inode-nr",
  		.data		= &inodes_stat,
3942c07cc   Glauber Costa   fs: bump inode an...
1649
  		.maxlen		= 2*sizeof(long),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1650
  		.mode		= 0444,
cffbc8aa3   Dave Chinner   fs: Convert nr_in...
1651
  		.proc_handler	= proc_nr_inodes,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1652
1653
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1654
1655
  		.procname	= "inode-state",
  		.data		= &inodes_stat,
3942c07cc   Glauber Costa   fs: bump inode an...
1656
  		.maxlen		= 7*sizeof(long),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1657
  		.mode		= 0444,
cffbc8aa3   Dave Chinner   fs: Convert nr_in...
1658
  		.proc_handler	= proc_nr_inodes,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1659
1660
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1661
1662
  		.procname	= "file-nr",
  		.data		= &files_stat,
518de9b39   Eric Dumazet   fs: allow for mor...
1663
  		.maxlen		= sizeof(files_stat),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1664
  		.mode		= 0444,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1665
  		.proc_handler	= proc_nr_files,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1666
1667
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1668
1669
  		.procname	= "file-max",
  		.data		= &files_stat.max_files,
518de9b39   Eric Dumazet   fs: allow for mor...
1670
  		.maxlen		= sizeof(files_stat.max_files),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1671
  		.mode		= 0644,
518de9b39   Eric Dumazet   fs: allow for mor...
1672
  		.proc_handler	= proc_doulongvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1673
1674
  	},
  	{
9cfe015aa   Eric Dumazet   get rid of NR_OPE...
1675
1676
1677
1678
  		.procname	= "nr_open",
  		.data		= &sysctl_nr_open,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1679
  		.proc_handler	= proc_dointvec_minmax,
eceea0b3d   Al Viro   [PATCH] avoid mul...
1680
1681
  		.extra1		= &sysctl_nr_open_min,
  		.extra2		= &sysctl_nr_open_max,
9cfe015aa   Eric Dumazet   get rid of NR_OPE...
1682
1683
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1684
1685
  		.procname	= "dentry-state",
  		.data		= &dentry_stat,
3942c07cc   Glauber Costa   fs: bump inode an...
1686
  		.maxlen		= 6*sizeof(long),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1687
  		.mode		= 0444,
312d3ca85   Christoph Hellwig   fs: use percpu co...
1688
  		.proc_handler	= proc_nr_dentry,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1689
1690
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1691
1692
1693
1694
  		.procname	= "overflowuid",
  		.data		= &fs_overflowuid,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1695
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1696
1697
1698
1699
  		.extra1		= &minolduid,
  		.extra2		= &maxolduid,
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1700
1701
1702
1703
  		.procname	= "overflowgid",
  		.data		= &fs_overflowgid,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1704
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1705
1706
1707
  		.extra1		= &minolduid,
  		.extra2		= &maxolduid,
  	},
bfcd17a6c   Thomas Petazzoni   Configure out fil...
1708
  #ifdef CONFIG_FILE_LOCKING
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1709
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1710
1711
1712
1713
  		.procname	= "leases-enable",
  		.data		= &leases_enable,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1714
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1715
  	},
bfcd17a6c   Thomas Petazzoni   Configure out fil...
1716
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1717
1718
  #ifdef CONFIG_DNOTIFY
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1719
1720
1721
1722
  		.procname	= "dir-notify-enable",
  		.data		= &dir_notify_enable,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1723
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1724
1725
1726
  	},
  #endif
  #ifdef CONFIG_MMU
bfcd17a6c   Thomas Petazzoni   Configure out fil...
1727
  #ifdef CONFIG_FILE_LOCKING
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1728
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1729
1730
1731
1732
  		.procname	= "lease-break-time",
  		.data		= &lease_break_time,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1733
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1734
  	},
bfcd17a6c   Thomas Petazzoni   Configure out fil...
1735
  #endif
ebf3f09c6   Thomas Petazzoni   Configure out AIO...
1736
  #ifdef CONFIG_AIO
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1737
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1738
1739
1740
1741
  		.procname	= "aio-nr",
  		.data		= &aio_nr,
  		.maxlen		= sizeof(aio_nr),
  		.mode		= 0444,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1742
  		.proc_handler	= proc_doulongvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1743
1744
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1745
1746
1747
1748
  		.procname	= "aio-max-nr",
  		.data		= &aio_max_nr,
  		.maxlen		= sizeof(aio_max_nr),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1749
  		.proc_handler	= proc_doulongvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1750
  	},
ebf3f09c6   Thomas Petazzoni   Configure out AIO...
1751
  #endif /* CONFIG_AIO */
2d9048e20   Amy Griffis   [PATCH] inotify (...
1752
  #ifdef CONFIG_INOTIFY_USER
0399cb08c   Robert Love   [PATCH] inotify: ...
1753
  	{
0399cb08c   Robert Love   [PATCH] inotify: ...
1754
1755
1756
1757
1758
  		.procname	= "inotify",
  		.mode		= 0555,
  		.child		= inotify_table,
  	},
  #endif	
7ef9964e6   Davide Libenzi   epoll: introduce ...
1759
1760
1761
1762
1763
1764
1765
  #ifdef CONFIG_EPOLL
  	{
  		.procname	= "epoll",
  		.mode		= 0555,
  		.child		= epoll_table,
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1766
  #endif
d6e711448   Alan Cox   [PATCH] setuid co...
1767
  	{
800179c9b   Kees Cook   fs: add link rest...
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
  		.procname	= "protected_symlinks",
  		.data		= &sysctl_protected_symlinks,
  		.maxlen		= sizeof(int),
  		.mode		= 0600,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  	{
  		.procname	= "protected_hardlinks",
  		.data		= &sysctl_protected_hardlinks,
  		.maxlen		= sizeof(int),
  		.mode		= 0600,
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  	{
d6e711448   Alan Cox   [PATCH] setuid co...
1786
1787
1788
1789
  		.procname	= "suid_dumpable",
  		.data		= &suid_dumpable,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
54b501992   Kees Cook   coredump: warn ab...
1790
  		.proc_handler	= proc_dointvec_minmax_coredump,
8e654fba4   Matthew Wilcox   sysctl: fix suid_...
1791
1792
  		.extra1		= &zero,
  		.extra2		= &two,
d6e711448   Alan Cox   [PATCH] setuid co...
1793
  	},
2abc26fc6   Eric W. Biederman   [PATCH] sysctl: c...
1794
1795
  #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
  	{
2abc26fc6   Eric W. Biederman   [PATCH] sysctl: c...
1796
1797
  		.procname	= "binfmt_misc",
  		.mode		= 0555,
f9bd6733d   Eric W. Biederman   sysctl: Allow cre...
1798
  		.child		= sysctl_mount_point,
2abc26fc6   Eric W. Biederman   [PATCH] sysctl: c...
1799
1800
  	},
  #endif
b492e95be   Jens Axboe   pipe: set lower a...
1801
  	{
ff9da691c   Jens Axboe   pipe: change /pro...
1802
1803
  		.procname	= "pipe-max-size",
  		.data		= &pipe_max_size,
b492e95be   Jens Axboe   pipe: set lower a...
1804
1805
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
ff9da691c   Jens Axboe   pipe: change /pro...
1806
1807
  		.proc_handler	= &pipe_proc_fn,
  		.extra1		= &pipe_min_size,
b492e95be   Jens Axboe   pipe: set lower a...
1808
  	},
759c01142   Willy Tarreau   pipe: limit the p...
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
  	{
  		.procname	= "pipe-user-pages-hard",
  		.data		= &pipe_user_pages_hard,
  		.maxlen		= sizeof(pipe_user_pages_hard),
  		.mode		= 0644,
  		.proc_handler	= proc_doulongvec_minmax,
  	},
  	{
  		.procname	= "pipe-user-pages-soft",
  		.data		= &pipe_user_pages_soft,
  		.maxlen		= sizeof(pipe_user_pages_soft),
  		.mode		= 0644,
  		.proc_handler	= proc_doulongvec_minmax,
  	},
6fce56ec9   Eric W. Biederman   sysctl: Remove re...
1823
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1824
  };
d8217f076   Eric W. Biederman   sysctl core: Stop...
1825
  static struct ctl_table debug_table[] = {
7ac57a89d   Catalin Marinas   Kconfig: clean up...
1826
  #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
abd4f7505   Masoud Asgharifard Sharbiani   x86: i386-show-un...
1827
  	{
abd4f7505   Masoud Asgharifard Sharbiani   x86: i386-show-un...
1828
1829
1830
1831
1832
1833
1834
  		.procname	= "exception-trace",
  		.data		= &show_unhandled_signals,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec
  	},
  #endif
b2be84df9   Masami Hiramatsu   kprobes: Jump opt...
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
  #if defined(CONFIG_OPTPROBES)
  	{
  		.procname	= "kprobes-optimization",
  		.data		= &sysctl_kprobes_optimization,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= proc_kprobes_optimization_handler,
  		.extra1		= &zero,
  		.extra2		= &one,
  	},
  #endif
6fce56ec9   Eric W. Biederman   sysctl: Remove re...
1846
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1847
  };
d8217f076   Eric W. Biederman   sysctl core: Stop...
1848
  static struct ctl_table dev_table[] = {
6fce56ec9   Eric W. Biederman   sysctl: Remove re...
1849
  	{ }
0eeca2830   Robert Love   [PATCH] inotify
1850
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1851

de4e83bd6   Eric W. Biederman   sysctl: Register ...
1852
  int __init sysctl_init(void)
d912b0cc1   Eric W. Biederman   [PATCH] sysctl: a...
1853
  {
fd4b616b0   Steven Rostedt   sysctl: suppress ...
1854
1855
1856
1857
  	struct ctl_table_header *hdr;
  
  	hdr = register_sysctl_table(sysctl_base_table);
  	kmemleak_not_leak(hdr);
d912b0cc1   Eric W. Biederman   [PATCH] sysctl: a...
1858
1859
  	return 0;
  }
b89a81712   Eric W. Biederman   [PATCH] sysctl: A...
1860
  #endif /* CONFIG_SYSCTL */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1861
1862
1863
  /*
   * /proc/sys support
   */
b89a81712   Eric W. Biederman   [PATCH] sysctl: A...
1864
  #ifdef CONFIG_PROC_SYSCTL
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1865

f88083005   Kees Cook   sysctl: clean up ...
1866
1867
  static int _proc_do_string(char *data, int maxlen, int write,
  			   char __user *buffer,
b1ba4ddde   Adrian Bunk   [PATCH] make kern...
1868
  			   size_t *lenp, loff_t *ppos)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1869
1870
1871
1872
  {
  	size_t len;
  	char __user *p;
  	char c;
8d0608771   Oleg Nesterov   [PATCH] _proc_do_...
1873
1874
  
  	if (!data || !maxlen || !*lenp) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1875
1876
1877
  		*lenp = 0;
  		return 0;
  	}
8d0608771   Oleg Nesterov   [PATCH] _proc_do_...
1878

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1879
  	if (write) {
f4aacea2f   Kees Cook   sysctl: allow for...
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
  		if (sysctl_writes_strict == SYSCTL_WRITES_STRICT) {
  			/* Only continue writes not past the end of buffer. */
  			len = strlen(data);
  			if (len > maxlen - 1)
  				len = maxlen - 1;
  
  			if (*ppos > len)
  				return 0;
  			len = *ppos;
  		} else {
  			/* Start writing from beginning of buffer. */
  			len = 0;
  		}
2ca9bb456   Kees Cook   sysctl: refactor ...
1893
  		*ppos += *lenp;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1894
  		p = buffer;
2ca9bb456   Kees Cook   sysctl: refactor ...
1895
  		while ((p - buffer) < *lenp && len < maxlen - 1) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1896
1897
1898
1899
1900
  			if (get_user(c, p++))
  				return -EFAULT;
  			if (c == 0 || c == '
  ')
  				break;
2ca9bb456   Kees Cook   sysctl: refactor ...
1901
  			data[len++] = c;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1902
  		}
f88083005   Kees Cook   sysctl: clean up ...
1903
  		data[len] = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1904
  	} else {
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1905
1906
1907
  		len = strlen(data);
  		if (len > maxlen)
  			len = maxlen;
8d0608771   Oleg Nesterov   [PATCH] _proc_do_...
1908
1909
1910
1911
1912
1913
1914
1915
  
  		if (*ppos > len) {
  			*lenp = 0;
  			return 0;
  		}
  
  		data += *ppos;
  		len  -= *ppos;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1916
1917
1918
  		if (len > *lenp)
  			len = *lenp;
  		if (len)
f88083005   Kees Cook   sysctl: clean up ...
1919
  			if (copy_to_user(buffer, data, len))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1920
1921
  				return -EFAULT;
  		if (len < *lenp) {
f88083005   Kees Cook   sysctl: clean up ...
1922
1923
  			if (put_user('
  ', buffer + len))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1924
1925
1926
1927
1928
1929
1930
1931
  				return -EFAULT;
  			len++;
  		}
  		*lenp = len;
  		*ppos += len;
  	}
  	return 0;
  }
f4aacea2f   Kees Cook   sysctl: allow for...
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
  static void warn_sysctl_write(struct ctl_table *table)
  {
  	pr_warn_once("%s wrote to %s when file position was not 0!
  "
  		"This will not be supported in the future. To silence this
  "
  		"warning, set kernel.sysctl_writes_strict = -1
  ",
  		current->comm, table->procname);
  }
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1942
1943
1944
1945
  /**
   * proc_dostring - read a string sysctl
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * Reads/writes a string from/to the user buffer. If the kernel
   * buffer provided is not large enough to hold the string, the
   * string is truncated. The copied string is %NULL-terminated.
   * If the string is being read by the user process, it is copied
   * and a newline '
  ' is added. It is truncated if the buffer is
   * not large enough.
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
1960
  int proc_dostring(struct ctl_table *table, int write,
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1961
1962
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
f4aacea2f   Kees Cook   sysctl: allow for...
1963
1964
  	if (write && *ppos && sysctl_writes_strict == SYSCTL_WRITES_WARN)
  		warn_sysctl_write(table);
f88083005   Kees Cook   sysctl: clean up ...
1965
1966
  	return _proc_do_string((char *)(table->data), table->maxlen, write,
  			       (char __user *)buffer, lenp, ppos);
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1967
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
1968
1969
1970
1971
1972
1973
1974
1975
  static size_t proc_skip_spaces(char **buf)
  {
  	size_t ret;
  	char *tmp = skip_spaces(*buf);
  	ret = tmp - *buf;
  	*buf = tmp;
  	return ret;
  }
9f977fb7a   Octavian Purdila   sysctl: add proc_...
1976
1977
1978
1979
1980
1981
1982
1983
1984
  static void proc_skip_char(char **buf, size_t *size, const char v)
  {
  	while (*size) {
  		if (**buf != v)
  			break;
  		(*size)--;
  		(*buf)++;
  	}
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
1985
1986
  #define TMPBUFLEN 22
  /**
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
1987
   * proc_get_long - reads an ASCII formatted integer from a user buffer
00b7c3395   Amerigo Wang   sysctl: refactor ...
1988
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
1989
1990
1991
1992
1993
1994
1995
   * @buf: a kernel buffer
   * @size: size of the kernel buffer
   * @val: this is where the number will be stored
   * @neg: set to %TRUE if number is negative
   * @perm_tr: a vector which contains the allowed trailers
   * @perm_tr_len: size of the perm_tr vector
   * @tr: pointer to store the trailer character
00b7c3395   Amerigo Wang   sysctl: refactor ...
1996
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
1997
1998
1999
2000
   * In case of success %0 is returned and @buf and @size are updated with
   * the amount of bytes read. If @tr is non-NULL and a trailing
   * character exists (size is non-zero after returning from this
   * function), @tr is updated with the trailing character.
00b7c3395   Amerigo Wang   sysctl: refactor ...
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
   */
  static int proc_get_long(char **buf, size_t *size,
  			  unsigned long *val, bool *neg,
  			  const char *perm_tr, unsigned perm_tr_len, char *tr)
  {
  	int len;
  	char *p, tmp[TMPBUFLEN];
  
  	if (!*size)
  		return -EINVAL;
  
  	len = *size;
  	if (len > TMPBUFLEN - 1)
  		len = TMPBUFLEN - 1;
  
  	memcpy(tmp, *buf, len);
  
  	tmp[len] = 0;
  	p = tmp;
  	if (*p == '-' && *size > 1) {
  		*neg = true;
  		p++;
  	} else
  		*neg = false;
  	if (!isdigit(*p))
  		return -EINVAL;
  
  	*val = simple_strtoul(p, &p, 0);
  
  	len = p - tmp;
  
  	/* We don't know if the next char is whitespace thus we may accept
  	 * invalid integers (e.g. 1234...a) or two integers instead of one
  	 * (e.g. 123...1). So lets not allow such large numbers. */
  	if (len == TMPBUFLEN - 1)
  		return -EINVAL;
  
  	if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
  		return -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2040

00b7c3395   Amerigo Wang   sysctl: refactor ...
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
  	if (tr && (len < *size))
  		*tr = *p;
  
  	*buf += len;
  	*size -= len;
  
  	return 0;
  }
  
  /**
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
2051
   * proc_put_long - converts an integer to a decimal ASCII formatted string
00b7c3395   Amerigo Wang   sysctl: refactor ...
2052
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
2053
2054
2055
2056
   * @buf: the user buffer
   * @size: the size of the user buffer
   * @val: the integer to be converted
   * @neg: sign of the number, %TRUE for negative
00b7c3395   Amerigo Wang   sysctl: refactor ...
2057
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
2058
2059
   * In case of success %0 is returned and @buf and @size are updated with
   * the amount of bytes written.
00b7c3395   Amerigo Wang   sysctl: refactor ...
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
   */
  static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
  			  bool neg)
  {
  	int len;
  	char tmp[TMPBUFLEN], *p = tmp;
  
  	sprintf(p, "%s%lu", neg ? "-" : "", val);
  	len = strlen(tmp);
  	if (len > *size)
  		len = *size;
  	if (copy_to_user(*buf, tmp, len))
  		return -EFAULT;
  	*size -= len;
  	*buf += len;
  	return 0;
  }
  #undef TMPBUFLEN
  
  static int proc_put_char(void __user **buf, size_t *size, char c)
  {
  	if (*size) {
  		char __user **buffer = (char __user **)buf;
  		if (put_user(c, *buffer))
  			return -EFAULT;
  		(*size)--, (*buffer)++;
  		*buf = *buffer;
  	}
  	return 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2090

00b7c3395   Amerigo Wang   sysctl: refactor ...
2091
  static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2092
2093
2094
2095
  				 int *valp,
  				 int write, void *data)
  {
  	if (write) {
230633d10   Heinrich Schuchardt   kernel/sysctl.c: ...
2096
2097
2098
2099
2100
2101
2102
2103
2104
  		if (*negp) {
  			if (*lvalp > (unsigned long) INT_MAX + 1)
  				return -EINVAL;
  			*valp = -*lvalp;
  		} else {
  			if (*lvalp > (unsigned long) INT_MAX)
  				return -EINVAL;
  			*valp = *lvalp;
  		}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2105
2106
2107
  	} else {
  		int val = *valp;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2108
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2109
  			*lvalp = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2110
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2111
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2112
2113
2114
2115
2116
  			*lvalp = (unsigned long)val;
  		}
  	}
  	return 0;
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2117
2118
  static const char proc_wspace_sep[] = { ' ', '\t', '
  ' };
d8217f076   Eric W. Biederman   sysctl core: Stop...
2119
  static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2120
  		  int write, void __user *buffer,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2121
  		  size_t *lenp, loff_t *ppos,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2122
  		  int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2123
2124
2125
  			      int write, void *data),
  		  void *data)
  {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2126
  	int *i, vleft, first = 1, err = 0;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2127
  	size_t left;
70f6cbb6f   Al Viro   kernel/*: switch ...
2128
  	char *kbuf = NULL, *p;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2129
  	
00b7c3395   Amerigo Wang   sysctl: refactor ...
2130
  	if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2131
2132
2133
2134
  		*lenp = 0;
  		return 0;
  	}
  	
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2135
  	i = (int *) tbl_data;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2136
2137
2138
2139
2140
  	vleft = table->maxlen / sizeof(*i);
  	left = *lenp;
  
  	if (!conv)
  		conv = do_proc_dointvec_conv;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2141
  	if (write) {
f4aacea2f   Kees Cook   sysctl: allow for...
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
  		if (*ppos) {
  			switch (sysctl_writes_strict) {
  			case SYSCTL_WRITES_STRICT:
  				goto out;
  			case SYSCTL_WRITES_WARN:
  				warn_sysctl_write(table);
  				break;
  			default:
  				break;
  			}
  		}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2153
2154
  		if (left > PAGE_SIZE - 1)
  			left = PAGE_SIZE - 1;
70f6cbb6f   Al Viro   kernel/*: switch ...
2155
2156
2157
  		p = kbuf = memdup_user_nul(buffer, left);
  		if (IS_ERR(kbuf))
  			return PTR_ERR(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2158
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2159
  	for (; left && vleft--; i++, first=0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2160
2161
  		unsigned long lval;
  		bool neg;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2162

00b7c3395   Amerigo Wang   sysctl: refactor ...
2163
  		if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2164
  			left -= proc_skip_spaces(&p);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2165

563b04671   J. R. Okajima   proc_dointvec: wr...
2166
2167
  			if (!left)
  				break;
70f6cbb6f   Al Viro   kernel/*: switch ...
2168
  			err = proc_get_long(&p, &left, &lval, &neg,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2169
2170
2171
  					     proc_wspace_sep,
  					     sizeof(proc_wspace_sep), NULL);
  			if (err)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2172
  				break;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2173
2174
  			if (conv(&neg, &lval, i, 1, data)) {
  				err = -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2175
  				break;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2176
  			}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2177
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2178
2179
2180
2181
  			if (conv(&neg, &lval, i, 0, data)) {
  				err = -EINVAL;
  				break;
  			}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2182
  			if (!first)
00b7c3395   Amerigo Wang   sysctl: refactor ...
2183
2184
2185
2186
2187
  				err = proc_put_char(&buffer, &left, '\t');
  			if (err)
  				break;
  			err = proc_put_long(&buffer, &left, lval, neg);
  			if (err)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2188
  				break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2189
2190
  		}
  	}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2191
2192
2193
  	if (!write && !first && left && !err)
  		err = proc_put_char(&buffer, &left, '
  ');
563b04671   J. R. Okajima   proc_dointvec: wr...
2194
  	if (write && !err && left)
70f6cbb6f   Al Viro   kernel/*: switch ...
2195
  		left -= proc_skip_spaces(&p);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2196
  	if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2197
  		kfree(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2198
2199
  		if (first)
  			return err ? : -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2200
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2201
  	*lenp -= left;
f4aacea2f   Kees Cook   sysctl: allow for...
2202
  out:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2203
  	*ppos += *lenp;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2204
  	return err;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2205
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2206
  static int do_proc_dointvec(struct ctl_table *table, int write,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2207
  		  void __user *buffer, size_t *lenp, loff_t *ppos,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2208
  		  int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2209
2210
2211
  			      int write, void *data),
  		  void *data)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2212
  	return __do_proc_dointvec(table->data, table, write,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2213
2214
  			buffer, lenp, ppos, conv, data);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2215
2216
2217
2218
  /**
   * proc_dointvec - read a vector of integers
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2219
2220
2221
2222
2223
2224
2225
2226
2227
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
   * values from/to the user buffer, treated as an ASCII string. 
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2228
  int proc_dointvec(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2229
2230
  		     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2231
      return do_proc_dointvec(table,write,buffer,lenp,ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2232
2233
  		    	    NULL,NULL);
  }
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2234
  /*
25ddbb18a   Andi Kleen   Make the taint fl...
2235
2236
   * Taint values can only be increased
   * This means we can safely use a temporary.
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2237
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2238
  static int proc_taint(struct ctl_table *table, int write,
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2239
2240
  			       void __user *buffer, size_t *lenp, loff_t *ppos)
  {
25ddbb18a   Andi Kleen   Make the taint fl...
2241
2242
2243
  	struct ctl_table t;
  	unsigned long tmptaint = get_taint();
  	int err;
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2244

91fcd412e   Bastian Blank   Allow reading tai...
2245
  	if (write && !capable(CAP_SYS_ADMIN))
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2246
  		return -EPERM;
25ddbb18a   Andi Kleen   Make the taint fl...
2247
2248
  	t = *table;
  	t.data = &tmptaint;
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2249
  	err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
25ddbb18a   Andi Kleen   Make the taint fl...
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
  	if (err < 0)
  		return err;
  
  	if (write) {
  		/*
  		 * Poor man's atomic or. Not worth adding a primitive
  		 * to everyone's atomic.h for this
  		 */
  		int i;
  		for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
  			if ((tmptaint >> i) & 1)
373d4d099   Rusty Russell   taint: add explic...
2261
  				add_taint(i, LOCKDEP_STILL_OK);
25ddbb18a   Andi Kleen   Make the taint fl...
2262
2263
2264
2265
  		}
  	}
  
  	return err;
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2266
  }
bfdc0b497   Richard Weinberger   sysctl: restrict ...
2267
  #ifdef CONFIG_PRINTK
620f6e8e8   Kees Cook   sysctl: fix write...
2268
  static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
bfdc0b497   Richard Weinberger   sysctl: restrict ...
2269
2270
2271
2272
2273
2274
2275
2276
  				void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	if (write && !capable(CAP_SYS_ADMIN))
  		return -EPERM;
  
  	return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  }
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2277
2278
2279
2280
  struct do_proc_dointvec_minmax_conv_param {
  	int *min;
  	int *max;
  };
00b7c3395   Amerigo Wang   sysctl: refactor ...
2281
2282
  static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
  					int *valp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
  					int write, void *data)
  {
  	struct do_proc_dointvec_minmax_conv_param *param = data;
  	if (write) {
  		int val = *negp ? -*lvalp : *lvalp;
  		if ((param->min && *param->min > val) ||
  		    (param->max && *param->max < val))
  			return -EINVAL;
  		*valp = val;
  	} else {
  		int val = *valp;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2295
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2296
  			*lvalp = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2297
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2298
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
  			*lvalp = (unsigned long)val;
  		}
  	}
  	return 0;
  }
  
  /**
   * proc_dointvec_minmax - read a vector of integers with min/max values
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
   * values from/to the user buffer, treated as an ASCII string.
   *
   * This routine will ensure the values are within the range specified by
   * table->extra1 (min) and table->extra2 (max).
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2321
  int proc_dointvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2322
2323
2324
2325
2326
2327
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	struct do_proc_dointvec_minmax_conv_param param = {
  		.min = (int *) table->extra1,
  		.max = (int *) table->extra2,
  	};
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2328
  	return do_proc_dointvec(table, write, buffer, lenp, ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2329
2330
  				do_proc_dointvec_minmax_conv, &param);
  }
54b501992   Kees Cook   coredump: warn ab...
2331
2332
  static void validate_coredump_safety(void)
  {
046d662f4   Alex Kelly   coredump: make co...
2333
  #ifdef CONFIG_COREDUMP
e579d2c25   Kees Cook   coredump: remove ...
2334
  	if (suid_dumpable == SUID_DUMP_ROOT &&
54b501992   Kees Cook   coredump: warn ab...
2335
2336
2337
2338
2339
2340
  	    core_pattern[0] != '/' && core_pattern[0] != '|') {
  		printk(KERN_WARNING "Unsafe core_pattern used with "\
  			"suid_dumpable=2. Pipe handler or fully qualified "\
  			"core dump path required.
  ");
  	}
046d662f4   Alex Kelly   coredump: make co...
2341
  #endif
54b501992   Kees Cook   coredump: warn ab...
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
  }
  
  static int proc_dointvec_minmax_coredump(struct ctl_table *table, int write,
  		void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
  	if (!error)
  		validate_coredump_safety();
  	return error;
  }
046d662f4   Alex Kelly   coredump: make co...
2352
  #ifdef CONFIG_COREDUMP
54b501992   Kees Cook   coredump: warn ab...
2353
2354
2355
2356
2357
2358
2359
2360
  static int proc_dostring_coredump(struct ctl_table *table, int write,
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	int error = proc_dostring(table, write, buffer, lenp, ppos);
  	if (!error)
  		validate_coredump_safety();
  	return error;
  }
046d662f4   Alex Kelly   coredump: make co...
2361
  #endif
54b501992   Kees Cook   coredump: warn ab...
2362

d8217f076   Eric W. Biederman   sysctl core: Stop...
2363
  static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2364
2365
2366
2367
2368
  				     void __user *buffer,
  				     size_t *lenp, loff_t *ppos,
  				     unsigned long convmul,
  				     unsigned long convdiv)
  {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2369
2370
  	unsigned long *i, *min, *max;
  	int vleft, first = 1, err = 0;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2371
  	size_t left;
70f6cbb6f   Al Viro   kernel/*: switch ...
2372
  	char *kbuf = NULL, *p;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2373
2374
  
  	if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2375
2376
2377
  		*lenp = 0;
  		return 0;
  	}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2378

fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2379
  	i = (unsigned long *) data;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2380
2381
2382
2383
  	min = (unsigned long *) table->extra1;
  	max = (unsigned long *) table->extra2;
  	vleft = table->maxlen / sizeof(unsigned long);
  	left = *lenp;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2384
2385
  
  	if (write) {
f4aacea2f   Kees Cook   sysctl: allow for...
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
  		if (*ppos) {
  			switch (sysctl_writes_strict) {
  			case SYSCTL_WRITES_STRICT:
  				goto out;
  			case SYSCTL_WRITES_WARN:
  				warn_sysctl_write(table);
  				break;
  			default:
  				break;
  			}
  		}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2397
2398
  		if (left > PAGE_SIZE - 1)
  			left = PAGE_SIZE - 1;
70f6cbb6f   Al Viro   kernel/*: switch ...
2399
2400
2401
  		p = kbuf = memdup_user_nul(buffer, left);
  		if (IS_ERR(kbuf))
  			return PTR_ERR(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2402
  	}
27b3d80a7   Eric Dumazet   sysctl: fix min/m...
2403
  	for (; left && vleft--; i++, first = 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2404
  		unsigned long val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2405
  		if (write) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2406
  			bool neg;
70f6cbb6f   Al Viro   kernel/*: switch ...
2407
  			left -= proc_skip_spaces(&p);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2408

70f6cbb6f   Al Viro   kernel/*: switch ...
2409
  			err = proc_get_long(&p, &left, &val, &neg,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2410
2411
2412
  					     proc_wspace_sep,
  					     sizeof(proc_wspace_sep), NULL);
  			if (err)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2413
2414
  				break;
  			if (neg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2415
2416
2417
2418
2419
  				continue;
  			if ((min && val < *min) || (max && val > *max))
  				continue;
  			*i = val;
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2420
  			val = convdiv * (*i) / convmul;
7833819d2   Chen Gang   kernel/sysctl.c: ...
2421
  			if (!first) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2422
  				err = proc_put_char(&buffer, &left, '\t');
7833819d2   Chen Gang   kernel/sysctl.c: ...
2423
2424
2425
  				if (err)
  					break;
  			}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2426
2427
2428
  			err = proc_put_long(&buffer, &left, val, false);
  			if (err)
  				break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2429
2430
  		}
  	}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2431
2432
2433
2434
  	if (!write && !first && left && !err)
  		err = proc_put_char(&buffer, &left, '
  ');
  	if (write && !err)
70f6cbb6f   Al Viro   kernel/*: switch ...
2435
  		left -= proc_skip_spaces(&p);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2436
  	if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2437
  		kfree(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2438
2439
  		if (first)
  			return err ? : -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2440
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2441
  	*lenp -= left;
f4aacea2f   Kees Cook   sysctl: allow for...
2442
  out:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2443
  	*ppos += *lenp;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2444
  	return err;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2445
  }
d8217f076   Eric W. Biederman   sysctl core: Stop...
2446
  static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2447
2448
2449
2450
2451
2452
  				     void __user *buffer,
  				     size_t *lenp, loff_t *ppos,
  				     unsigned long convmul,
  				     unsigned long convdiv)
  {
  	return __do_proc_doulongvec_minmax(table->data, table, write,
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2453
  			buffer, lenp, ppos, convmul, convdiv);
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2454
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2455
2456
2457
2458
  /**
   * proc_doulongvec_minmax - read a vector of long integers with min/max values
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
   * values from/to the user buffer, treated as an ASCII string.
   *
   * This routine will ensure the values are within the range specified by
   * table->extra1 (min) and table->extra2 (max).
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2471
  int proc_doulongvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2472
2473
  			   void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2474
      return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2475
2476
2477
2478
2479
2480
  }
  
  /**
   * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
   * values from/to the user buffer, treated as an ASCII string. The values
   * are treated as milliseconds, and converted to jiffies when they are stored.
   *
   * This routine will ensure the values are within the range specified by
   * table->extra1 (min) and table->extra2 (max).
   *
   * Returns 0 on success.
   */
d8217f076   Eric W. Biederman   sysctl core: Stop...
2494
  int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2495
2496
2497
  				      void __user *buffer,
  				      size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2498
      return do_proc_doulongvec_minmax(table, write, buffer,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2499
2500
  				     lenp, ppos, HZ, 1000l);
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2501
  static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2502
2503
2504
2505
  					 int *valp,
  					 int write, void *data)
  {
  	if (write) {
cba9f33d1   Bart Samwel   [PATCH] Range che...
2506
2507
  		if (*lvalp > LONG_MAX / HZ)
  			return 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2508
2509
2510
2511
2512
  		*valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  	} else {
  		int val = *valp;
  		unsigned long lval;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2513
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2514
  			lval = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2515
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2516
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2517
2518
2519
2520
2521
2522
  			lval = (unsigned long)val;
  		}
  		*lvalp = lval / HZ;
  	}
  	return 0;
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2523
  static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2524
2525
2526
2527
  						int *valp,
  						int write, void *data)
  {
  	if (write) {
cba9f33d1   Bart Samwel   [PATCH] Range che...
2528
2529
  		if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  			return 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2530
2531
2532
2533
2534
  		*valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  	} else {
  		int val = *valp;
  		unsigned long lval;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2535
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2536
  			lval = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2537
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2538
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2539
2540
2541
2542
2543
2544
  			lval = (unsigned long)val;
  		}
  		*lvalp = jiffies_to_clock_t(lval);
  	}
  	return 0;
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2545
  static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2546
2547
2548
2549
  					    int *valp,
  					    int write, void *data)
  {
  	if (write) {
d738ce8fd   Francesco Fusco   sysctl: range che...
2550
2551
2552
2553
2554
  		unsigned long jif = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
  
  		if (jif > INT_MAX)
  			return 1;
  		*valp = (int)jif;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2555
2556
2557
2558
  	} else {
  		int val = *valp;
  		unsigned long lval;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2559
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2560
  			lval = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2561
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2562
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
  			lval = (unsigned long)val;
  		}
  		*lvalp = jiffies_to_msecs(lval);
  	}
  	return 0;
  }
  
  /**
   * proc_dointvec_jiffies - read a vector of integers as seconds
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
   * values from/to the user buffer, treated as an ASCII string. 
   * The values read are assumed to be in seconds, and are converted into
   * jiffies.
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2585
  int proc_dointvec_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2586
2587
  			  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2588
      return do_proc_dointvec(table,write,buffer,lenp,ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2589
2590
2591
2592
2593
2594
2595
  		    	    do_proc_dointvec_jiffies_conv,NULL);
  }
  
  /**
   * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2596
2597
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
1e5d53314   Randy Dunlap   [PATCH] more kern...
2598
   * @ppos: pointer to the file position
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2599
2600
2601
2602
2603
2604
2605
2606
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
   * values from/to the user buffer, treated as an ASCII string. 
   * The values read are assumed to be in 1/USER_HZ seconds, and 
   * are converted into jiffies.
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2607
  int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2608
2609
  				 void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2610
      return do_proc_dointvec(table,write,buffer,lenp,ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2611
2612
2613
2614
2615
2616
2617
  		    	    do_proc_dointvec_userhz_jiffies_conv,NULL);
  }
  
  /**
   * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2618
2619
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
67be2dd1b   Martin Waitz   [PATCH] DocBook: ...
2620
2621
   * @ppos: file position
   * @ppos: the current position in the file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2622
2623
2624
2625
2626
2627
2628
2629
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
   * values from/to the user buffer, treated as an ASCII string. 
   * The values read are assumed to be in 1/1000 seconds, and 
   * are converted into jiffies.
   *
   * Returns 0 on success.
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2630
  int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2631
2632
  			     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2633
  	return do_proc_dointvec(table, write, buffer, lenp, ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2634
2635
  				do_proc_dointvec_ms_jiffies_conv, NULL);
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2636
  static int proc_do_cad_pid(struct ctl_table *table, int write,
9ec52099e   Cedric Le Goater   [PATCH] replace c...
2637
2638
2639
2640
2641
  			   void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	struct pid *new_pid;
  	pid_t tmp;
  	int r;
6c5f3e7b4   Pavel Emelyanov   Pidns: make full ...
2642
  	tmp = pid_vnr(cad_pid);
9ec52099e   Cedric Le Goater   [PATCH] replace c...
2643

8d65af789   Alexey Dobriyan   sysctl: remove "s...
2644
  	r = __do_proc_dointvec(&tmp, table, write, buffer,
9ec52099e   Cedric Le Goater   [PATCH] replace c...
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
  			       lenp, ppos, NULL, NULL);
  	if (r || !write)
  		return r;
  
  	new_pid = find_get_pid(tmp);
  	if (!new_pid)
  		return -ESRCH;
  
  	put_pid(xchg(&cad_pid, new_pid));
  	return 0;
  }
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
  /**
   * proc_do_large_bitmap - read/write from/to a large bitmap
   * @table: the sysctl table
   * @write: %TRUE if this is a write to the sysctl file
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
   * @ppos: file position
   *
   * The bitmap is stored at table->data and the bitmap length (in bits)
   * in table->maxlen.
   *
   * We use a range comma separated format (e.g. 1,3-4,10-10) so that
   * large bitmaps may be represented in a compact manner. Writing into
   * the file will clear the bitmap then update it with the given input.
   *
   * Returns 0 on success.
   */
  int proc_do_large_bitmap(struct ctl_table *table, int write,
  			 void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	int err = 0;
  	bool first = 1;
  	size_t left = *lenp;
  	unsigned long bitmap_len = table->maxlen;
122ff243f   WANG Cong   ipv4: make ip_loc...
2680
  	unsigned long *bitmap = *(unsigned long **) table->data;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2681
2682
2683
2684
  	unsigned long *tmp_bitmap = NULL;
  	char tr_a[] = { '-', ',', '
  ' }, tr_b[] = { ',', '
  ', 0 }, c;
122ff243f   WANG Cong   ipv4: make ip_loc...
2685
  	if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2686
2687
2688
2689
2690
  		*lenp = 0;
  		return 0;
  	}
  
  	if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2691
  		char *kbuf, *p;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2692
2693
2694
  
  		if (left > PAGE_SIZE - 1)
  			left = PAGE_SIZE - 1;
70f6cbb6f   Al Viro   kernel/*: switch ...
2695
2696
2697
  		p = kbuf = memdup_user_nul(buffer, left);
  		if (IS_ERR(kbuf))
  			return PTR_ERR(kbuf);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2698
2699
2700
2701
  
  		tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
  				     GFP_KERNEL);
  		if (!tmp_bitmap) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2702
  			kfree(kbuf);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2703
2704
  			return -ENOMEM;
  		}
70f6cbb6f   Al Viro   kernel/*: switch ...
2705
2706
  		proc_skip_char(&p, &left, '
  ');
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2707
2708
2709
  		while (!err && left) {
  			unsigned long val_a, val_b;
  			bool neg;
70f6cbb6f   Al Viro   kernel/*: switch ...
2710
  			err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
  					     sizeof(tr_a), &c);
  			if (err)
  				break;
  			if (val_a >= bitmap_len || neg) {
  				err = -EINVAL;
  				break;
  			}
  
  			val_b = val_a;
  			if (left) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2721
  				p++;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2722
2723
2724
2725
  				left--;
  			}
  
  			if (c == '-') {
70f6cbb6f   Al Viro   kernel/*: switch ...
2726
  				err = proc_get_long(&p, &left, &val_b,
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
  						     &neg, tr_b, sizeof(tr_b),
  						     &c);
  				if (err)
  					break;
  				if (val_b >= bitmap_len || neg ||
  				    val_a > val_b) {
  					err = -EINVAL;
  					break;
  				}
  				if (left) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2737
  					p++;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2738
2739
2740
  					left--;
  				}
  			}
5a04cca6c   Akinobu Mita   sysctl: use bitma...
2741
  			bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2742
  			first = 0;
70f6cbb6f   Al Viro   kernel/*: switch ...
2743
2744
  			proc_skip_char(&p, &left, '
  ');
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2745
  		}
70f6cbb6f   Al Viro   kernel/*: switch ...
2746
  		kfree(kbuf);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
  	} else {
  		unsigned long bit_a, bit_b = 0;
  
  		while (left) {
  			bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
  			if (bit_a >= bitmap_len)
  				break;
  			bit_b = find_next_zero_bit(bitmap, bitmap_len,
  						   bit_a + 1) - 1;
  
  			if (!first) {
  				err = proc_put_char(&buffer, &left, ',');
  				if (err)
  					break;
  			}
  			err = proc_put_long(&buffer, &left, bit_a, false);
  			if (err)
  				break;
  			if (bit_a != bit_b) {
  				err = proc_put_char(&buffer, &left, '-');
  				if (err)
  					break;
  				err = proc_put_long(&buffer, &left, bit_b, false);
  				if (err)
  					break;
  			}
  
  			first = 0; bit_b++;
  		}
  		if (!err)
  			err = proc_put_char(&buffer, &left, '
  ');
  	}
  
  	if (!err) {
  		if (write) {
  			if (*ppos)
  				bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
  			else
5a04cca6c   Akinobu Mita   sysctl: use bitma...
2786
  				bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
  		}
  		kfree(tmp_bitmap);
  		*lenp -= left;
  		*ppos += *lenp;
  		return 0;
  	} else {
  		kfree(tmp_bitmap);
  		return err;
  	}
  }
556105000   Jovi Zhang   sysctl: fix #ifde...
2797
  #else /* CONFIG_PROC_SYSCTL */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2798

8d65af789   Alexey Dobriyan   sysctl: remove "s...
2799
  int proc_dostring(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2800
2801
2802
2803
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2804
  int proc_dointvec(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2805
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2806
2807
2808
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2809
  int proc_dointvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2810
2811
2812
2813
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2814
  int proc_dointvec_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2815
2816
2817
2818
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2819
  int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2820
2821
2822
2823
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2824
  int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2825
2826
2827
2828
  			     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2829
  int proc_doulongvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2830
2831
2832
2833
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
d8217f076   Eric W. Biederman   sysctl core: Stop...
2834
  int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2835
2836
2837
2838
2839
  				      void __user *buffer,
  				      size_t *lenp, loff_t *ppos)
  {
      return -ENOSYS;
  }
556105000   Jovi Zhang   sysctl: fix #ifde...
2840
  #endif /* CONFIG_PROC_SYSCTL */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2841

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
  /*
   * No sense putting this after each symbol definition, twice,
   * exception granted :-)
   */
  EXPORT_SYMBOL(proc_dointvec);
  EXPORT_SYMBOL(proc_dointvec_jiffies);
  EXPORT_SYMBOL(proc_dointvec_minmax);
  EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
  EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
  EXPORT_SYMBOL(proc_dostring);
  EXPORT_SYMBOL(proc_doulongvec_minmax);
  EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);