diff options
Diffstat (limited to 'ipc/mq_sysctl.c')
| -rw-r--r-- | ipc/mq_sysctl.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c index 0c09366b96f3..383d638340b8 100644 --- a/ipc/mq_sysctl.c +++ b/ipc/mq_sysctl.c | |||
| @@ -13,15 +13,6 @@ | |||
| 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 | /* | ||
| 17 | * Define the ranges various user-specified maximum values can | ||
| 18 | * be set to. | ||
| 19 | */ | ||
| 20 | #define MIN_MSGMAX 1 /* min 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 */ | ||
| 23 | #define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */ | ||
| 24 | |||
| 25 | #ifdef CONFIG_PROC_SYSCTL | 16 | #ifdef CONFIG_PROC_SYSCTL |
| 26 | static void *get_mq(ctl_table *table) | 17 | static void *get_mq(ctl_table *table) |
| 27 | { | 18 | { |
| @@ -31,16 +22,6 @@ static void *get_mq(ctl_table *table) | |||
| 31 | return which; | 22 | return which; |
| 32 | } | 23 | } |
| 33 | 24 | ||
| 34 | static int proc_mq_dointvec(ctl_table *table, int write, | ||
| 35 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
| 36 | { | ||
| 37 | struct ctl_table mq_table; | ||
| 38 | memcpy(&mq_table, table, sizeof(mq_table)); | ||
| 39 | mq_table.data = get_mq(table); | ||
| 40 | |||
| 41 | return proc_dointvec(&mq_table, write, buffer, lenp, ppos); | ||
| 42 | } | ||
| 43 | |||
| 44 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, | 25 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, |
| 45 | void __user *buffer, size_t *lenp, loff_t *ppos) | 26 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 46 | { | 27 | { |
| @@ -52,15 +33,17 @@ static int proc_mq_dointvec_minmax(ctl_table *table, int write, | |||
| 52 | lenp, ppos); | 33 | lenp, ppos); |
| 53 | } | 34 | } |
| 54 | #else | 35 | #else |
| 55 | #define proc_mq_dointvec NULL | ||
| 56 | #define proc_mq_dointvec_minmax NULL | 36 | #define proc_mq_dointvec_minmax NULL |
| 57 | #endif | 37 | #endif |
| 58 | 38 | ||
| 39 | static int msg_queues_limit_min = MIN_QUEUESMAX; | ||
| 40 | static int msg_queues_limit_max = HARD_QUEUESMAX; | ||
| 41 | |||
| 59 | static int msg_max_limit_min = MIN_MSGMAX; | 42 | static int msg_max_limit_min = MIN_MSGMAX; |
| 60 | static int msg_max_limit_max = MAX_MSGMAX; | 43 | static int msg_max_limit_max = HARD_MSGMAX; |
| 61 | 44 | ||
| 62 | static int msg_maxsize_limit_min = MIN_MSGSIZEMAX; | 45 | static int msg_maxsize_limit_min = MIN_MSGSIZEMAX; |
| 63 | static int msg_maxsize_limit_max = MAX_MSGSIZEMAX; | 46 | static int msg_maxsize_limit_max = HARD_MSGSIZEMAX; |
| 64 | 47 | ||
| 65 | static ctl_table mq_sysctls[] = { | 48 | static ctl_table mq_sysctls[] = { |
| 66 | { | 49 | { |
| @@ -68,7 +51,9 @@ static ctl_table mq_sysctls[] = { | |||
| 68 | .data = &init_ipc_ns.mq_queues_max, | 51 | .data = &init_ipc_ns.mq_queues_max, |
| 69 | .maxlen = sizeof(int), | 52 | .maxlen = sizeof(int), |
| 70 | .mode = 0644, | 53 | .mode = 0644, |
| 71 | .proc_handler = proc_mq_dointvec, | 54 | .proc_handler = proc_mq_dointvec_minmax, |
| 55 | .extra1 = &msg_queues_limit_min, | ||
| 56 | .extra2 = &msg_queues_limit_max, | ||
| 72 | }, | 57 | }, |
| 73 | { | 58 | { |
| 74 | .procname = "msg_max", | 59 | .procname = "msg_max", |
| @@ -88,6 +73,24 @@ static ctl_table mq_sysctls[] = { | |||
| 88 | .extra1 = &msg_maxsize_limit_min, | 73 | .extra1 = &msg_maxsize_limit_min, |
| 89 | .extra2 = &msg_maxsize_limit_max, | 74 | .extra2 = &msg_maxsize_limit_max, |
| 90 | }, | 75 | }, |
| 76 | { | ||
| 77 | .procname = "msg_default", | ||
| 78 | .data = &init_ipc_ns.mq_msg_default, | ||
| 79 | .maxlen = sizeof(int), | ||
| 80 | .mode = 0644, | ||
| 81 | .proc_handler = proc_mq_dointvec_minmax, | ||
| 82 | .extra1 = &msg_max_limit_min, | ||
| 83 | .extra2 = &msg_max_limit_max, | ||
| 84 | }, | ||
| 85 | { | ||
| 86 | .procname = "msgsize_default", | ||
| 87 | .data = &init_ipc_ns.mq_msgsize_default, | ||
| 88 | .maxlen = sizeof(int), | ||
| 89 | .mode = 0644, | ||
| 90 | .proc_handler = proc_mq_dointvec_minmax, | ||
| 91 | .extra1 = &msg_maxsize_limit_min, | ||
| 92 | .extra2 = &msg_maxsize_limit_max, | ||
| 93 | }, | ||
| 91 | {} | 94 | {} |
| 92 | }; | 95 | }; |
| 93 | 96 | ||
