Also where would I get the values for this xx:yy pair from? On Sunday, June 30, 2019 at 7:37:09 AM UTC-4, Waldek Kozaczuk wrote: > > We could. But that could be a separate patch. For now I do not care about > it. > > Do you have strong objections to commit this patch without the device-I’d? > It is enough to fix my GraalVM example. > > Sent from my iPhone > > On Jun 30, 2019, at 04:34, Nadav Har'El <n...@scylladb.com> wrote: > > Looks good to me, but I wonder, together with the inode, shouldn't we also > save the device id, so we can print that too (that is the 00:00 we print > now)? > > -- > Nadav Har'El > n...@scylladb.com > > > On Sun, Jun 30, 2019 at 7:14 AM Waldemar Kozaczuk <jwkozac...@gmail.com> > wrote: > >> This patch refines the implementation of procfs >> to generate maps file that contains correct file i-node >> numbers instead of 0s for file VMAs as shown below: >> >> 0-0 ---p 00000000 00:00 0 >> 100000000000-100000001000 r--p 00000000 00:00 3 /libvdso.so >> 100000001000-100000002000 r-xp 00001000 00:00 3 /libvdso.so >> 100000002000-100000003000 r--p 00002000 00:00 3 /libvdso.so >> 100000003000-100000004000 r--p 00002000 00:00 3 /libvdso.so >> 100000004000-100000005000 rw-p 00003000 00:00 3 /libvdso.so >> 100000005000-100000007000 r--p 00000000 00:00 6 /cat >> 100000007000-10000000c000 r-xp 00002000 00:00 6 /cat >> 10000000c000-10000000e000 r--p 00007000 00:00 6 /cat >> 10000000f000-100000010000 r--p 00009000 00:00 6 /cat >> 100000010000-100000011000 rw-p 0000a000 00:00 6 /cat >> 200000000000-200000001000 ---p 00000000 00:00 0 >> 200000001000-200000100000 rw-p 00000000 00:00 0 >> 200000100000-200000101000 ---p 00000000 00:00 0 >> 200000101000-200000200000 rw-p 00000000 00:00 0 >> 800000000000-800000000000 ---p 00000000 00:00 0 >> >> It does so by capturing and saving the file i-node number when >> constructing file_vma so that it can be used when generating >> /proc/self/maps. >> >> Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> >> --- >> core/mmu.cc | 10 +++++++++- >> include/osv/mmu.hh | 2 ++ >> 2 files changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/core/mmu.cc b/core/mmu.cc >> index 575834ca..c37cc1a5 100644 >> --- a/core/mmu.cc >> +++ b/core/mmu.cc >> @@ -1679,6 +1679,14 @@ file_vma::file_vma(addr_range range, unsigned >> perm, unsigned flags, fileref file >> if (err != 0) { >> throw make_error(err); >> } >> + >> + struct stat st; >> + err = _file->stat(&st); >> + if (err != 0) { >> + throw make_error(err); >> + } >> + >> + _file_inode = st.st_ino; >> } >> >> void file_vma::fault(uintptr_t addr, exception_frame *ef) >> @@ -1910,7 +1918,7 @@ std::string procfs_maps() >> 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); >> + osv::fprintf(os, "%08x 00:00 %ld %s\n", f_vma.offset(), >> f_vma.file_inode(), f_vma.file()->f_dentry->d_path); >> } else { >> osv::fprintf(os, "00000000 00:00 0\n"); >> } >> diff --git a/include/osv/mmu.hh b/include/osv/mmu.hh >> index e6a3f008..54ebf6f1 100644 >> --- a/include/osv/mmu.hh >> +++ b/include/osv/mmu.hh >> @@ -93,10 +93,12 @@ public: >> virtual void fault(uintptr_t addr, exception_frame *ef) override; >> fileref file() const { return _file; } >> f_offset offset() const { return _offset; } >> + u64 file_inode() const { return _file_inode; } >> private: >> f_offset offset(uintptr_t addr); >> fileref _file; >> f_offset _offset; >> + u64 _file_inode; >> }; >> >> ulong map_jvm(unsigned char* addr, size_t size, size_t align, >> balloon_ptr b); >> -- >> 2.20.1 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "OSv Development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to osv-dev+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/osv-dev/20190630041405.4350-1-jwkozaczuk%40gmail.com >> . >> For more options, visit https://groups.google.com/d/optout. >> >
-- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/5684a16f-4f1f-4094-a20b-f5859d19dbef%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.