MCPcopy Create free account
hub / github.com/MhmRdd/NoHello / devinoby

Function devinoby

module/src/main/cpp/utils.cpp:58–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58std::optional<std::pair<dev_t, ino_t>> devinoby(const char* lib) {
59 struct State {
60 const char* needle;
61 std::optional<std::pair<dev_t, ino_t>> result;
62 } state = { lib };
63
64 dl_iterate_phdr([](struct dl_phdr_info* info, size_t, void* data) -> int {
65 auto* s = static_cast<State*>(data);
66 if (info->dlpi_name && strstr(info->dlpi_name, s->needle)) {
67 struct stat st{};
68 if (stat(info->dlpi_name, &st) == 0) {
69 s->result = std::make_pair(st.st_dev, st.st_ino);
70 return 1; // Stop iteration
71 }
72 }
73 return 0; // Continue
74 }, &state);
75
76 return state.result;
77}
78
79std::optional<std::pair<void*, size_t>> robaseby(dev_t dev, ino_t ino) {
80 struct State {

Callers 1

preSpecializeMethod · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected