* defs.h (struct mmap_cache_t): add major and minor fields.
* mmap_cache.c: record device major and minor numbers.

Signed-off-by: Masatake YAMATO <yam...@redhat.com>
---
 defs.h       | 3 +++
 mmap_cache.c | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/defs.h b/defs.h
index 5b42590f..0bf9a8c7 100644
--- a/defs.h
+++ b/defs.h
@@ -733,12 +733,15 @@ struct mmap_cache_t {
         * end_addr    is 0x7fabbb09f000
         * mmap_offset is 0x179000
         * protections is MMAP_CACHE_PROT_READABLE|MMAP_CACHE_PROT_EXECUTABLE
+        * major       is 0xfc
+        * minor       is 0x00
         * binary_filename is "/lib/libc-2.11.1.so"
         */
        unsigned long start_addr;
        unsigned long end_addr;
        unsigned long mmap_offset;
        unsigned char protections;
+       unsigned long major, minor;
        char *binary_filename;
 };
 
diff --git a/mmap_cache.c b/mmap_cache.c
index bb474b1f..33226784 100644
--- a/mmap_cache.c
+++ b/mmap_cache.c
@@ -83,12 +83,15 @@ build_mmap_cache(struct tcb *tcp)
                char write_bit;
                char exec_bit;
                char shared_bit;
+               unsigned long major, minor;
                char binary_path[sizeof(buffer)];
 
-               if (sscanf(buffer, "%lx-%lx %c%c%c%c %lx %*x:%*x %*d %[^\n]",
+               if (sscanf(buffer, "%lx-%lx %c%c%c%c %lx %lx:%lx %*d %[^\n]",
                           &start_addr, &end_addr,
                           &read_bit, &write_bit, &exec_bit, &shared_bit,
-                          &mmap_offset, binary_path) != 8)
+                          &mmap_offset,
+                          &major, &minor,
+                          binary_path) != 10)
                        continue;
 
                /* skip mappings having unknown protection */
@@ -144,6 +147,8 @@ build_mmap_cache(struct tcb *tcp)
                        | ((exec_bit   == 'x')? MMAP_CACHE_PROT_EXECUTABLE: 0)
                        | ((shared_bit == 's')? MMAP_CACHE_PROT_SHARED    : 0)
                        );
+               entry->major = major;
+               entry->minor = minor;
                entry->binary_filename = xstrdup(binary_path);
                tcp->mmap_cache_size++;
        }
-- 
2.14.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to