[PATCH v1] changing mmap flags and memfd_create flags to print abbreviated values under -Xraw

shankarapailoor shankarapailoor at gmail.com
Sun Nov 25 15:35:10 UTC 2018


>From 214f62db7086664f13a03f03f4b632ad2aaf5dec Mon Sep 17 00:00:00 2001
From: Shankara Pailoor <shankarapailoor at gmail.com>
Date: Sat, 24 Nov 2018 15:46:38 -0800
Subject: [PATCH v1] changing mmap flags and memfd_create flags to print
 abbreviated values under -Xraw

---
 mem.c          | 8 ++++++++
 memfd_create.c | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/mem.c b/mem.c
index 3e37da19..2665b453 100644
--- a/mem.c
+++ b/mem.c
@@ -76,12 +76,20 @@ SYS_FUNC(brk)
 static void
 print_mmap_flags(kernel_ulong_t flags)
 {
+    if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) {
+        tprintf("%#llx", flags);
+        return;
+    }
+
     printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???");
     flags &= ~MAP_TYPE;

     const unsigned int mask = MAP_HUGE_MASK << MAP_HUGE_SHIFT;
     const unsigned int hugetlb_value = flags & mask;

+    if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
+        return;
+
     flags &= ~mask;
     if (flags) {
         tprints("|");
diff --git a/memfd_create.c b/memfd_create.c
index 1f6a6d6d..375e2179 100644
--- a/memfd_create.c
+++ b/memfd_create.c
@@ -50,6 +50,12 @@ SYS_FUNC(memfd_create)
     unsigned int flags = tcp->u_arg[1];
     const unsigned int mask = MFD_HUGE_MASK << MFD_HUGE_SHIFT;
     const unsigned int hugetlb_value = flags & mask;
+
+    if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) {
+        tprintf("%#llx", flags);
+        return RVAL_DECODED | RVAL_FD;
+    }
+
     flags &= ~mask;

     if (flags || !hugetlb_value)
-- 
2.17.1

I wasn't sure if this patch was received through git send-email as I didn't
notice it in the archive. Apologies if I sent it twice.


Regards,
Shankara Pailoor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20181125/48bba1fb/attachment.html>


More information about the Strace-devel mailing list