MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / format_modules_summary

Function format_modules_summary

src/os/linux/modules.cpp:161–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161ByteBuf format_modules_summary(const Engine& eng) {
162 auto mods = enumerate_modules(eng);
163 if (mods.empty()) {
164 const char msg[] =
165 "; no loaded modules found.\n"
166 "; either the kernel has no out-of-tree modules, or `modules`\n"
167 "; symbol is missing / list walk failed.\n";
168 return ByteBuf(msg, msg + sizeof(msg) - 1);
169 }
170 std::string out;
171 out.reserve(64 * 1024);
172 out += fmt::format("# {} loaded modules. Format:\n", mods.size());
173 out += "# <name> <total_size_kb> <state> <text_base_va> <version>\n";
174 out += "#\n";
175 for (const auto& m : mods) {
176 u64 total = 0;
177 for (const auto& mem : m.mem) total += mem.size;
178 out += fmt::format("{:<24} {:>6} {:<8} {:#018x} {}\n",
179 m.name, total / 1024, state_name(m.state),
180 m.mem[MOD_TEXT].base, m.version);
181 }
182 return ByteBuf(out.begin(), out.end());
183}
184
185ByteBuf format_module_info(const LoadedModule& m) {
186 std::string out;

Callers 1

build_sys_treeFunction · 0.85

Calls 3

enumerate_modulesFunction · 0.85
state_nameFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected