forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/tools/perf/trace/beauty/prctl.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: LGPL-2.1
12 /*
23 * trace/beauty/prctl.c
34 *
45 * 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)
76 */
87
98 #include "trace/beauty/beauty.h"
....@@ -12,16 +11,17 @@
1211
1312 #include "trace/beauty/generated/prctl_option_array.c"
1413
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)
1617 {
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);
1919 }
2020
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)
2222 {
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);
2525 }
2626
2727 size_t syscall_arg__scnprintf_prctl_arg2(char *bf, size_t size, struct syscall_arg *arg)
....@@ -29,7 +29,7 @@
2929 int option = syscall_arg__val(arg, 0);
3030
3131 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);
3333 /*
3434 * We still don't grab the contents of pointers on entry or exit,
3535 * so just print them as hex numbers
....@@ -78,5 +78,5 @@
7878 if (option < ARRAY_SIZE(masks))
7979 arg->mask |= masks[option];
8080
81
- return prctl__scnprintf_option(option, bf, size);
81
+ return prctl__scnprintf_option(option, bf, size, arg->show_string_prefix);
8282 }