mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
Fix VMO leak in Process::exec().
Gotta make sure things get cleaned up before we yield-teleport in exec(). Also VMOs and regions are now viewable through /proc/mm and /proc/regions.
This commit is contained in:
parent
cd1e7419f0
commit
7b96218389
4 changed files with 51 additions and 8 deletions
|
@ -171,7 +171,12 @@ ByteBuffer procfs$mm()
|
|||
auto buffer = ByteBuffer::createUninitialized(1024 + 80 * MM.m_vmos.size());
|
||||
char* ptr = (char*)buffer.pointer();
|
||||
for (auto* vmo : MM.m_vmos) {
|
||||
ptr += ksprintf(ptr, "VMO: %p %s (p:%u, r:%u)\n", vmo, vmo->name().characters(), vmo->page_count(), vmo->retainCount());
|
||||
ptr += ksprintf(ptr, "VMO: %p %s(%u): p:%4u %s\n",
|
||||
vmo,
|
||||
vmo->is_anonymous() ? "anon" : "file",
|
||||
vmo->retainCount(),
|
||||
vmo->page_count(),
|
||||
vmo->name().characters());
|
||||
}
|
||||
ptr += ksprintf(ptr, "VMO count: %u\n", MM.m_vmos.size());
|
||||
ptr += ksprintf(ptr, "Free physical pages: %u\n", MM.m_free_physical_pages.size());
|
||||
|
@ -179,6 +184,22 @@ ByteBuffer procfs$mm()
|
|||
return buffer;
|
||||
}
|
||||
|
||||
ByteBuffer procfs$regions()
|
||||
{
|
||||
// FIXME: Implement
|
||||
InterruptDisabler disabler;
|
||||
auto buffer = ByteBuffer::createUninitialized(1024 + 80 * MM.m_regions.size());
|
||||
char* ptr = (char*)buffer.pointer();
|
||||
for (auto* region : MM.m_regions) {
|
||||
ptr += ksprintf(ptr, "Region: %p VMO=%p %s\n",
|
||||
region,
|
||||
®ion->vmo(),
|
||||
region->name.characters());
|
||||
}
|
||||
ptr += ksprintf(ptr, "Region count: %u\n", MM.m_regions.size());
|
||||
buffer.trim(ptr - (char*)buffer.pointer());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
ByteBuffer procfs$mounts()
|
||||
{
|
||||
|
@ -302,6 +323,7 @@ bool ProcFileSystem::initialize()
|
|||
{
|
||||
SyntheticFileSystem::initialize();
|
||||
addFile(createGeneratedFile("mm", procfs$mm));
|
||||
addFile(createGeneratedFile("regions", procfs$regions));
|
||||
addFile(createGeneratedFile("mounts", procfs$mounts));
|
||||
addFile(createGeneratedFile("kmalloc", procfs$kmalloc));
|
||||
addFile(createGeneratedFile("summary", procfs$summary));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue