Commit 2bc4657c15e4a33d9a192579c7627a397dbcbebc
1 parent
a153cf9dd0
Exists in
master
and in
39 other branches
sysctl ipc: Remove dead binary sysctl support code.
Now that sys_sysctl is a generic wrapper around /proc/sys .ctl_name and .strategy members of sysctl tables are dead code. Remove them. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Showing 2 changed files with 3 additions and 81 deletions Inline Diff
ipc/ipc_sysctl.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 | 2 | * Copyright (C) 2007 |
3 | * | 3 | * |
4 | * Author: Eric Biederman <ebiederm@xmision.com> | 4 | * Author: Eric Biederman <ebiederm@xmision.com> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as | 7 | * modify it under the terms of the GNU General Public License as |
8 | * published by the Free Software Foundation, version 2 of the | 8 | * published by the Free Software Foundation, version 2 of the |
9 | * License. | 9 | * License. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/ipc.h> | 13 | #include <linux/ipc.h> |
14 | #include <linux/nsproxy.h> | 14 | #include <linux/nsproxy.h> |
15 | #include <linux/sysctl.h> | 15 | #include <linux/sysctl.h> |
16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
17 | #include <linux/ipc_namespace.h> | 17 | #include <linux/ipc_namespace.h> |
18 | #include <linux/msg.h> | 18 | #include <linux/msg.h> |
19 | #include "util.h" | 19 | #include "util.h" |
20 | 20 | ||
21 | static void *get_ipc(ctl_table *table) | 21 | static void *get_ipc(ctl_table *table) |
22 | { | 22 | { |
23 | char *which = table->data; | 23 | char *which = table->data; |
24 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; | 24 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; |
25 | which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns; | 25 | which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns; |
26 | return which; | 26 | return which; |
27 | } | 27 | } |
28 | 28 | ||
29 | #ifdef CONFIG_PROC_SYSCTL | 29 | #ifdef CONFIG_PROC_SYSCTL |
30 | static int proc_ipc_dointvec(ctl_table *table, int write, | 30 | static int proc_ipc_dointvec(ctl_table *table, int write, |
31 | void __user *buffer, size_t *lenp, loff_t *ppos) | 31 | void __user *buffer, size_t *lenp, loff_t *ppos) |
32 | { | 32 | { |
33 | struct ctl_table ipc_table; | 33 | struct ctl_table ipc_table; |
34 | memcpy(&ipc_table, table, sizeof(ipc_table)); | 34 | memcpy(&ipc_table, table, sizeof(ipc_table)); |
35 | ipc_table.data = get_ipc(table); | 35 | ipc_table.data = get_ipc(table); |
36 | 36 | ||
37 | return proc_dointvec(&ipc_table, write, buffer, lenp, ppos); | 37 | return proc_dointvec(&ipc_table, write, buffer, lenp, ppos); |
38 | } | 38 | } |
39 | 39 | ||
40 | static int proc_ipc_callback_dointvec(ctl_table *table, int write, | 40 | static int proc_ipc_callback_dointvec(ctl_table *table, int write, |
41 | void __user *buffer, size_t *lenp, loff_t *ppos) | 41 | void __user *buffer, size_t *lenp, loff_t *ppos) |
42 | { | 42 | { |
43 | struct ctl_table ipc_table; | 43 | struct ctl_table ipc_table; |
44 | size_t lenp_bef = *lenp; | 44 | size_t lenp_bef = *lenp; |
45 | int rc; | 45 | int rc; |
46 | 46 | ||
47 | memcpy(&ipc_table, table, sizeof(ipc_table)); | 47 | memcpy(&ipc_table, table, sizeof(ipc_table)); |
48 | ipc_table.data = get_ipc(table); | 48 | ipc_table.data = get_ipc(table); |
49 | 49 | ||
50 | rc = proc_dointvec(&ipc_table, write, buffer, lenp, ppos); | 50 | rc = proc_dointvec(&ipc_table, write, buffer, lenp, ppos); |
51 | 51 | ||
52 | if (write && !rc && lenp_bef == *lenp) | 52 | if (write && !rc && lenp_bef == *lenp) |
53 | /* | 53 | /* |
54 | * Tunable has successfully been changed by hand. Disable its | 54 | * Tunable has successfully been changed by hand. Disable its |
55 | * automatic adjustment. This simply requires unregistering | 55 | * automatic adjustment. This simply requires unregistering |
56 | * the notifiers that trigger recalculation. | 56 | * the notifiers that trigger recalculation. |
57 | */ | 57 | */ |
58 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); | 58 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); |
59 | 59 | ||
60 | return rc; | 60 | return rc; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int proc_ipc_doulongvec_minmax(ctl_table *table, int write, | 63 | static int proc_ipc_doulongvec_minmax(ctl_table *table, int write, |
64 | void __user *buffer, size_t *lenp, loff_t *ppos) | 64 | void __user *buffer, size_t *lenp, loff_t *ppos) |
65 | { | 65 | { |
66 | struct ctl_table ipc_table; | 66 | struct ctl_table ipc_table; |
67 | memcpy(&ipc_table, table, sizeof(ipc_table)); | 67 | memcpy(&ipc_table, table, sizeof(ipc_table)); |
68 | ipc_table.data = get_ipc(table); | 68 | ipc_table.data = get_ipc(table); |
69 | 69 | ||
70 | return proc_doulongvec_minmax(&ipc_table, write, buffer, | 70 | return proc_doulongvec_minmax(&ipc_table, write, buffer, |
71 | lenp, ppos); | 71 | lenp, ppos); |
72 | } | 72 | } |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * Routine that is called when the file "auto_msgmni" has successfully been | 75 | * Routine that is called when the file "auto_msgmni" has successfully been |
76 | * written. | 76 | * written. |
77 | * Two values are allowed: | 77 | * Two values are allowed: |
78 | * 0: unregister msgmni's callback routine from the ipc namespace notifier | 78 | * 0: unregister msgmni's callback routine from the ipc namespace notifier |
79 | * chain. This means that msgmni won't be recomputed anymore upon memory | 79 | * chain. This means that msgmni won't be recomputed anymore upon memory |
80 | * add/remove or ipc namespace creation/removal. | 80 | * add/remove or ipc namespace creation/removal. |
81 | * 1: register back the callback routine. | 81 | * 1: register back the callback routine. |
82 | */ | 82 | */ |
83 | static void ipc_auto_callback(int val) | 83 | static void ipc_auto_callback(int val) |
84 | { | 84 | { |
85 | if (!val) | 85 | if (!val) |
86 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); | 86 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); |
87 | else { | 87 | else { |
88 | /* | 88 | /* |
89 | * Re-enable automatic recomputing only if not already | 89 | * Re-enable automatic recomputing only if not already |
90 | * enabled. | 90 | * enabled. |
91 | */ | 91 | */ |
92 | recompute_msgmni(current->nsproxy->ipc_ns); | 92 | recompute_msgmni(current->nsproxy->ipc_ns); |
93 | cond_register_ipcns_notifier(current->nsproxy->ipc_ns); | 93 | cond_register_ipcns_notifier(current->nsproxy->ipc_ns); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, | 97 | static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, |
98 | void __user *buffer, size_t *lenp, loff_t *ppos) | 98 | void __user *buffer, size_t *lenp, loff_t *ppos) |
99 | { | 99 | { |
100 | struct ctl_table ipc_table; | 100 | struct ctl_table ipc_table; |
101 | size_t lenp_bef = *lenp; | 101 | size_t lenp_bef = *lenp; |
102 | int oldval; | 102 | int oldval; |
103 | int rc; | 103 | int rc; |
104 | 104 | ||
105 | memcpy(&ipc_table, table, sizeof(ipc_table)); | 105 | memcpy(&ipc_table, table, sizeof(ipc_table)); |
106 | ipc_table.data = get_ipc(table); | 106 | ipc_table.data = get_ipc(table); |
107 | oldval = *((int *)(ipc_table.data)); | 107 | oldval = *((int *)(ipc_table.data)); |
108 | 108 | ||
109 | rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); | 109 | rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); |
110 | 110 | ||
111 | if (write && !rc && lenp_bef == *lenp) { | 111 | if (write && !rc && lenp_bef == *lenp) { |
112 | int newval = *((int *)(ipc_table.data)); | 112 | int newval = *((int *)(ipc_table.data)); |
113 | /* | 113 | /* |
114 | * The file "auto_msgmni" has correctly been set. | 114 | * The file "auto_msgmni" has correctly been set. |
115 | * React by (un)registering the corresponding tunable, if the | 115 | * React by (un)registering the corresponding tunable, if the |
116 | * value has changed. | 116 | * value has changed. |
117 | */ | 117 | */ |
118 | if (newval != oldval) | 118 | if (newval != oldval) |
119 | ipc_auto_callback(newval); | 119 | ipc_auto_callback(newval); |
120 | } | 120 | } |
121 | 121 | ||
122 | return rc; | 122 | return rc; |
123 | } | 123 | } |
124 | 124 | ||
125 | #else | 125 | #else |
126 | #define proc_ipc_doulongvec_minmax NULL | 126 | #define proc_ipc_doulongvec_minmax NULL |
127 | #define proc_ipc_dointvec NULL | 127 | #define proc_ipc_dointvec NULL |
128 | #define proc_ipc_callback_dointvec NULL | 128 | #define proc_ipc_callback_dointvec NULL |
129 | #define proc_ipcauto_dointvec_minmax NULL | 129 | #define proc_ipcauto_dointvec_minmax NULL |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | #ifdef CONFIG_SYSCTL_SYSCALL | ||
133 | /* The generic sysctl ipc data routine. */ | ||
134 | static int sysctl_ipc_data(ctl_table *table, | ||
135 | void __user *oldval, size_t __user *oldlenp, | ||
136 | void __user *newval, size_t newlen) | ||
137 | { | ||
138 | size_t len; | ||
139 | void *data; | ||
140 | |||
141 | /* Get out of I don't have a variable */ | ||
142 | if (!table->data || !table->maxlen) | ||
143 | return -ENOTDIR; | ||
144 | |||
145 | data = get_ipc(table); | ||
146 | if (!data) | ||
147 | return -ENOTDIR; | ||
148 | |||
149 | if (oldval && oldlenp) { | ||
150 | if (get_user(len, oldlenp)) | ||
151 | return -EFAULT; | ||
152 | if (len) { | ||
153 | if (len > table->maxlen) | ||
154 | len = table->maxlen; | ||
155 | if (copy_to_user(oldval, data, len)) | ||
156 | return -EFAULT; | ||
157 | if (put_user(len, oldlenp)) | ||
158 | return -EFAULT; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | if (newval && newlen) { | ||
163 | if (newlen > table->maxlen) | ||
164 | newlen = table->maxlen; | ||
165 | |||
166 | if (copy_from_user(data, newval, newlen)) | ||
167 | return -EFAULT; | ||
168 | } | ||
169 | return 1; | ||
170 | } | ||
171 | |||
172 | static int sysctl_ipc_registered_data(ctl_table *table, | ||
173 | void __user *oldval, size_t __user *oldlenp, | ||
174 | void __user *newval, size_t newlen) | ||
175 | { | ||
176 | int rc; | ||
177 | |||
178 | rc = sysctl_ipc_data(table, oldval, oldlenp, newval, newlen); | ||
179 | |||
180 | if (newval && newlen && rc > 0) | ||
181 | /* | ||
182 | * Tunable has successfully been changed from userland | ||
183 | */ | ||
184 | unregister_ipcns_notifier(current->nsproxy->ipc_ns); | ||
185 | |||
186 | return rc; | ||
187 | } | ||
188 | #else | ||
189 | #define sysctl_ipc_data NULL | ||
190 | #define sysctl_ipc_registered_data NULL | ||
191 | #endif | ||
192 | |||
193 | static int zero; | 132 | static int zero; |
194 | static int one = 1; | 133 | static int one = 1; |
195 | 134 | ||
196 | static struct ctl_table ipc_kern_table[] = { | 135 | static struct ctl_table ipc_kern_table[] = { |
197 | { | 136 | { |
198 | .ctl_name = KERN_SHMMAX, | ||
199 | .procname = "shmmax", | 137 | .procname = "shmmax", |
200 | .data = &init_ipc_ns.shm_ctlmax, | 138 | .data = &init_ipc_ns.shm_ctlmax, |
201 | .maxlen = sizeof (init_ipc_ns.shm_ctlmax), | 139 | .maxlen = sizeof (init_ipc_ns.shm_ctlmax), |
202 | .mode = 0644, | 140 | .mode = 0644, |
203 | .proc_handler = proc_ipc_doulongvec_minmax, | 141 | .proc_handler = proc_ipc_doulongvec_minmax, |
204 | .strategy = sysctl_ipc_data, | ||
205 | }, | 142 | }, |
206 | { | 143 | { |
207 | .ctl_name = KERN_SHMALL, | ||
208 | .procname = "shmall", | 144 | .procname = "shmall", |
209 | .data = &init_ipc_ns.shm_ctlall, | 145 | .data = &init_ipc_ns.shm_ctlall, |
210 | .maxlen = sizeof (init_ipc_ns.shm_ctlall), | 146 | .maxlen = sizeof (init_ipc_ns.shm_ctlall), |
211 | .mode = 0644, | 147 | .mode = 0644, |
212 | .proc_handler = proc_ipc_doulongvec_minmax, | 148 | .proc_handler = proc_ipc_doulongvec_minmax, |
213 | .strategy = sysctl_ipc_data, | ||
214 | }, | 149 | }, |
215 | { | 150 | { |
216 | .ctl_name = KERN_SHMMNI, | ||
217 | .procname = "shmmni", | 151 | .procname = "shmmni", |
218 | .data = &init_ipc_ns.shm_ctlmni, | 152 | .data = &init_ipc_ns.shm_ctlmni, |
219 | .maxlen = sizeof (init_ipc_ns.shm_ctlmni), | 153 | .maxlen = sizeof (init_ipc_ns.shm_ctlmni), |
220 | .mode = 0644, | 154 | .mode = 0644, |
221 | .proc_handler = proc_ipc_dointvec, | 155 | .proc_handler = proc_ipc_dointvec, |
222 | .strategy = sysctl_ipc_data, | ||
223 | }, | 156 | }, |
224 | { | 157 | { |
225 | .ctl_name = KERN_MSGMAX, | ||
226 | .procname = "msgmax", | 158 | .procname = "msgmax", |
227 | .data = &init_ipc_ns.msg_ctlmax, | 159 | .data = &init_ipc_ns.msg_ctlmax, |
228 | .maxlen = sizeof (init_ipc_ns.msg_ctlmax), | 160 | .maxlen = sizeof (init_ipc_ns.msg_ctlmax), |
229 | .mode = 0644, | 161 | .mode = 0644, |
230 | .proc_handler = proc_ipc_dointvec, | 162 | .proc_handler = proc_ipc_dointvec, |
231 | .strategy = sysctl_ipc_data, | ||
232 | }, | 163 | }, |
233 | { | 164 | { |
234 | .ctl_name = KERN_MSGMNI, | ||
235 | .procname = "msgmni", | 165 | .procname = "msgmni", |
236 | .data = &init_ipc_ns.msg_ctlmni, | 166 | .data = &init_ipc_ns.msg_ctlmni, |
237 | .maxlen = sizeof (init_ipc_ns.msg_ctlmni), | 167 | .maxlen = sizeof (init_ipc_ns.msg_ctlmni), |
238 | .mode = 0644, | 168 | .mode = 0644, |
239 | .proc_handler = proc_ipc_callback_dointvec, | 169 | .proc_handler = proc_ipc_callback_dointvec, |
240 | .strategy = sysctl_ipc_registered_data, | ||
241 | }, | 170 | }, |
242 | { | 171 | { |
243 | .ctl_name = KERN_MSGMNB, | ||
244 | .procname = "msgmnb", | 172 | .procname = "msgmnb", |
245 | .data = &init_ipc_ns.msg_ctlmnb, | 173 | .data = &init_ipc_ns.msg_ctlmnb, |
246 | .maxlen = sizeof (init_ipc_ns.msg_ctlmnb), | 174 | .maxlen = sizeof (init_ipc_ns.msg_ctlmnb), |
247 | .mode = 0644, | 175 | .mode = 0644, |
248 | .proc_handler = proc_ipc_dointvec, | 176 | .proc_handler = proc_ipc_dointvec, |
249 | .strategy = sysctl_ipc_data, | ||
250 | }, | 177 | }, |
251 | { | 178 | { |
252 | .ctl_name = KERN_SEM, | ||
253 | .procname = "sem", | 179 | .procname = "sem", |
254 | .data = &init_ipc_ns.sem_ctls, | 180 | .data = &init_ipc_ns.sem_ctls, |
255 | .maxlen = 4*sizeof (int), | 181 | .maxlen = 4*sizeof (int), |
256 | .mode = 0644, | 182 | .mode = 0644, |
257 | .proc_handler = proc_ipc_dointvec, | 183 | .proc_handler = proc_ipc_dointvec, |
258 | .strategy = sysctl_ipc_data, | ||
259 | }, | 184 | }, |
260 | { | 185 | { |
261 | .ctl_name = CTL_UNNUMBERED, | ||
262 | .procname = "auto_msgmni", | 186 | .procname = "auto_msgmni", |
263 | .data = &init_ipc_ns.auto_msgmni, | 187 | .data = &init_ipc_ns.auto_msgmni, |
264 | .maxlen = sizeof(int), | 188 | .maxlen = sizeof(int), |
265 | .mode = 0644, | 189 | .mode = 0644, |
266 | .proc_handler = proc_ipcauto_dointvec_minmax, | 190 | .proc_handler = proc_ipcauto_dointvec_minmax, |
267 | .extra1 = &zero, | 191 | .extra1 = &zero, |
268 | .extra2 = &one, | 192 | .extra2 = &one, |
269 | }, | 193 | }, |
270 | {} | 194 | {} |
271 | }; | 195 | }; |
272 | 196 | ||
273 | static struct ctl_table ipc_root_table[] = { | 197 | static struct ctl_table ipc_root_table[] = { |
274 | { | 198 | { |
275 | .ctl_name = CTL_KERN, | ||
276 | .procname = "kernel", | 199 | .procname = "kernel", |
277 | .mode = 0555, | 200 | .mode = 0555, |
278 | .child = ipc_kern_table, | 201 | .child = ipc_kern_table, |
279 | }, | 202 | }, |
280 | {} | 203 | {} |
281 | }; | 204 | }; |
282 | 205 | ||
283 | static int __init ipc_sysctl_init(void) | 206 | static int __init ipc_sysctl_init(void) |
284 | { | 207 | { |
285 | register_sysctl_table(ipc_root_table); | 208 | register_sysctl_table(ipc_root_table); |
286 | return 0; | 209 | return 0; |
287 | } | 210 | } |
288 | 211 | ||
289 | __initcall(ipc_sysctl_init); | 212 | __initcall(ipc_sysctl_init); |
290 | 213 |
ipc/mq_sysctl.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 IBM Corporation | 2 | * Copyright (C) 2007 IBM Corporation |
3 | * | 3 | * |
4 | * Author: Cedric Le Goater <clg@fr.ibm.com> | 4 | * Author: Cedric Le Goater <clg@fr.ibm.com> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as | 7 | * modify it under the terms of the GNU General Public License as |
8 | * published by the Free Software Foundation, version 2 of the | 8 | * published by the Free Software Foundation, version 2 of the |
9 | * License. | 9 | * License. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/nsproxy.h> | 12 | #include <linux/nsproxy.h> |
13 | #include <linux/ipc_namespace.h> | 13 | #include <linux/ipc_namespace.h> |
14 | #include <linux/sysctl.h> | 14 | #include <linux/sysctl.h> |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Define the ranges various user-specified maximum values can | 17 | * Define the ranges various user-specified maximum values can |
18 | * be set to. | 18 | * be set to. |
19 | */ | 19 | */ |
20 | #define MIN_MSGMAX 1 /* min value for msg_max */ | 20 | #define MIN_MSGMAX 1 /* min value for msg_max */ |
21 | #define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */ | 21 | #define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */ |
22 | #define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */ | 22 | #define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */ |
23 | #define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */ | 23 | #define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */ |
24 | 24 | ||
25 | #ifdef CONFIG_PROC_SYSCTL | 25 | #ifdef CONFIG_PROC_SYSCTL |
26 | static void *get_mq(ctl_table *table) | 26 | static void *get_mq(ctl_table *table) |
27 | { | 27 | { |
28 | char *which = table->data; | 28 | char *which = table->data; |
29 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; | 29 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; |
30 | which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns; | 30 | which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns; |
31 | return which; | 31 | return which; |
32 | } | 32 | } |
33 | 33 | ||
34 | static int proc_mq_dointvec(ctl_table *table, int write, | 34 | static int proc_mq_dointvec(ctl_table *table, int write, |
35 | void __user *buffer, size_t *lenp, loff_t *ppos) | 35 | void __user *buffer, size_t *lenp, loff_t *ppos) |
36 | { | 36 | { |
37 | struct ctl_table mq_table; | 37 | struct ctl_table mq_table; |
38 | memcpy(&mq_table, table, sizeof(mq_table)); | 38 | memcpy(&mq_table, table, sizeof(mq_table)); |
39 | mq_table.data = get_mq(table); | 39 | mq_table.data = get_mq(table); |
40 | 40 | ||
41 | return proc_dointvec(&mq_table, write, buffer, lenp, ppos); | 41 | return proc_dointvec(&mq_table, write, buffer, lenp, ppos); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, | 44 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, |
45 | void __user *buffer, size_t *lenp, loff_t *ppos) | 45 | void __user *buffer, size_t *lenp, loff_t *ppos) |
46 | { | 46 | { |
47 | struct ctl_table mq_table; | 47 | struct ctl_table mq_table; |
48 | memcpy(&mq_table, table, sizeof(mq_table)); | 48 | memcpy(&mq_table, table, sizeof(mq_table)); |
49 | mq_table.data = get_mq(table); | 49 | mq_table.data = get_mq(table); |
50 | 50 | ||
51 | return proc_dointvec_minmax(&mq_table, write, buffer, | 51 | return proc_dointvec_minmax(&mq_table, write, buffer, |
52 | lenp, ppos); | 52 | lenp, ppos); |
53 | } | 53 | } |
54 | #else | 54 | #else |
55 | #define proc_mq_dointvec NULL | 55 | #define proc_mq_dointvec NULL |
56 | #define proc_mq_dointvec_minmax NULL | 56 | #define proc_mq_dointvec_minmax NULL |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | static int msg_max_limit_min = MIN_MSGMAX; | 59 | static int msg_max_limit_min = MIN_MSGMAX; |
60 | static int msg_max_limit_max = MAX_MSGMAX; | 60 | static int msg_max_limit_max = MAX_MSGMAX; |
61 | 61 | ||
62 | static int msg_maxsize_limit_min = MIN_MSGSIZEMAX; | 62 | static int msg_maxsize_limit_min = MIN_MSGSIZEMAX; |
63 | static int msg_maxsize_limit_max = MAX_MSGSIZEMAX; | 63 | static int msg_maxsize_limit_max = MAX_MSGSIZEMAX; |
64 | 64 | ||
65 | static ctl_table mq_sysctls[] = { | 65 | static ctl_table mq_sysctls[] = { |
66 | { | 66 | { |
67 | .procname = "queues_max", | 67 | .procname = "queues_max", |
68 | .data = &init_ipc_ns.mq_queues_max, | 68 | .data = &init_ipc_ns.mq_queues_max, |
69 | .maxlen = sizeof(int), | 69 | .maxlen = sizeof(int), |
70 | .mode = 0644, | 70 | .mode = 0644, |
71 | .proc_handler = proc_mq_dointvec, | 71 | .proc_handler = proc_mq_dointvec, |
72 | }, | 72 | }, |
73 | { | 73 | { |
74 | .procname = "msg_max", | 74 | .procname = "msg_max", |
75 | .data = &init_ipc_ns.mq_msg_max, | 75 | .data = &init_ipc_ns.mq_msg_max, |
76 | .maxlen = sizeof(int), | 76 | .maxlen = sizeof(int), |
77 | .mode = 0644, | 77 | .mode = 0644, |
78 | .proc_handler = proc_mq_dointvec_minmax, | 78 | .proc_handler = proc_mq_dointvec_minmax, |
79 | .extra1 = &msg_max_limit_min, | 79 | .extra1 = &msg_max_limit_min, |
80 | .extra2 = &msg_max_limit_max, | 80 | .extra2 = &msg_max_limit_max, |
81 | }, | 81 | }, |
82 | { | 82 | { |
83 | .procname = "msgsize_max", | 83 | .procname = "msgsize_max", |
84 | .data = &init_ipc_ns.mq_msgsize_max, | 84 | .data = &init_ipc_ns.mq_msgsize_max, |
85 | .maxlen = sizeof(int), | 85 | .maxlen = sizeof(int), |
86 | .mode = 0644, | 86 | .mode = 0644, |
87 | .proc_handler = proc_mq_dointvec_minmax, | 87 | .proc_handler = proc_mq_dointvec_minmax, |
88 | .extra1 = &msg_maxsize_limit_min, | 88 | .extra1 = &msg_maxsize_limit_min, |
89 | .extra2 = &msg_maxsize_limit_max, | 89 | .extra2 = &msg_maxsize_limit_max, |
90 | }, | 90 | }, |
91 | { .ctl_name = 0 } | 91 | {} |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static ctl_table mq_sysctl_dir[] = { | 94 | static ctl_table mq_sysctl_dir[] = { |
95 | { | 95 | { |
96 | .procname = "mqueue", | 96 | .procname = "mqueue", |
97 | .mode = 0555, | 97 | .mode = 0555, |
98 | .child = mq_sysctls, | 98 | .child = mq_sysctls, |
99 | }, | 99 | }, |
100 | { .ctl_name = 0 } | 100 | {} |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static ctl_table mq_sysctl_root[] = { | 103 | static ctl_table mq_sysctl_root[] = { |
104 | { | 104 | { |
105 | .ctl_name = CTL_FS, | ||
106 | .procname = "fs", | 105 | .procname = "fs", |
107 | .mode = 0555, | 106 | .mode = 0555, |
108 | .child = mq_sysctl_dir, | 107 | .child = mq_sysctl_dir, |
109 | }, | 108 | }, |
110 | { .ctl_name = 0 } | 109 | {} |
111 | }; | 110 | }; |
112 | 111 | ||
113 | struct ctl_table_header *mq_register_sysctl_table(void) | 112 | struct ctl_table_header *mq_register_sysctl_table(void) |
114 | { | 113 | { |
115 | return register_sysctl_table(mq_sysctl_root); | 114 | return register_sysctl_table(mq_sysctl_root); |
116 | } | 115 | } |
117 | 116 |