sock recv without workqueue
[cor.git] / ipc / mq_sysctl.c
blob7c00f28923a8ccf21ea688f99a39bcdbc78b78fa
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2007 IBM Corporation
5 * Author: Cedric Le Goater <clg@fr.ibm.com>
6 */
8 #include <linux/nsproxy.h>
9 #include <linux/ipc_namespace.h>
10 #include <linux/sysctl.h>
12 #ifdef CONFIG_PROC_SYSCTL
13 static void *get_mq(struct ctl_table *table)
15 char *which = table->data;
16 struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns;
17 which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns;
18 return which;
21 static int proc_mq_dointvec(struct ctl_table *table, int write,
22 void __user *buffer, size_t *lenp, loff_t *ppos)
24 struct ctl_table mq_table;
25 memcpy(&mq_table, table, sizeof(mq_table));
26 mq_table.data = get_mq(table);
28 return proc_dointvec(&mq_table, write, buffer, lenp, ppos);
31 static int proc_mq_dointvec_minmax(struct ctl_table *table, int write,
32 void __user *buffer, size_t *lenp, loff_t *ppos)
34 struct ctl_table mq_table;
35 memcpy(&mq_table, table, sizeof(mq_table));
36 mq_table.data = get_mq(table);
38 return proc_dointvec_minmax(&mq_table, write, buffer,
39 lenp, ppos);
41 #else
42 #define proc_mq_dointvec NULL
43 #define proc_mq_dointvec_minmax NULL
44 #endif
46 static int msg_max_limit_min = MIN_MSGMAX;
47 static int msg_max_limit_max = HARD_MSGMAX;
49 static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
50 static int msg_maxsize_limit_max = HARD_MSGSIZEMAX;
52 static struct ctl_table mq_sysctls[] = {
54 .procname = "queues_max",
55 .data = &init_ipc_ns.mq_queues_max,
56 .maxlen = sizeof(int),
57 .mode = 0644,
58 .proc_handler = proc_mq_dointvec,
61 .procname = "msg_max",
62 .data = &init_ipc_ns.mq_msg_max,
63 .maxlen = sizeof(int),
64 .mode = 0644,
65 .proc_handler = proc_mq_dointvec_minmax,
66 .extra1 = &msg_max_limit_min,
67 .extra2 = &msg_max_limit_max,
70 .procname = "msgsize_max",
71 .data = &init_ipc_ns.mq_msgsize_max,
72 .maxlen = sizeof(int),
73 .mode = 0644,
74 .proc_handler = proc_mq_dointvec_minmax,
75 .extra1 = &msg_maxsize_limit_min,
76 .extra2 = &msg_maxsize_limit_max,
79 .procname = "msg_default",
80 .data = &init_ipc_ns.mq_msg_default,
81 .maxlen = sizeof(int),
82 .mode = 0644,
83 .proc_handler = proc_mq_dointvec_minmax,
84 .extra1 = &msg_max_limit_min,
85 .extra2 = &msg_max_limit_max,
88 .procname = "msgsize_default",
89 .data = &init_ipc_ns.mq_msgsize_default,
90 .maxlen = sizeof(int),
91 .mode = 0644,
92 .proc_handler = proc_mq_dointvec_minmax,
93 .extra1 = &msg_maxsize_limit_min,
94 .extra2 = &msg_maxsize_limit_max,
99 static struct ctl_table mq_sysctl_dir[] = {
101 .procname = "mqueue",
102 .mode = 0555,
103 .child = mq_sysctls,
108 static struct ctl_table mq_sysctl_root[] = {
110 .procname = "fs",
111 .mode = 0555,
112 .child = mq_sysctl_dir,
117 struct ctl_table_header *mq_register_sysctl_table(void)
119 return register_sysctl_table(mq_sysctl_root);