mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +00:00
Add a VMO pointer to VNode.
This way, if anyone tries to map an already mapped file, we share the VMO.
This commit is contained in:
parent
862f108cb5
commit
3b2dcd5929
8 changed files with 59 additions and 10 deletions
|
@ -49,7 +49,7 @@ ByteBuffer procfs$pid_vm(Process& process)
|
|||
{
|
||||
ProcessInspectionScope scope(process);
|
||||
char* buffer;
|
||||
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 80 + 4096, buffer);
|
||||
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 160 + 4096, buffer);
|
||||
memset(buffer, 0, stringImpl->length());
|
||||
char* ptr = buffer;
|
||||
ptr += ksprintf(ptr, "BEGIN END SIZE NAME\n");
|
||||
|
@ -59,12 +59,17 @@ ByteBuffer procfs$pid_vm(Process& process)
|
|||
region->linearAddress.offset(region->size - 1).get(),
|
||||
region->size,
|
||||
region->name.characters());
|
||||
ptr += ksprintf(ptr, "VMO: %s \"%s\" @ %x(%u)\n",
|
||||
region->vmo().is_anonymous() ? "anonymous" : "file-backed",
|
||||
region->vmo().name().characters(),
|
||||
®ion->vmo(),
|
||||
region->vmo().retainCount());
|
||||
for (size_t i = 0; i < region->vmo().page_count(); ++i) {
|
||||
auto& physical_page = region->vmo().physical_pages()[i];
|
||||
ptr += ksprintf(ptr, "P%x%s(%u) ",
|
||||
physical_page ? physical_page->paddr().get() : 0,
|
||||
region->cow_map.get(i) ? "!" : "",
|
||||
physical_page->retain_count()
|
||||
physical_page ? physical_page->retain_count() : 0
|
||||
);
|
||||
}
|
||||
ptr += ksprintf(ptr, "\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue