1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:25:06 +00:00

Kernel: Add a /proc/all process table dump.

This will be useful for implementing some process-related utilities.
This commit is contained in:
Andreas Kling 2019-02-03 18:53:18 +01:00
parent dddd0e7b03
commit b51031bb54
5 changed files with 83 additions and 4 deletions

View file

@ -781,7 +781,7 @@ void MemoryManager::unregister_region(Region& region)
m_regions.remove(&region);
}
size_t Region::committed() const
size_t Region::amount_resident() const
{
size_t bytes = 0;
for (size_t i = 0; i < page_count(); ++i) {
@ -791,6 +791,17 @@ size_t Region::committed() const
return bytes;
}
size_t Region::amount_shared() const
{
size_t bytes = 0;
for (size_t i = 0; i < page_count(); ++i) {
auto& physical_page = m_vmo->physical_pages()[first_page_index() + i];
if (physical_page && physical_page->retain_count() > 1)
bytes += PAGE_SIZE;
}
return bytes;
}
PageDirectory::~PageDirectory()
{
ASSERT_INTERRUPTS_DISABLED();