Blame view

kernel/sysctl.c 67.6 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>
d29216842   Eric W. Biederman   mnt: Add a per mo...
67
  #include <linux/mount.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68
69
70
  
  #include <asm/uaccess.h>
  #include <asm/processor.h>
29cbc78b9   Andi Kleen   [PATCH] x86: Clea...
71
72
  #ifdef CONFIG_X86
  #include <asm/nmi.h>
0741f4d20   Chuck Ebbert   [PATCH] x86: add ...
73
  #include <asm/stacktrace.h>
6e7c40259   Ingo Molnar   x86: various chan...
74
  #include <asm/io.h>
29cbc78b9   Andi Kleen   [PATCH] x86: Clea...
75
  #endif
d550bbd40   David Howells   Disintegrate asm/...
76
77
78
  #ifdef CONFIG_SPARC
  #include <asm/setup.h>
  #endif
c55b7c3e8   Dave Young   sysctl extern cle...
79
80
81
  #ifdef CONFIG_BSD_PROCESS_ACCT
  #include <linux/acct.h>
  #endif
4f0e056fd   Dave Young   sysctl extern cle...
82
83
84
  #ifdef CONFIG_RT_MUTEXES
  #include <linux/rtmutex.h>
  #endif
2edf5e498   Dave Young   sysctl extern cle...
85
86
87
  #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
  #include <linux/lockdep.h>
  #endif
15485a468   Dave Young   sysctl extern cle...
88
89
90
  #ifdef CONFIG_CHR_DEV_SG
  #include <scsi/sg.h>
  #endif
29cbc78b9   Andi Kleen   [PATCH] x86: Clea...
91

58687acba   Don Zickus   lockup_detector: ...
92
  #ifdef CONFIG_LOCKUP_DETECTOR
504d7cf10   Don Zickus   nmi_watchdog: Com...
93
94
  #include <linux/nmi.h>
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
95
96
97
  #if defined(CONFIG_SYSCTL)
  
  /* External variables not in a header file. */
d6e711448   Alan Cox   [PATCH] setuid co...
98
  extern int suid_dumpable;
046d662f4   Alex Kelly   coredump: make co...
99
100
  #ifdef CONFIG_COREDUMP
  extern int core_uses_pid;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
101
  extern char core_pattern[];
a293980c2   Neil Horman   exec: let do_core...
102
  extern unsigned int core_pipe_limit;
046d662f4   Alex Kelly   coredump: make co...
103
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
  extern int pid_max;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
105
  extern int pid_max_min, pid_max_max;
8ad4b1fb8   Rohit Seth   [PATCH] Make high...
106
  extern int percpu_pagelist_fraction;
9745512ce   Arjan van de Ven   sched: latencytop...
107
  extern int latencytop_enabled;
9b80a184e   Alexey Dobriyan   fs/file: more uns...
108
  extern unsigned 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
23f78d4a0   Ingo Molnar   [PATCH] pi-futex:...
1071
1072
  #ifdef CONFIG_RT_MUTEXES
  	{
23f78d4a0   Ingo Molnar   [PATCH] pi-futex:...
1073
1074
1075
1076
  		.procname	= "max_lock_depth",
  		.data		= &max_lock_depth,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1077
  		.proc_handler	= proc_dointvec,
23f78d4a0   Ingo Molnar   [PATCH] pi-futex:...
1078
1079
  	},
  #endif
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
1080
  	{
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
1081
1082
1083
1084
  		.procname	= "poweroff_cmd",
  		.data		= &poweroff_cmd,
  		.maxlen		= POWEROFF_CMD_PATH_LEN,
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1085
  		.proc_handler	= proc_dostring,
10a0a8d4e   Jeremy Fitzhardinge   Add common orderl...
1086
  	},
0b77f5bfb   David Howells   keys: make the ke...
1087
1088
  #ifdef CONFIG_KEYS
  	{
0b77f5bfb   David Howells   keys: make the ke...
1089
1090
1091
1092
1093
  		.procname	= "keys",
  		.mode		= 0555,
  		.child		= key_sysctls,
  	},
  #endif
cdd6c482c   Ingo Molnar   perf: Do the big ...
1094
  #ifdef CONFIG_PERF_EVENTS
aa4a22187   Vince Weaver   perf: Comment /pr...
1095
1096
1097
1098
1099
1100
  	/*
  	 * 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...
1101
  	{
cdd6c482c   Ingo Molnar   perf: Do the big ...
1102
1103
1104
  		.procname	= "perf_event_paranoid",
  		.data		= &sysctl_perf_event_paranoid,
  		.maxlen		= sizeof(sysctl_perf_event_paranoid),
1ccd15497   Peter Zijlstra   perf_counter: sys...
1105
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1106
  		.proc_handler	= proc_dointvec,
1ccd15497   Peter Zijlstra   perf_counter: sys...
1107
  	},
c5078f78b   Peter Zijlstra   perf_counter: pro...
1108
  	{
cdd6c482c   Ingo Molnar   perf: Do the big ...
1109
1110
1111
  		.procname	= "perf_event_mlock_kb",
  		.data		= &sysctl_perf_event_mlock,
  		.maxlen		= sizeof(sysctl_perf_event_mlock),
c5078f78b   Peter Zijlstra   perf_counter: pro...
1112
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1113
  		.proc_handler	= proc_dointvec,
c5078f78b   Peter Zijlstra   perf_counter: pro...
1114
  	},
a78ac3258   Peter Zijlstra   perf_counter: Gen...
1115
  	{
cdd6c482c   Ingo Molnar   perf: Do the big ...
1116
1117
1118
  		.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...
1119
  		.mode		= 0644,
163ec4354   Peter Zijlstra   perf: Optimize th...
1120
  		.proc_handler	= perf_proc_update_handler,
723478c8a   Knut Petersen   perf: Enforce 1 a...
1121
  		.extra1		= &one,
a78ac3258   Peter Zijlstra   perf_counter: Gen...
1122
  	},
14c63f17b   Dave Hansen   perf: Drop sample...
1123
1124
1125
1126
1127
1128
1129
1130
1131
  	{
  		.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 ...
1132
1133
  	{
  		.procname	= "perf_event_max_stack",
a831100ae   Arnaldo Carvalho de Melo   perf core: Genera...
1134
  		.data		= &sysctl_perf_event_max_stack,
c5dfd78eb   Arnaldo Carvalho de Melo   perf core: Allow ...
1135
1136
1137
1138
1139
1140
  		.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...
1141
1142
1143
1144
1145
1146
1147
1148
1149
  	{
  		.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...
1150
  #endif
dfec072ec   Vegard Nossum   kmemcheck: add th...
1151
1152
  #ifdef CONFIG_KMEMCHECK
  	{
dfec072ec   Vegard Nossum   kmemcheck: add th...
1153
1154
1155
1156
  		.procname	= "kmemcheck",
  		.data		= &kmemcheck_enabled,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1157
  		.proc_handler	= proc_dointvec,
dfec072ec   Vegard Nossum   kmemcheck: add th...
1158
1159
  	},
  #endif
9e3961a09   Prarit Bhargava   kernel: add panic...
1160
1161
1162
1163
1164
1165
1166
1167
1168
  	{
  		.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...
1169
1170
1171
1172
1173
1174
1175
1176
1177
  #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...
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
  #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...
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
  #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...
1201
  	{ }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1202
  };
d8217f076   Eric W. Biederman   sysctl core: Stop...
1203
  static struct ctl_table vm_table[] = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1204
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1205
1206
1207
1208
  		.procname	= "overcommit_memory",
  		.data		= &sysctl_overcommit_memory,
  		.maxlen		= sizeof(sysctl_overcommit_memory),
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1209
1210
1211
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &two,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1212
1213
  	},
  	{
fadd8fbd1   KAMEZAWA Hiroyuki   [PATCH] support f...
1214
1215
1216
1217
  		.procname	= "panic_on_oom",
  		.data		= &sysctl_panic_on_oom,
  		.maxlen		= sizeof(sysctl_panic_on_oom),
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1218
1219
1220
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
  		.extra2		= &two,
fadd8fbd1   KAMEZAWA Hiroyuki   [PATCH] support f...
1221
1222
  	},
  	{
fe071d7e8   David Rientjes   oom: add oom_kill...
1223
1224
1225
1226
  		.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...
1227
  		.proc_handler	= proc_dointvec,
fe071d7e8   David Rientjes   oom: add oom_kill...
1228
1229
  	},
  	{
fef1bdd68   David Rientjes   oom: add sysctl t...
1230
1231
1232
1233
  		.procname	= "oom_dump_tasks",
  		.data		= &sysctl_oom_dump_tasks,
  		.maxlen		= sizeof(sysctl_oom_dump_tasks),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1234
  		.proc_handler	= proc_dointvec,
fef1bdd68   David Rientjes   oom: add sysctl t...
1235
1236
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1237
1238
1239
1240
  		.procname	= "overcommit_ratio",
  		.data		= &sysctl_overcommit_ratio,
  		.maxlen		= sizeof(sysctl_overcommit_ratio),
  		.mode		= 0644,
49f0ce5f9   Jerome Marchand   mm: add overcommi...
1241
1242
1243
1244
1245
1246
1247
1248
  		.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
1249
1250
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1251
1252
1253
1254
  		.procname	= "page-cluster", 
  		.data		= &page_cluster,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1255
1256
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1257
1258
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1259
1260
1261
1262
  		.procname	= "dirty_background_ratio",
  		.data		= &dirty_background_ratio,
  		.maxlen		= sizeof(dirty_background_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1263
  		.proc_handler	= dirty_background_ratio_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1264
1265
1266
1267
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
  	{
2da02997e   David Rientjes   mm: add dirty_bac...
1268
1269
1270
1271
  		.procname	= "dirty_background_bytes",
  		.data		= &dirty_background_bytes,
  		.maxlen		= sizeof(dirty_background_bytes),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1272
  		.proc_handler	= dirty_background_bytes_handler,
fc3501d41   Sven Wegener   mm: fix dirty_byt...
1273
  		.extra1		= &one_ul,
2da02997e   David Rientjes   mm: add dirty_bac...
1274
1275
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1276
1277
1278
1279
  		.procname	= "dirty_ratio",
  		.data		= &vm_dirty_ratio,
  		.maxlen		= sizeof(vm_dirty_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1280
  		.proc_handler	= dirty_ratio_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1281
1282
1283
1284
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
  	{
2da02997e   David Rientjes   mm: add dirty_bac...
1285
1286
1287
1288
  		.procname	= "dirty_bytes",
  		.data		= &vm_dirty_bytes,
  		.maxlen		= sizeof(vm_dirty_bytes),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1289
  		.proc_handler	= dirty_bytes_handler,
9e4a5bda8   Andrea Righi   mm: prevent divid...
1290
  		.extra1		= &dirty_bytes_min,
2da02997e   David Rientjes   mm: add dirty_bac...
1291
1292
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1293
  		.procname	= "dirty_writeback_centisecs",
f6ef94381   Bart Samwel   [PATCH] Represent...
1294
1295
  		.data		= &dirty_writeback_interval,
  		.maxlen		= sizeof(dirty_writeback_interval),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1296
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1297
  		.proc_handler	= dirty_writeback_centisecs_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1298
1299
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1300
  		.procname	= "dirty_expire_centisecs",
f6ef94381   Bart Samwel   [PATCH] Represent...
1301
1302
  		.data		= &dirty_expire_interval,
  		.maxlen		= sizeof(dirty_expire_interval),
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1303
  		.mode		= 0644,
cb16e95fa   Petr Holasek   sysctl: add some ...
1304
1305
  		.proc_handler	= proc_dointvec_minmax,
  		.extra1		= &zero,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1306
1307
  	},
  	{
1efff914a   Theodore Ts'o   fs: add dirtytime...
1308
1309
1310
1311
1312
1313
1314
1315
  		.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...
1316
1317
1318
  		.procname       = "nr_pdflush_threads",
  		.mode           = 0444 /* read-only */,
  		.proc_handler   = pdflush_proc_obsolete,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1319
