Skip to content

Commit

Permalink
mmu: show path and offset for file-mapped vma
Browse files Browse the repository at this point in the history
Signed-off-by: Zifei Tong <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
  • Loading branch information
zifeitong authored and Pekka Enberg committed Jul 23, 2014
1 parent 8fb28d3 commit dbdd63a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/mmu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1764,8 +1764,13 @@ std::string procfs_maps()
char write = vma.perm() & perm_write ? 'w' : '-';
char execute = vma.perm() & perm_exec ? 'x' : '-';
char priv = 'p';
osv::fprintf(os, "%x-%x %c%c%c%c 00000000 00:00 0\n",
vma.start(), vma.end(), read, write, execute, priv);
osv::fprintf(os, "%x-%x %c%c%c%c ", vma.start(), vma.end(), read, write, execute, priv);
if (vma.flags() & mmap_file) {
const file_vma &f_vma = static_cast<file_vma&>(vma);
osv::fprintf(os, "%08x 00:00 0 %s\n", f_vma.offset(), f_vma.file()->f_dentry->d_path);
} else {
osv::fprintf(os, "00000000 00:00 0\n");
}
}
}
return os.str();
Expand Down
2 changes: 2 additions & 0 deletions include/osv/mmu.hh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public:
virtual error sync(uintptr_t start, uintptr_t end) override;
virtual int validate_perm(unsigned perm);
virtual void fault(uintptr_t addr, exception_frame *ef) override;
fileref file() const { return _file; }
f_offset offset() const { return _offset; }
private:
f_offset offset(uintptr_t addr);
fileref _file;
Expand Down

0 comments on commit dbdd63a

Please sign in to comment.