[PATCH v1] changing mmap flags and memfd_create flags to print abbreviated values under -Xraw
shankarapailoor
shankarapailoor at gmail.com
Sun Nov 25 16:15:51 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 v2 1/2] 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
>From f2f887b906b1eac42911f0b77060d95ab13496c8 Mon Sep 17 00:00:00 2001
From: Shankara Pailoor <shankarapailoor at gmail.com>
Date: Sun, 25 Nov 2018 08:08:04 -0800
Subject: [PATCH v2 2/2] fixing mmap xlat verbosity
---
mem.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/mem.c b/mem.c
index 2665b453..37269c1c 100644
--- a/mem.c
+++ b/mem.c
@@ -87,9 +87,6 @@ print_mmap_flags(kernel_ulong_t flags)
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("|");
--
2.17.1
Sorry forgot a second commit.
On Sun, Nov 25, 2018 at 7:35 AM shankarapailoor
<shankarapailoor at gmail.com> wrote:
>
> 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
--
Regards,
Shankara Pailoor
More information about the Strace-devel
mailing list