1320
  	},
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1321
1322
1323
1324
  		.procname	= "swappiness",
  		.data		= &vm_swappiness,
  		.maxlen		= sizeof(vm_swappiness),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1325
  		.proc_handler	= proc_dointvec_minmax,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1326
1327
1328
1329
  		.extra1		= &zero,
  		.extra2		= &one_hundred,
  	},
  #ifdef CONFIG_HUGETLB_PAGE
06808b082   Lee Schermerhorn   hugetlb: derive h...
1330
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1331
  		.procname	= "nr_hugepages",
e5ff21594   Andi Kleen   hugetlb: multiple...
1332
  		.data		= NULL,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1333
1334
  		.maxlen		= sizeof(unsigned long),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1335
  		.proc_handler	= hugetlb_sysctl_handler,
06808b082   Lee Schermerhorn   hugetlb: derive h...
1336
1337
1338
1339
1340
1341
1342
1343
  	},
  #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...
1344
1345
  	},
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1346
  	 {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1347
1348
1349
1350
  		.procname	= "hugetlb_shm_group",
  		.data		= &sysctl_hugetlb_shm_group,
  		.maxlen		= sizeof(gid_t),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1351
  		.proc_handler	= proc_dointvec,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1352
  	 },
396faf030   Mel Gorman   Allow huge page a...
1353
  	 {
396faf030   Mel Gorman   Allow huge page a...
1354
1355
1356
1357
  		.procname	= "hugepages_treat_as_movable",
  		.data		= &hugepages_treat_as_movable,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
86cdb465c   Naoya Horiguchi   mm: prepare to re...
1358
  		.proc_handler	= proc_dointvec,
396faf030   Mel Gorman   Allow huge page a...
1359
  	},
