diff options
Diffstat (limited to 'libmodprobe/libmodprobe_ext.cpp')
-rw-r--r-- | libmodprobe/libmodprobe_ext.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libmodprobe/libmodprobe_ext.cpp b/libmodprobe/libmodprobe_ext.cpp index 5f3a04da8..8cbd08c5a 100644 --- a/libmodprobe/libmodprobe_ext.cpp +++ b/libmodprobe/libmodprobe_ext.cpp @@ -51,6 +51,15 @@ bool Modprobe::Insmod(const std::string& path_name) { return true; } +bool Modprobe::Rmmod(const std::string& module_name) { + int ret = syscall(__NR_delete_module, MakeCanonical(module_name).c_str(), O_NONBLOCK); + if (ret != 0) { + PLOG(ERROR) << "Failed to remove module '" << module_name << "'"; + return false; + } + return true; +} + bool Modprobe::ModuleExists(const std::string& module_name) { struct stat fileStat; auto deps = GetDependencies(module_name); |