From: Shankara Pailoor Date: Mon, 26 Nov 2018 01:10:44 +0000 (-0800) Subject: memfd_create: add xlat styles support X-Git-Tag: v4.26~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f11fb909d7f44536557ee34b2d4f645131c9fb4c;p=strace memfd_create: add xlat styles support * memfd_create.c (SYS_FUNC(memfd_create)): Respect xlat_verbosity. Co-Authored-by: Dmitry V. Levin --- diff --git a/memfd_create.c b/memfd_create.c index 1f6a6d6d..a2859aeb 100644 --- a/memfd_create.c +++ b/memfd_create.c @@ -48,17 +48,31 @@ SYS_FUNC(memfd_create) tprints(", "); unsigned int flags = tcp->u_arg[1]; + + if (!flags || xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV) + tprintf("%#x", flags); + + if (!flags || xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) + return RVAL_DECODED | RVAL_FD; + + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE) + tprints(" /* "); + const unsigned int mask = MFD_HUGE_MASK << MFD_HUGE_SHIFT; const unsigned int hugetlb_value = flags & mask; flags &= ~mask; if (flags || !hugetlb_value) - printflags(memfd_create_flags, flags, "MFD_???"); + printflags_ex(flags, "MFD_???", XLAT_STYLE_ABBREV, + memfd_create_flags, NULL); if (hugetlb_value) tprintf("%s%u<> MFD_HUGE_SHIFT); + if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE) + tprints(" */"); + return RVAL_DECODED | RVAL_FD; }