#pragma once #include #include #include namespace ligma { namespace utils { inline void iterate_memory(const std::function&, const std::string& protection)>& callback) { std::fstream maps("/proc/self/maps"); std::pair memory_range; std::string page_perms; while (maps >> memory_range.first >> memory_range.second >> page_perms) { maps.ignore(std::numeric_limits::max(), '\n'); // skip to next line :) callback(memory_range, page_perms); } maps.close(); } } }