memfd_create: add xlat styles support
* memfd_create.c (SYS_FUNC(memfd_create)): Respect xlat_verbosity. Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
@ -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",
|
||||
flags ? "|" : "",
|
||||
hugetlb_value >> MFD_HUGE_SHIFT);
|
||||
|
||||
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
|
||||
tprints(" */");
|
||||
|
||||
return RVAL_DECODED | RVAL_FD;
|
||||
}
|
||||
|
Reference in New Issue
Block a user