sock_init函数分析

来源:互联网 发布:下载电脑软件 编辑:程序博客网 时间:2024/06/08 05:05

内核版本为2.6.35.8

static int __init sock_init(void) @net/socket
该函数比较简单
    1,sk_init()// 初始化sock SLAB cathe
    2,skb_init() //初始化skb_buff SLAB cache
    3,init_inodecache(),//初始化一个socket_alloc类型的SLAB,该类型包括了socket和inode,于是socket和inode一一对应,对inode的操作便于转化为socket操作。该SLAB应用于sock_alloc()函数。
    4,register_filesystem(),变量为sock_fs_type//注册一个sock 文件系统,sock_fs_type提供了文件系统必要的操作函数,如get_sb,alloc_inode,destroy_inode等等。
    5,kern_mount(),同为sock_fs_type//挂载上述文件系统
    6,如果定义了netfilter,初始化之.

core_initcall(sock_init);   /* early initcall */  //该函数在初始化时被调用,并且比较早




原创粉丝点击