mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
Add /proc/mm and a /bin/mm utility that just dumps it.
This shows some info about the MM. Right now it's just the zone count and the number of free physical pages. Lots more can be added. Also added "exit" to sh so we can nest shells and exit from them. I also noticed that we were leaking all the physical pages, so fixed that.
This commit is contained in:
@@ -118,6 +118,18 @@ void ProcFileSystem::removeProcess(Task& task)
|
||||
m_pid2inode.remove(pid);
|
||||
}
|
||||
|
||||
ByteBuffer procfs$mm()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
auto buffer = ByteBuffer::createUninitialized(1024);
|
||||
char* ptr = (char*)buffer.pointer();
|
||||
ptr += ksprintf(ptr, "Zone count: %u\n", MM.m_zones.size());
|
||||
ptr += ksprintf(ptr, "Free physical pages: %u\n", MM.m_freePages.size());
|
||||
buffer.trim(ptr - (char*)buffer.pointer());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
ByteBuffer procfs$mounts()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
@@ -171,6 +183,7 @@ ByteBuffer procfs$summary()
|
||||
bool ProcFileSystem::initialize()
|
||||
{
|
||||
SyntheticFileSystem::initialize();
|
||||
addFile(createGeneratedFile("mm", procfs$mm));
|
||||
addFile(createGeneratedFile("mounts", procfs$mounts));
|
||||
addFile(createGeneratedFile("kmalloc", procfs$kmalloc));
|
||||
addFile(createGeneratedFile("summary", procfs$summary));
|
||||
|
||||
Reference in New Issue
Block a user