Commit 3f976d59 authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Pavel Emelyanov

ipc/sysctl: c/r fs.mqueue.msg_default fs.mqueue.msgsize_default

we already have 3/5 fs.mqueue.xxx sysctls so why not have all:

/proc/sys/fs/mqueue/msg_default is  a read/write  file for
setting/getting the default number of messages in a queue value
if attr parameter of mq_open(2) is NULL. If it exceed msg_max,
the default value is initialized msg_max.

/proc/sys/fs/mqueue/msgsize_default is a read/write file for
setting/getting the default message size value if attr parameter
of mq_open(2) is NULL. If it exceed msgsize_max, the default
value is initialized msgsize_max.

v2: remove check if kernel has sysctls as we do not support such an
old kernel(v3.5)
Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 99088d6b
...@@ -309,6 +309,8 @@ static int ipc_sysctl_req(IpcVarEntry *e, int op) ...@@ -309,6 +309,8 @@ static int ipc_sysctl_req(IpcVarEntry *e, int op)
{ "fs/mqueue/queues_max", &e->mq_queues_max, CTL_U32 }, { "fs/mqueue/queues_max", &e->mq_queues_max, CTL_U32 },
{ "fs/mqueue/msg_max", &e->mq_msg_max, CTL_U32 }, { "fs/mqueue/msg_max", &e->mq_msg_max, CTL_U32 },
{ "fs/mqueue/msgsize_max", &e->mq_msgsize_max, CTL_U32 }, { "fs/mqueue/msgsize_max", &e->mq_msgsize_max, CTL_U32 },
{ "fs/mqueue/msg_default", &e->mq_msg_default, CTL_U32 },
{ "fs/mqueue/msgsize_default", &e->mq_msgsize_default, CTL_U32 },
}; };
int ret; int ret;
...@@ -322,7 +324,8 @@ static int ipc_sysctl_req(IpcVarEntry *e, int op) ...@@ -322,7 +324,8 @@ static int ipc_sysctl_req(IpcVarEntry *e, int op)
return 0; return 0;
} }
return sysctl_op(req_mq, ARRAY_SIZE(req_mq), op, CLONE_NEWIPC); return sysctl_op(req_mq, ARRAY_SIZE(req_mq) - (e->has_mq_msg_default ? 0 : 2),
op, CLONE_NEWIPC);
} }
/* /*
...@@ -416,6 +419,8 @@ static int dump_ipc_var(struct cr_img *img) ...@@ -416,6 +419,8 @@ static int dump_ipc_var(struct cr_img *img)
var.sem_ctls = xmalloc(pb_repeated_size(&var, sem_ctls)); var.sem_ctls = xmalloc(pb_repeated_size(&var, sem_ctls));
if (!var.sem_ctls) if (!var.sem_ctls)
goto err; goto err;
var.has_mq_msg_default = true;
var.has_mq_msgsize_default = true;
ret = ipc_sysctl_req(&var, CTL_READ); ret = ipc_sysctl_req(&var, CTL_READ);
if (ret < 0) { if (ret < 0) {
......
...@@ -13,4 +13,6 @@ message ipc_var_entry { ...@@ -13,4 +13,6 @@ message ipc_var_entry {
required uint32 mq_queues_max = 10; required uint32 mq_queues_max = 10;
required uint32 mq_msg_max = 11; required uint32 mq_msg_max = 11;
required uint32 mq_msgsize_max = 12; required uint32 mq_msgsize_max = 12;
optional uint32 mq_msg_default = 13;
optional uint32 mq_msgsize_default = 14;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment