IPC之mq_sysctl.c源码解读
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2007 IBM Corporation
*
* Author: Cedric Le Goater <clg@fr.ibm.com>
*/ #include <linux/nsproxy.h>
#include <linux/ipc_namespace.h>
#include <linux/sysctl.h> #ifdef CONFIG_PROC_SYSCTL
static void *get_mq(struct ctl_table *table)
{
char *which = table->data;
struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns;
which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns;
return which;
} static int proc_mq_dointvec(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct ctl_table mq_table;
memcpy(&mq_table, table, sizeof(mq_table));
mq_table.data = get_mq(table); return proc_dointvec(&mq_table, write, buffer, lenp, ppos);
} static int proc_mq_dointvec_minmax(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct ctl_table mq_table;
memcpy(&mq_table, table, sizeof(mq_table));
mq_table.data = get_mq(table); return proc_dointvec_minmax(&mq_table, write, buffer,
lenp, ppos);
}
#else
#define proc_mq_dointvec NULL
#define proc_mq_dointvec_minmax NULL
#endif static int msg_max_limit_min = MIN_MSGMAX;
static int msg_max_limit_max = HARD_MSGMAX; static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
static int msg_maxsize_limit_max = HARD_MSGSIZEMAX; static struct ctl_table mq_sysctls[] = {
{
.procname = "queues_max",
.data = &init_ipc_ns.mq_queues_max,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_mq_dointvec,
},
{
.procname = "msg_max",
.data = &init_ipc_ns.mq_msg_max,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_mq_dointvec_minmax,
.extra1 = &msg_max_limit_min,
.extra2 = &msg_max_limit_max,
},
{
.procname = "msgsize_max",
.data = &init_ipc_ns.mq_msgsize_max,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_mq_dointvec_minmax,
.extra1 = &msg_maxsize_limit_min,
.extra2 = &msg_maxsize_limit_max,
},
{
.procname = "msg_default",
.data = &init_ipc_ns.mq_msg_default,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_mq_dointvec_minmax,
.extra1 = &msg_max_limit_min,
.extra2 = &msg_max_limit_max,
},
{
.procname = "msgsize_default",
.data = &init_ipc_ns.mq_msgsize_default,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_mq_dointvec_minmax,
.extra1 = &msg_maxsize_limit_min,
.extra2 = &msg_maxsize_limit_max,
},
{}
}; static struct ctl_table mq_sysctl_dir[] = {
{
.procname = "mqueue",
.mode = 0555,
.child = mq_sysctls,
},
{}
}; static struct ctl_table mq_sysctl_root[] = {
{
.procname = "fs",
.mode = 0555,
.child = mq_sysctl_dir,
},
{}
}; struct ctl_table_header *mq_register_sysctl_table(void)
{
return register_sysctl_table(mq_sysctl_root);
}
IPC之mq_sysctl.c源码解读的更多相关文章
- IPC之mqueue.c源码解读
队列的意思应该大家都清楚,不过还有有一些细节的地方不知道,下面是一个队列的源码,因该说这是队列的一部分,不是全部.而且是linux中队列,其他各种OS中队列大同小异. /* * POSIX messa ...
- IPC之ipc_sysctl.c源码解读
// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2007 * * Author: Eric Biederman <ebie ...
- IPC之util.h源码解读
/* SPDX-License-Identifier: GPL-2.0 */ /* * linux/ipc/util.h * Copyright (C) 1999 Christoph Rohland ...
- IPC之util.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * linux/ipc/util.c * Copyright (C) 1992 Krishna Balasubramani ...
- IPC之syscall.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * sys_ipc() is the old de-multiplexer for the SysV IPC calls. ...
- IPC之shm.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * linux/ipc/shm.c * Copyright (C) 1992, 1993 Krishna Balasubr ...
- IPC之sem.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * linux/ipc/sem.c * Copyright (C) 1992 Krishna Balasubramania ...
- IPC之namespace.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * linux/ipc/namespace.c * Copyright (C) 2006 Pavel Emelyanov ...
- IPC之msgutil.c源码解读
// SPDX-License-Identifier: GPL-2.0-or-later /* * linux/ipc/msgutil.c * Copyright (C) 1999, 2004 Man ...
随机推荐
- Delphi编写的等长加密与解密
最近在看一本关于网络游戏服务端开发的书,虽然该书是个空架子,里面没有多少实际的内容(此书评价不好),但其中关于等长加密与解密的代码还是有一定的借鉴作用的.他山之石,可以攻玉.因为书中是C++的代码,所 ...
- wxPython在frame窗口修改图标
self.m_panel4 = wx.Panel( self.m_notebook5, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TR ...
- React Native面试题记录
一.ES6中增加了那些新的功能? 1> for-of循环: 使用 for-of 的时候,循环的是数组内部的元素且不会出现 for-in 中将附加属性也遍历的情况,其次,循环变量的类型和其在数组中 ...
- Java集合(1):Collections工具类中的static方法
与Arrays一样,Collections类中也有一些实用的static方法. (1) 排序操作 reverse(List list):反转指定List集合中元素的顺序 shuffle(List li ...
- vs把asp.net旧的项目名称全部修改
1 先打开项目,把名称全部替换掉,然后把解决方案,程序集名称全部替换掉. 2 重新生成,清理,关闭项目. 3 把.sln文件用文本编辑器打开,替换里面的名称,然后把文件夹名称都修改好.d 4.打开项目 ...
- 撸了一个简易的工具库: jeasy
一年前,发现在工作的项目中存在大量使用monment的情况,但仅使用到最基础的format功能.monment的体积直接导致项目体积成倍增加,于是jeasy就诞生了. jeasy实现了monment最 ...
- 加入域之后,【Internet 时间】选项没有了
这是加入域之前的截图,这时可以看见[Internet 时间]选项. 这是加入域之后的截图,这时就看不到[Internet 时间]选项了. 那这到底是为什么呢?别急,结合概念一看就明白啦. NTP全称网 ...
- Spark Streaming的实时词频和累加词频统计
(注:运行环境是Ubuntu16, pycharm) 1. 按时段统计:获取scoket端口传输的数据(英文数据即可,方便分词),统计各个时间段内每个单词出现的次数(每个时间段都分别统计,需要使用的关 ...
- win系统常用命令
windows常用命令 net user 用户名 密码 /add (建立用户) net localgroup administrators 用户名 /add (将用户加到管理员,使其拥有管理权限) n ...
- IDEA 2019.2.2破解激活方法(激活到2089年8月,亲测有效)
本来笔者这边是有个正版激活码可以使用的,但是,2019.9月3号的时候,一些小伙伴反映这个注册码已经失效了,于是拿着自己的 IDEA, 赶快测试了一下,果不其然,已然是不能用了. 好在,笔者又找到了新 ...