diff options
author | Steve Muckle <smuckle@google.com> | 2019-12-06 17:08:09 -0800 |
---|---|---|
committer | Steve Muckle <smuckle@google.com> | 2019-12-27 13:39:23 -0800 |
commit | 373a3cadd7d0d221e1c3e1976a0fb0c6a1c34f9f (patch) | |
tree | a90243c25eed12c77d41e35b6360b34be770f36f /libmodprobe/libmodprobe_ext.cpp | |
parent | ee08c978d2d34b3ddac420f9cbdc6ec65286c1e8 (diff) |
libmodprobe: parse kernel command line for module options
Bug: 145808811
Test: atest libmodprobe_tests, verify on flame
Change-Id: I0b41b1610fe13ae526d38f029da888f6f0d8a02d
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 8bebe4c9f..99472c14d 100644 --- a/libmodprobe/libmodprobe_ext.cpp +++ b/libmodprobe/libmodprobe_ext.cpp @@ -17,11 +17,20 @@ #include <sys/stat.h> #include <sys/syscall.h> +#include <android-base/file.h> #include <android-base/logging.h> #include <android-base/unique_fd.h> #include <modprobe/modprobe.h> +std::string Modprobe::GetKernelCmdline(void) { + std::string cmdline; + if (!android::base::ReadFileToString("/proc/cmdline", &cmdline)) { + return ""; + } + return cmdline; +} + bool Modprobe::Insmod(const std::string& path_name, const std::string& parameters) { android::base::unique_fd fd( TEMP_FAILURE_RETRY(open(path_name.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC))); |