Programmatically check whether a linux kernel module exists or not at runtime

Posted by dgraziotin on Stack Overflow See other posts from Stack Overflow or by dgraziotin
Published on 2012-10-19T16:47:31Z Indexed on 2012/10/19 17:01 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

I am writing a C daemon, which depends on the existence of two kernel modules in order to do its job. The program does not directly use these (or any other) modules. It only needs them to exist. Therefore, I would like to programmatically check whether these modules are already loaded or not, in order to warn the user at runtime.

Before I start to do things like parsing /proc/modules or lsmod output, does a utility function already exist somewhere? Something like is_module_loaded(const char* name);

I am pretty sure this has been asked before. However, I think I am missing the correct terms to search for this.

Thanks!

© Stack Overflow or respective owner

Related posts about c

    Related posts about kernel-module