aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c117
1 files changed, 0 insertions, 117 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7ba4b0c16d6a..eff1d36c0687 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -135,13 +135,6 @@ static int parse_table(int __user *, int, void __user *, size_t __user *,
135 void __user *, size_t, ctl_table *); 135 void __user *, size_t, ctl_table *);
136#endif 136#endif
137 137
138static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
139 void __user *buffer, size_t *lenp, loff_t *ppos);
140
141static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
142 void __user *oldval, size_t __user *oldlenp,
143 void __user *newval, size_t newlen);
144
145#ifdef CONFIG_SYSVIPC 138#ifdef CONFIG_SYSVIPC
146static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, 139static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
147 void __user *oldval, size_t __user *oldlenp, 140 void __user *oldval, size_t __user *oldlenp,
@@ -176,29 +169,6 @@ extern ctl_table inotify_table[];
176int sysctl_legacy_va_layout; 169int sysctl_legacy_va_layout;
177#endif 170#endif
178 171
179
180static void *get_uts(ctl_table *table, int write)
181{
182 char *which = table->data;
183#ifdef CONFIG_UTS_NS
184 struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
185 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
186#endif
187 if (!write)
188 down_read(&uts_sem);
189 else
190 down_write(&uts_sem);
191 return which;
192}
193
194static void put_uts(ctl_table *table, int write, void *which)
195{
196 if (!write)
197 up_read(&uts_sem);
198 else
199 up_write(&uts_sem);
200}
201
202#ifdef CONFIG_SYSVIPC 172#ifdef CONFIG_SYSVIPC
203static void *get_ipc(ctl_table *table, int write) 173static void *get_ipc(ctl_table *table, int write)
204{ 174{
@@ -278,51 +248,6 @@ static ctl_table root_table[] = {
278 248
279static ctl_table kern_table[] = { 249static ctl_table kern_table[] = {
280 { 250 {
281 .ctl_name = KERN_OSTYPE,
282 .procname = "ostype",
283 .data = init_uts_ns.name.sysname,
284 .maxlen = sizeof(init_uts_ns.name.sysname),
285 .mode = 0444,
286 .proc_handler = &proc_do_uts_string,
287 .strategy = &sysctl_uts_string,
288 },
289 {
290 .ctl_name = KERN_OSRELEASE,
291 .procname = "osrelease",
292 .data = init_uts_ns.name.release,
293 .maxlen = sizeof(init_uts_ns.name.release),
294 .mode = 0444,
295 .proc_handler = &proc_do_uts_string,
296 .strategy = &sysctl_uts_string,
297 },
298 {
299 .ctl_name = KERN_VERSION,
300 .procname = "version",
301 .data = init_uts_ns.name.version,
302 .maxlen = sizeof(init_uts_ns.name.version),
303 .mode = 0444,
304 .proc_handler = &proc_do_uts_string,
305 .strategy = &sysctl_uts_string,
306 },
307 {
308 .ctl_name = KERN_NODENAME,
309 .procname = "hostname",
310 .data = init_uts_ns.name.nodename,
311 .maxlen = sizeof(init_uts_ns.name.nodename),
312 .mode = 0644,
313 .proc_handler = &proc_do_uts_string,
314 .strategy = &sysctl_uts_string,
315 },
316 {
317 .ctl_name = KERN_DOMAINNAME,
318 .procname = "domainname",
319 .data = init_uts_ns.name.domainname,
320 .maxlen = sizeof(init_uts_ns.name.domainname),
321 .mode = 0644,
322 .proc_handler = &proc_do_uts_string,
323 .strategy = &sysctl_uts_string,
324 },
325 {
326 .ctl_name = KERN_PANIC, 251 .ctl_name = KERN_PANIC,
327 .procname = "panic", 252 .procname = "panic",
328 .data = &panic_timeout, 253 .data = &panic_timeout,
@@ -1759,21 +1684,6 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
1759 buffer, lenp, ppos); 1684 buffer, lenp, ppos);
1760} 1685}
1761 1686
1762/*
1763 * Special case of dostring for the UTS structure. This has locks
1764 * to observe. Should this be in kernel/sys.c ????
1765 */
1766
1767static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
1768 void __user *buffer, size_t *lenp, loff_t *ppos)
1769{
1770 int r;
1771 void *which;
1772 which = get_uts(table, write);
1773 r = _proc_do_string(which, table->maxlen,write,filp,buffer,lenp, ppos);
1774 put_uts(table, write, which);
1775 return r;
1776}
1777 1687
1778static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp, 1688static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1779 int *valp, 1689 int *valp,
@@ -2410,12 +2320,6 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
2410 return -ENOSYS; 2320 return -ENOSYS;
2411} 2321}
2412 2322
2413static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
2414 void __user *buffer, size_t *lenp, loff_t *ppos)
2415{
2416 return -ENOSYS;
2417}
2418
2419#ifdef CONFIG_SYSVIPC 2323#ifdef CONFIG_SYSVIPC
2420static int proc_do_ipc_string(ctl_table *table, int write, struct file *filp, 2324static int proc_do_ipc_string(ctl_table *table, int write, struct file *filp,
2421 void __user *buffer, size_t *lenp, loff_t *ppos) 2325 void __user *buffer, size_t *lenp, loff_t *ppos)
@@ -2645,21 +2549,6 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2645} 2549}
2646 2550
2647 2551
2648/* The generic string strategy routine: */
2649static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
2650 void __user *oldval, size_t __user *oldlenp,
2651 void __user *newval, size_t newlen)
2652{
2653 struct ctl_table uts_table;
2654 int r, write;
2655 write = newval && newlen;
2656 memcpy(&uts_table, table, sizeof(uts_table));
2657 uts_table.data = get_uts(table, write);
2658 r = sysctl_string(&uts_table, name, nlen,
2659 oldval, oldlenp, newval, newlen);
2660 put_uts(table, write, uts_table.data);
2661 return r;
2662}
2663 2552
2664#ifdef CONFIG_SYSVIPC 2553#ifdef CONFIG_SYSVIPC
2665/* The generic sysctl ipc data routine. */ 2554/* The generic sysctl ipc data routine. */
@@ -2766,12 +2655,6 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2766 return -ENOSYS; 2655 return -ENOSYS;
2767} 2656}
2768 2657
2769static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
2770 void __user *oldval, size_t __user *oldlenp,
2771 void __user *newval, size_t newlen)
2772{
2773 return -ENOSYS;
2774}
2775#ifdef CONFIG_SYSVIPC 2658#ifdef CONFIG_SYSVIPC
2776static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, 2659static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
2777 void __user *oldval, size_t __user *oldlenp, 2660 void __user *oldval, size_t __user *oldlenp,