Linux 内核 net_proto_family
来源:互联网 发布:ros mac禁止 编辑:程序博客网 时间:2024/06/06 09:11
.family = PF_INET,
.create = inet_create,
.owner = THIS_MODULE,
};
(void)sock_register(&inet_family_ops);
/**
* sock_register - add a socket protocol handler
* @ops: description of protocol
*
* This function is called by a protocol handler that wants to
* advertise its address family, and have it linked into the
* socket interface. The value ops->family corresponds to the
* socket system call protocol family.
*/
int sock_register(const struct net_proto_family *ops)
{
int err;
if (ops->family >= NPROTO) {
pr_crit("protocol %d >= NPROTO(%d)\n", ops->family, NPROTO);
return -ENOBUFS;
}
spin_lock(&net_family_lock);
if (rcu_dereference_protected(net_families[ops->family],
lockdep_is_held(&net_family_lock)))
err = -EEXIST;
else {
rcu_assign_pointer(net_families[ops->family], ops);
err = 0;
}
spin_unlock(&net_family_lock);
pr_info("NET: Registered protocol family %d\n", ops->family);
return err;
}
void sock_unregister(int family)
{
BUG_ON(family < 0 || family >= NPROTO);
spin_lock(&net_family_lock);
RCU_INIT_POINTER(net_families[family], NULL);
spin_unlock(&net_family_lock);
synchronize_rcu();
pr_info("NET: Unregistered protocol family %d\n", family);
}
EXPORT_SYMBOL(sock_unregister);
static const struct net_proto_family inet6_family_ops = {
.family = PF_INET6,
.create = inet6_create,
.owner = THIS_MODULE,
};
static const struct net_proto_family unix_family_ops = {
.family = PF_UNIX,
.create = unix_create,
.owner = THIS_MODULE,
};
static const struct net_proto_family ipx_family_ops = {
.family = PF_IPX,
.create = ipx_create,
.owner = THIS_MODULE,
};
static const struct net_proto_family packet_family_ops = {
.family = PF_PACKET,
.create = packet_create,
.owner = THIS_MODULE,
};
static const struct net_proto_family netlink_family_ops = {
.family = PF_NETLINK,
.create = netlink_create,
.owner = THIS_MODULE, /* for consistency 8) */
};
static struct net_proto_family nfc_sock_family_ops = {
.owner = THIS_MODULE,
.family = PF_NFC,
.create = nfc_sock_create,
};
static const struct net_proto_family bnep_sock_family_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.create = bnep_sock_create
};
static const struct net_proto_family mISDN_sock_family_ops = {
.owner = THIS_MODULE,
.family = PF_ISDN,
.create = mISDN_sock_create,
};
- Linux 内核 net_proto_family
- Linux内核-内核线程
- linux内核-内核同步
- Linux内核--内核数据类型
- Linux内核:编译内核
- linux-内核-内核定时器
- 如何将一个net_proto_family注册到相应的协议簇
- linux内核
- linux内核
- Linux内核
- linux内核
- Linux内核
- linux内核
- Linux内核
- Linux内核
- LINUX内核
- Linux 内核
- linux内核
- PHP编程效率的20个要点
- 字符的ASCII码
- hdu3257【模拟】
- HTML学习笔记:2 HTML元素
- 类与对象-构造函数
- Linux 内核 net_proto_family
- 嵌入式系统学习(十)-通过直接配置寄存器操作GPIO
- R︱并行计算以及提高运算效率的方式(parallel包、clusterExport函数、SupR包简介)
- js面向对象入门
- 开启OpenStack社区贡献之路
- javaweb 尚硅谷笔记
- 2016-10-1
- 4.线性分类器(二)
- "ORA-00942: 表或视图不存在 "的原因和解决方法(非常好)