Linux Kernel network system structure (TCP/IP) and source code Layout

Source: Internet
Author: User

The aboveCodeIt is often used in the kernel. "_ attribute _" and "_ Section _" are keywords of the GCC compiler.
The above sectionProgramA Method for initializing a module is provided:

1. If a kernel module needs to be initialized when the system is started, you only need to call "module_init (Function
) "The GCC compiler will put the pointer of this function into a specific code segment (". initcall. init "code segment) when compiling the code );

2. When Linux is started, after the first kernel thread is generated, the do_initcils () function is called. initcall. the first address of the init code segment starts to call the initialization function one by one (there is no parameter for the system-defined initialization function );
From the two steps above, we can see that Linux uses the powerful functions of the GCC compiler to make initialization of modules simple and does not need to be registered in a special place, you only need to call "module_init (
Function) "This code can complete the work. GCC can decide whether to compile to the kernel or compile as a loaded Module Based on the Compilation options.

All source files of network code are stored in the "/net" directory. The core sub-directory under this directory is the core module, including the packet cache, neighbor table, device management, and other sub-modules. "Ethernet" sub-directory implementation 802.3
MAC layer features. The "IPv4" sub-directory implements the TCP/IP protocol, and the "IPv6" sub-directory implements the IPv6 protocol. Other subdirectories are unique in Linux.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.