call a kernel module function from program at user space

前端 未结 4 1198
别跟我提以往
别跟我提以往 2020-12-08 01:32

I developed a kernel module and some functions on it. Now i need to develop a program in the user space and call some functions which are in the kernel module.

I als

4条回答
  •  抹茶落季
    2020-12-08 02:01

    As other posters have mentioned, there is a clear distinction between kernel and user space. So no you can't call a kernel function directly from user space. I think the easiest way to send messages between userspace and kernel space is via netlink sockets. A netlink socket allows you to easily pass arbitrary data structures between user level and kernel level.

    Yes ioctl, system calls are viable alternatives, they are not as flexible as the netlink socket for passing arbitrary information.

提交回复
热议问题