使用netlink之前,先參考一下資料:http://www.ibm.com/developerworks/cn/linux/l-connector/

 

 

 

 

netlink通信機(jī)制介紹:資料來源 linux-4.8.13/Documentation/connector/connector.txt 2016-12-10 21:31:04

/*****************************************/
Kernel Connector.
/*****************************************/

Kernel connector - new netlink based userspace <-> kernel space easy
to use communication module.

The Connector driver makes it easy to connect various agents using a
netlink based network.  One must register a callback and an identifier.
When the driver receives a special netlink message with the appropriate
identifier, the appropriate callback will be called.

From the userspace point of view it's quite straightforward:

    socket();
    bind();
    send();
    recv();

網(wǎng)友評論