54f9f80d6   Adam Litke   hugetlb: Add huge...
1360
  	{
d1c3fb1f8   Nishanth Aravamudan   hugetlb: introduc...
1361
  		.procname	= "nr_overcommit_hugepages",
e5ff21594   Andi Kleen   hugetlb: multiple...
1362
1363
  		.data		= NULL,
  		.maxlen		= sizeof(unsigned long),
d1c3fb1f8   Nishanth Aravamudan   hugetlb: introduc...
1364
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1365
  		.proc_handler	= hugetlb_overcommit_handler,
d1c3fb1f8   Nishanth Aravamudan   hugetlb: introduc...
1366
  	},
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1367
1368
  #endif
  	{
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1369
1370
1371
1372
  		.procname	= "lowmem_reserve_ratio",
  		.data		= &sysctl_lowmem_reserve_ratio,
  		.maxlen		= sizeof(sysctl_lowmem_reserve_ratio),
  		.mode		= 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
1373
  		.proc_handler	= lowmem_reserve_ratio_sysctl_handler,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1374
1375
  	},
  	{
9d0243bca   Andrew Morton   [PATCH] drop-page...
1376
1377
1378
1379
1380
  		.procname	= "drop_caches",
  		.data		= &sysctl_drop_caches,
  		.maxlen		= sizeof(int),
  		.mode		= 0644,
  		.proc_handler	= drop_caches_sysctl_handler,
cb16e95fa   Petr Holasek   sysctl: add some ...
1381
  		.extra1		= &one,
5509a5d27   Dave Hansen   drop_caches: add ...
1382
  		.extra2		= &four,
9d0243bca   Andrew Morton   [PATCH] drop-page...
1383
  	},
76ab0f530   Mel Gorman   mm: compaction: a...
1384
1385
1386
1387
1388
1389
1390
1391
  #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...
1392
1393
1394
1395
1396
1397
1398
1399
1400
  	{
  		.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...
1401
1402
1403
1404
1405
1406
1407
1408
1409
  	{
  		.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...
1410

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

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

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

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1878
  	if (write) {
f4aacea2f   Kees Cook   sysctl: allow for...
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
  		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 ...
1892
  		*ppos += *lenp;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1893
  		p = buffer;
2ca9bb456   Kees Cook   sysctl: refactor ...
1894
  		while ((p - buffer) < *lenp && len < maxlen - 1) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1895
1896
1897
1898
1899
  			if (get_user(c, p++))
  				return -EFAULT;
  			if (c == 0 || c == '
  ')
  				break;
2ca9bb456   Kees Cook   sysctl: refactor ...
1900
  			data[len++] = c;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1901
  		}
f88083005   Kees Cook   sysctl: clean up ...
1902
  		data[len] = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1903
  	} else {
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1904
1905
1906
  		len = strlen(data);
  		if (len > maxlen)
  			len = maxlen;
8d0608771   Oleg Nesterov   [PATCH] _proc_do_...
1907
1908
1909
1910
1911
1912
1913
1914
  
  		if (*ppos > len) {
  			*lenp = 0;
  			return 0;
  		}
  
  		data += *ppos;
  		len  -= *ppos;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1915
1916
1917
  		if (len > *lenp)
  			len = *lenp;
  		if (len)
f88083005   Kees Cook   sysctl: clean up ...
1918
  			if (copy_to_user(buffer, data, len))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1919
1920
  				return -EFAULT;
  		if (len < *lenp) {
f88083005   Kees Cook   sysctl: clean up ...
1921
1922
  			if (put_user('
  ', buffer + len))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1923
1924
1925
1926
1927
1928
1929
1930
  				return -EFAULT;
  			len++;
  		}
  		*lenp = len;
  		*ppos += len;
  	}
  	return 0;
  }
f4aacea2f   Kees Cook   sysctl: allow for...
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
  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...
1941
1942
1943
1944
  /**
   * 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...
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
   * @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...
1959
  int proc_dostring(struct ctl_table *table, int write,
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1960
1961
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
f4aacea2f   Kees Cook   sysctl: allow for...
1962
1963
  	if (write && *ppos && sysctl_writes_strict == SYSCTL_WRITES_WARN)
  		warn_sysctl_write(table);
f88083005   Kees Cook   sysctl: clean up ...
1964
1965
  	return _proc_do_string((char *)(table->data), table->maxlen, write,
  			       (char __user *)buffer, lenp, ppos);
f5dd3d6fa   Sam Vilain   [PATCH] proc: sys...
1966
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
1967
1968
1969
1970
1971
1972
1973
1974
  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_...
1975
1976
1977
1978
1979
1980
1981
1982
1983
  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 ...
1984
1985
  #define TMPBUFLEN 22
  /**
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
1986
   * proc_get_long - reads an ASCII formatted integer from a user buffer
00b7c3395   Amerigo Wang   sysctl: refactor ...
1987
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
1988
1989
1990
1991
1992
1993
1994
   * @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 ...
1995
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
1996
1997
1998
1999
   * 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 ...
2000
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
   */
  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
2039

00b7c3395   Amerigo Wang   sysctl: refactor ...
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
  	if (tr && (len < *size))
  		*tr = *p;
  
  	*buf += len;
  	*size -= len;
  
  	return 0;
  }
  
  /**
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
2050
   * proc_put_long - converts an integer to a decimal ASCII formatted string
00b7c3395   Amerigo Wang   sysctl: refactor ...
2051
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
2052
2053
2054
2055
   * @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 ...
2056
   *
0fc377bd6   Randy Dunlap   sysctl: fix kerne...
2057
2058
   * In case of success %0 is returned and @buf and @size are updated with
   * the amount of bytes written.
00b7c3395   Amerigo Wang   sysctl: refactor ...
2059
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
   */
  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
2089

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

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

563b04671   J. R. Okajima   proc_dointvec: wr...
2179
2180
  			if (!left)
  				break;
70f6cbb6f   Al Viro   kernel/*: switch ...
2181
  			err = proc_get_long(&p, &left, &lval, &neg,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2182
2183
2184
  					     proc_wspace_sep,
  					     sizeof(proc_wspace_sep), NULL);
  			if (err)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2185
  				break;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2186
2187
  			if (conv(&neg, &lval, i, 1, data)) {
  				err = -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2188
  				break;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2189
  			}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2190
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2191
2192
2193
2194
  			if (conv(&neg, &lval, i, 0, data)) {
  				err = -EINVAL;
  				break;
  			}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2195
  			if (!first)
00b7c3395   Amerigo Wang   sysctl: refactor ...
2196
2197
2198
2199
2200
  				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
2201
  				break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2202
2203
  		}
  	}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2204
2205
2206
  	if (!write && !first && left && !err)
  		err = proc_put_char(&buffer, &left, '
  ');
563b04671   J. R. Okajima   proc_dointvec: wr...
2207
  	if (write && !err && left)
70f6cbb6f   Al Viro   kernel/*: switch ...
2208
  		left -= proc_skip_spaces(&p);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2209
  	if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2210
  		kfree(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2211
2212
  		if (first)
  			return err ? : -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2213
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2214
  	*lenp -= left;
f4aacea2f   Kees Cook   sysctl: allow for...
2215
  out:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2216
  	*ppos += *lenp;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2217
  	return err;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2218
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2219
  static int do_proc_dointvec(struct ctl_table *table, int write,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2220
  		  void __user *buffer, size_t *lenp, loff_t *ppos,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2221
  		  int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2222
2223
2224
  			      int write, void *data),
  		  void *data)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2225
  	return __do_proc_dointvec(table->data, table, write,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2226
2227
  			buffer, lenp, ppos, conv, data);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2228
2229
2230
2231
  /**
   * 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
2232
2233
2234
2235
2236
2237
2238
2239
2240
   * @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...
2241
  int proc_dointvec(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2242
2243
  		     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
e7d316a02   Subash Abhinov Kasiviswanathan   sysctl: handle er...
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
  	return do_proc_dointvec(table, write, buffer, lenp, ppos, NULL, NULL);
  }
  
  /**
   * proc_douintvec - read a vector of unsigned integers
   * @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
   *
   * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
   * values from/to the user buffer, treated as an ASCII string.
   *
   * Returns 0 on success.
   */
  int proc_douintvec(struct ctl_table *table, int write,
  		     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return do_proc_dointvec(table, write, buffer, lenp, ppos,
  				do_proc_douintvec_conv, NULL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2265
  }
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2266
  /*
25ddbb18a   Andi Kleen   Make the taint fl...
2267
2268
   * Taint values can only be increased
   * This means we can safely use a temporary.
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2269
   */
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2270
  static int proc_taint(struct ctl_table *table, int write,
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2271
2272
  			       void __user *buffer, size_t *lenp, loff_t *ppos)
  {
25ddbb18a   Andi Kleen   Make the taint fl...
2273
2274
2275
  	struct ctl_table t;
  	unsigned long tmptaint = get_taint();
  	int err;
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2276

91fcd412e   Bastian Blank   Allow reading tai...
2277
  	if (write && !capable(CAP_SYS_ADMIN))
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2278
  		return -EPERM;
25ddbb18a   Andi Kleen   Make the taint fl...
2279
2280
  	t = *table;
  	t.data = &tmptaint;
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2281
  	err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
25ddbb18a   Andi Kleen   Make the taint fl...
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
  	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...
2293
  				add_taint(i, LOCKDEP_STILL_OK);
25ddbb18a   Andi Kleen   Make the taint fl...
2294
2295
2296
2297
  		}
  	}
  
  	return err;
34f5a3989   Theodore Ts'o   [PATCH] Add TAINT...
2298
  }
bfdc0b497   Richard Weinberger   sysctl: restrict ...
2299
  #ifdef CONFIG_PRINTK
620f6e8e8   Kees Cook   sysctl: fix write...
2300
  static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
bfdc0b497   Richard Weinberger   sysctl: restrict ...
2301
2302
2303
2304
2305
2306
2307
2308
  				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
2309
2310
2311
2312
  struct do_proc_dointvec_minmax_conv_param {
  	int *min;
  	int *max;
  };
00b7c3395   Amerigo Wang   sysctl: refactor ...
2313
2314
  static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
  					int *valp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
  					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 ...
2327
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2328
  			*lvalp = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2329
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2330
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
  			*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
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
   * @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...
2353
  int proc_dointvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2354
2355
2356
2357
2358
2359
  		  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...
2360
  	return do_proc_dointvec(table, write, buffer, lenp, ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2361
2362
  				do_proc_dointvec_minmax_conv, &param);
  }
