Is anyone using netlink for IPC?

我只是一个虾纸丫 提交于 2020-02-27 05:42:06

问题


I am planning to use netlink for communication between two userland processes. Part of the reason being so picky about netlink is - Most of the processing for one of the process would eventually go in kernel space and netlink based communication can be used as it is (hopefully).

The approach I am taking is - define a new Generic Netlink family (I will have to write a kernel module just to support that family - as it appears so at the moment). That is fine, I was looking at some example code, where kernel was essentially only routing messages between different processes and not really doing any work - the actual population of those messages is handled by the processes.

My question is - is anyone using netlink in the similar manner in any of the projects? Also - does the above approach makes sense?

I read about a proposal about netlink based DBUS. But haven't found any implementation of that. That comes closest to my requirements.

Thanks.


回答1:


What you are looking for is NETLINK_USERSOCK if you want to communicate between userspace processes.

Netlink documentation is awfully scarce unfortunately. This might help a bit: Who can give me the latest netlink programming samples?

Just make sure nl_pid is non-zero and matches what userspace peer is bind'ed to and that you're sending a unicast.



来源:https://stackoverflow.com/questions/26238160/is-anyone-using-netlink-for-ipc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!