How to load Linux kernel modules from C code?

后端 未结 5 1507
心在旅途
心在旅途 2020-12-05 14:39

I have an application that has both two external kernel modules and a userspace daemon. I want to load the modules from the daemon code, written in C, at startup, and unload

5条回答
  •  醉梦人生
    2020-12-05 14:57

    I'm not sure there's a cleaner way than system.

    But for sure, if you want to load/unload the modules from your userspace daemon, then you force yourself to run the daemon as root*, which may not be considered as secure.

    *: or you can add the explicit commands in the sudoers file, but this will be a nightmare to manage when deploying your application.

提交回复
热议问题