From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

procfs: Add device ID information to the maps file

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/core/mmu.cc b/core/mmu.cc
--- a/core/mmu.cc
+++ b/core/mmu.cc
@@ -1687,6 +1687,7 @@ file_vma::file_vma(addr_range range, unsigned perm, unsigned flags, fileref file
     }

     _file_inode = st.st_ino;
+    _file_dev_id = st.st_dev;
 }

 void file_vma::fault(uintptr_t addr, exception_frame *ef)
@@ -1918,7 +1919,9 @@ 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 %ld %s\n", f_vma.offset(), f_vma.file_inode(), f_vma.file()->f_dentry->d_path);
+                unsigned dev_id_major = major(f_vma.file_dev_id());
+                unsigned dev_id_minor = minor(f_vma.file_dev_id());
+ osv::fprintf(os, "%08x %02x:%02x %ld %s\n", f_vma.offset(), dev_id_major, dev_id_minor, 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
--- a/include/osv/mmu.hh
+++ b/include/osv/mmu.hh
@@ -94,11 +94,13 @@ public:
     fileref file() const { return _file; }
     f_offset offset() const { return _offset; }
     u64 file_inode() const { return _file_inode; }
+    dev_t file_dev_id() const { return _file_dev_id; }
 private:
     f_offset offset(uintptr_t addr);
     fileref _file;
     f_offset _offset;
     u64 _file_inode;
+    dev_t _file_dev_id;
 };

ulong map_jvm(unsigned char* addr, size_t size, size_t align, balloon_ptr b);

--
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/000000000000e506bb058ca972bb%40google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to