| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: LGPL-2.1 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * trace/beauty/prctl.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * Released under the GPL v2. (and only v2, not any later version) |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include "trace/beauty/beauty.h" |
|---|
| .. | .. |
|---|
| 12 | 11 | |
|---|
| 13 | 12 | #include "trace/beauty/generated/prctl_option_array.c" |
|---|
| 14 | 13 | |
|---|
| 15 | | -static size_t prctl__scnprintf_option(int option, char *bf, size_t size) |
|---|
| 14 | +DEFINE_STRARRAY(prctl_options, "PR_"); |
|---|
| 15 | + |
|---|
| 16 | +static size_t prctl__scnprintf_option(int option, char *bf, size_t size, bool show_prefix) |
|---|
| 16 | 17 | { |
|---|
| 17 | | - static DEFINE_STRARRAY(prctl_options); |
|---|
| 18 | | - return strarray__scnprintf(&strarray__prctl_options, bf, size, "%d", option); |
|---|
| 18 | + return strarray__scnprintf(&strarray__prctl_options, bf, size, "%d", show_prefix, option); |
|---|
| 19 | 19 | } |
|---|
| 20 | 20 | |
|---|
| 21 | | -static size_t prctl__scnprintf_set_mm(int option, char *bf, size_t size) |
|---|
| 21 | +static size_t prctl__scnprintf_set_mm(int option, char *bf, size_t size, bool show_prefix) |
|---|
| 22 | 22 | { |
|---|
| 23 | | - static DEFINE_STRARRAY(prctl_set_mm_options); |
|---|
| 24 | | - return strarray__scnprintf(&strarray__prctl_set_mm_options, bf, size, "%d", option); |
|---|
| 23 | + static DEFINE_STRARRAY(prctl_set_mm_options, "PR_SET_MM_"); |
|---|
| 24 | + return strarray__scnprintf(&strarray__prctl_set_mm_options, bf, size, "%d", show_prefix, option); |
|---|
| 25 | 25 | } |
|---|
| 26 | 26 | |
|---|
| 27 | 27 | size_t syscall_arg__scnprintf_prctl_arg2(char *bf, size_t size, struct syscall_arg *arg) |
|---|
| .. | .. |
|---|
| 29 | 29 | int option = syscall_arg__val(arg, 0); |
|---|
| 30 | 30 | |
|---|
| 31 | 31 | if (option == PR_SET_MM) |
|---|
| 32 | | - return prctl__scnprintf_set_mm(arg->val, bf, size); |
|---|
| 32 | + return prctl__scnprintf_set_mm(arg->val, bf, size, arg->show_string_prefix); |
|---|
| 33 | 33 | /* |
|---|
| 34 | 34 | * We still don't grab the contents of pointers on entry or exit, |
|---|
| 35 | 35 | * so just print them as hex numbers |
|---|
| .. | .. |
|---|
| 78 | 78 | if (option < ARRAY_SIZE(masks)) |
|---|
| 79 | 79 | arg->mask |= masks[option]; |
|---|
| 80 | 80 | |
|---|
| 81 | | - return prctl__scnprintf_option(option, bf, size); |
|---|
| 81 | + return prctl__scnprintf_option(option, bf, size, arg->show_string_prefix); |
|---|
| 82 | 82 | } |
|---|