54b501992   Kees Cook   coredump: warn ab...
2363
2364
  static void validate_coredump_safety(void)
  {
046d662f4   Alex Kelly   coredump: make co...
2365
  #ifdef CONFIG_COREDUMP
e579d2c25   Kees Cook   coredump: remove ...
2366
  	if (suid_dumpable == SUID_DUMP_ROOT &&
54b501992   Kees Cook   coredump: warn ab...
2367
2368
2369
2370
2371
2372
  	    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...
2373
  #endif
54b501992   Kees Cook   coredump: warn ab...
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
  }
  
  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...
2384
  #ifdef CONFIG_COREDUMP
54b501992   Kees Cook   coredump: warn ab...
2385
2386
2387
2388
2389
2390
2391
2392
  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...
2393
  #endif
54b501992   Kees Cook   coredump: warn ab...
2394

d8217f076   Eric W. Biederman   sysctl core: Stop...
2395
  static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2396
2397
2398
2399
2400
  				     void __user *buffer,
  				     size_t *lenp, loff_t *ppos,
  				     unsigned long convmul,
  				     unsigned long convdiv)
  {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2401
2402
  	unsigned long *i, *min, *max;
  	int vleft, first = 1, err = 0;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2403
  	size_t left;
70f6cbb6f   Al Viro   kernel/*: switch ...
2404
  	char *kbuf = NULL, *p;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2405
2406
  
  	if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2407
2408
2409
  		*lenp = 0;
  		return 0;
  	}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2410

fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2411
  	i = (unsigned long *) data;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2412
2413
2414
2415
  	min = (unsigned long *) table->extra1;
  	max = (unsigned long *) table->extra2;
  	vleft = table->maxlen / sizeof(unsigned long);
  	left = *lenp;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2416
2417
  
  	if (write) {
f4aacea2f   Kees Cook   sysctl: allow for...
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
  		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 ...
2429
2430
  		if (left > PAGE_SIZE - 1)
  			left = PAGE_SIZE - 1;
70f6cbb6f   Al Viro   kernel/*: switch ...
2431
2432
2433
  		p = kbuf = memdup_user_nul(buffer, left);
  		if (IS_ERR(kbuf))
  			return PTR_ERR(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2434
  	}
27b3d80a7   Eric Dumazet   sysctl: fix min/m...
2435
  	for (; left && vleft--; i++, first = 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2436
  		unsigned long val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2437
  		if (write) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2438
  			bool neg;
70f6cbb6f   Al Viro   kernel/*: switch ...
2439
  			left -= proc_skip_spaces(&p);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2440

70f6cbb6f   Al Viro   kernel/*: switch ...
2441
  			err = proc_get_long(&p, &left, &val, &neg,
00b7c3395   Amerigo Wang   sysctl: refactor ...
2442
2443
2444
  					     proc_wspace_sep,
  					     sizeof(proc_wspace_sep), NULL);
  			if (err)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2445
2446
  				break;
  			if (neg)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2447
  				continue;
03707d6c3   Eric Dumazet   sysctl: fix proc_...
2448
  			val = convmul * val / convdiv;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2449
2450
2451
2452
  			if ((min && val < *min) || (max && val > *max))
  				continue;
  			*i = val;
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2453
  			val = convdiv * (*i) / convmul;
7833819d2   Chen Gang   kernel/sysctl.c: ...
2454
  			if (!first) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2455
  				err = proc_put_char(&buffer, &left, '\t');
7833819d2   Chen Gang   kernel/sysctl.c: ...
2456
2457
2458
  				if (err)
  					break;
  			}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2459
2460
2461
  			err = proc_put_long(&buffer, &left, val, false);
  			if (err)
  				break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2462
2463
  		}
  	}
00b7c3395   Amerigo Wang   sysctl: refactor ...
2464
2465
2466
2467
  	if (!write && !first && left && !err)
  		err = proc_put_char(&buffer, &left, '
  ');
  	if (write && !err)
70f6cbb6f   Al Viro   kernel/*: switch ...
2468
  		left -= proc_skip_spaces(&p);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2469
  	if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2470
  		kfree(kbuf);
00b7c3395   Amerigo Wang   sysctl: refactor ...
2471
2472
  		if (first)
  			return err ? : -EINVAL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2473
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2474
  	*lenp -= left;
f4aacea2f   Kees Cook   sysctl: allow for...
2475
  out:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2476
  	*ppos += *lenp;
00b7c3395   Amerigo Wang   sysctl: refactor ...
2477
  	return err;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2478
  }
d8217f076   Eric W. Biederman   sysctl core: Stop...
2479
  static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2480
2481
2482
2483
2484
2485
  				     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...
2486
  			buffer, lenp, ppos, convmul, convdiv);
fcfbd547b   Kirill Korotaev   [PATCH] IPC names...
2487
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2488
2489
2490
2491
  /**
   * 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
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
   * @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...
2504
  int proc_doulongvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2505
2506
  			   void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2507
      return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2508
2509
2510
2511
2512
2513
  }
  
  /**
   * 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
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
   * @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...
2527
  int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2528
2529
2530
  				      void __user *buffer,
  				      size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2531
      return do_proc_doulongvec_minmax(table, write, buffer,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2532
2533
  				     lenp, ppos, HZ, 1000l);
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2534
  static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2535
2536
2537
2538
  					 int *valp,
  					 int write, void *data)
  {
  	if (write) {
cba9f33d1   Bart Samwel   [PATCH] Range che...
2539
2540
  		if (*lvalp > LONG_MAX / HZ)
  			return 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2541
2542
2543
2544
2545
  		*valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
  	} else {
  		int val = *valp;
  		unsigned long lval;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2546
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2547
  			lval = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2548
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2549
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2550
2551
2552
2553
2554
2555
  			lval = (unsigned long)val;
  		}
  		*lvalp = lval / HZ;
  	}
  	return 0;
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2556
  static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2557
2558
2559
2560
  						int *valp,
  						int write, void *data)
  {
  	if (write) {
cba9f33d1   Bart Samwel   [PATCH] Range che...
2561
2562
  		if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
  			return 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2563
2564
2565
2566
2567
  		*valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
  	} else {
  		int val = *valp;
  		unsigned long lval;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2568
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2569
  			lval = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2570
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2571
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2572
2573
2574
2575
2576
2577
  			lval = (unsigned long)val;
  		}
  		*lvalp = jiffies_to_clock_t(lval);
  	}
  	return 0;
  }
00b7c3395   Amerigo Wang   sysctl: refactor ...
2578
  static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2579
2580
2581
2582
  					    int *valp,
  					    int write, void *data)
  {
  	if (write) {
d738ce8fd   Francesco Fusco   sysctl: range che...
2583
2584
2585
2586
2587
  		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
2588
2589
2590
2591
  	} else {
  		int val = *valp;
  		unsigned long lval;
  		if (val < 0) {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2592
  			*negp = true;
9a5bc726d   Ilya Dryomov   sysctl: fix int -...
2593
  			lval = -(unsigned long)val;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2594
  		} else {
00b7c3395   Amerigo Wang   sysctl: refactor ...
2595
  			*negp = false;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
  			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
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
   * @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...
2618
  int proc_dointvec_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2619
2620
  			  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2621
      return do_proc_dointvec(table,write,buffer,lenp,ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2622
2623
2624
2625
2626
2627
2628
  		    	    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
2629
2630
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
1e5d53314   Randy Dunlap   [PATCH] more kern...
2631
   * @ppos: pointer to the file position
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2632
2633
2634
2635
2636
2637
2638
2639
   *
   * 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...
2640
  int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2641
2642
  				 void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2643
      return do_proc_dointvec(table,write,buffer,lenp,ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2644
2645
2646
2647
2648
2649
2650
  		    	    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
2651
2652
   * @buffer: the user buffer
   * @lenp: the size of the user buffer
67be2dd1b   Martin Waitz   [PATCH] DocBook: ...
2653
2654
   * @ppos: file position
   * @ppos: the current position in the file
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2655
2656
2657
2658
2659
2660
2661
2662
   *
   * 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...
2663
  int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2664
2665
  			     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2666
  	return do_proc_dointvec(table, write, buffer, lenp, ppos,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2667
2668
  				do_proc_dointvec_ms_jiffies_conv, NULL);
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2669
  static int proc_do_cad_pid(struct ctl_table *table, int write,
9ec52099e   Cedric Le Goater   [PATCH] replace c...
2670
2671
2672
2673
2674
  			   void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	struct pid *new_pid;
  	pid_t tmp;
  	int r;
6c5f3e7b4   Pavel Emelyanov   Pidns: make full ...
2675
  	tmp = pid_vnr(cad_pid);
9ec52099e   Cedric Le Goater   [PATCH] replace c...
2676

8d65af789   Alexey Dobriyan   sysctl: remove "s...
2677
  	r = __do_proc_dointvec(&tmp, table, write, buffer,
9ec52099e   Cedric Le Goater   [PATCH] replace c...
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
  			       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_...
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
  /**
   * 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...
2713
  	unsigned long *bitmap = *(unsigned long **) table->data;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2714
2715
2716
2717
  	unsigned long *tmp_bitmap = NULL;
  	char tr_a[] = { '-', ',', '
  ' }, tr_b[] = { ',', '
  ', 0 }, c;
122ff243f   WANG Cong   ipv4: make ip_loc...
2718
  	if (!bitmap || !bitmap_len || !left || (*ppos && !write)) {
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2719
2720
2721
2722
2723
  		*lenp = 0;
  		return 0;
  	}
  
  	if (write) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2724
  		char *kbuf, *p;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2725
2726
2727
  
  		if (left > PAGE_SIZE - 1)
  			left = PAGE_SIZE - 1;
70f6cbb6f   Al Viro   kernel/*: switch ...
2728
2729
2730
  		p = kbuf = memdup_user_nul(buffer, left);
  		if (IS_ERR(kbuf))
  			return PTR_ERR(kbuf);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2731
2732
2733
2734
  
  		tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
  				     GFP_KERNEL);
  		if (!tmp_bitmap) {
70f6cbb6f   Al Viro   kernel/*: switch ...
2735
  			kfree(kbuf);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2736
2737
  			return -ENOMEM;
  		}
70f6cbb6f   Al Viro   kernel/*: switch ...
2738
2739
  		proc_skip_char(&p, &left, '
  ');
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2740
2741
2742
  		while (!err && left) {
  			unsigned long val_a, val_b;
  			bool neg;
70f6cbb6f   Al Viro   kernel/*: switch ...
2743
  			err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
  					     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 ...
2754
  				p++;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2755
2756
2757
2758
  				left--;
  			}
  
  			if (c == '-') {
70f6cbb6f   Al Viro   kernel/*: switch ...
2759
  				err = proc_get_long(&p, &left, &val_b,
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
  						     &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 ...
2770
  					p++;
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2771
2772
2773
  					left--;
  				}
  			}
5a04cca6c   Akinobu Mita   sysctl: use bitma...
2774
  			bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2775
  			first = 0;
70f6cbb6f   Al Viro   kernel/*: switch ...
2776
2777
  			proc_skip_char(&p, &left, '
  ');
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2778
  		}
70f6cbb6f   Al Viro   kernel/*: switch ...
2779
  		kfree(kbuf);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
  	} 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...
2819
  				bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
9f977fb7a   Octavian Purdila   sysctl: add proc_...
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
  		}
  		kfree(tmp_bitmap);
  		*lenp -= left;
  		*ppos += *lenp;
  		return 0;
  	} else {
  		kfree(tmp_bitmap);
  		return err;
  	}
  }
556105000   Jovi Zhang   sysctl: fix #ifde...
2830
  #else /* CONFIG_PROC_SYSCTL */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2831

8d65af789   Alexey Dobriyan   sysctl: remove "s...
2832
  int proc_dostring(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2833
2834
2835
2836
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2837
  int proc_dointvec(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2838
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2839
2840
2841
  {
  	return -ENOSYS;
  }
e7d316a02   Subash Abhinov Kasiviswanathan   sysctl: handle er...
2842
2843
2844
2845
2846
  int proc_douintvec(struct ctl_table *table, int write,
  		  void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2847
  int proc_dointvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2848
2849
2850
2851
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2852
  int proc_dointvec_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2853
2854
2855
2856
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2857
  int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2858
2859
2860
2861
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2862
  int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2863
2864
2865
2866
  			     void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
8d65af789   Alexey Dobriyan   sysctl: remove "s...
2867
  int proc_doulongvec_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2868
2869
2870
2871
  		    void __user *buffer, size_t *lenp, loff_t *ppos)
  {
  	return -ENOSYS;
  }
d8217f076   Eric W. Biederman   sysctl core: Stop...
2872
  int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2873
2874
2875
2876
2877
  				      void __user *buffer,
  				      size_t *lenp, loff_t *ppos)
  {
      return -ENOSYS;
  }
556105000   Jovi Zhang   sysctl: fix #ifde...
2878
  #endif /* CONFIG_PROC_SYSCTL */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2879

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2880
2881
2882
2883
2884
  /*
   * No sense putting this after each symbol definition, twice,
   * exception granted :-)
   */
  EXPORT_SYMBOL(proc_dointvec);
e7d316a02   Subash Abhinov Kasiviswanathan   sysctl: handle er...
2885
  EXPORT_SYMBOL(proc_douintvec);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2886
2887
2888
2889
2890
2891
2892
  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);