hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/tools/perf/trace/beauty/sched_policy.c
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+// SPDX-License-Identifier: LGPL-2.1
22 #include <sched.h>
33
44 /*
....@@ -17,6 +17,8 @@
1717 static size_t syscall_arg__scnprintf_sched_policy(char *bf, size_t size,
1818 struct syscall_arg *arg)
1919 {
20
+ bool show_prefix = arg->show_string_prefix;
21
+ const char *prefix = "SCHED_";
2022 const char *policies[] = {
2123 "NORMAL", "FIFO", "RR", "BATCH", "ISO", "IDLE", "DEADLINE",
2224 };
....@@ -26,13 +28,13 @@
2628
2729 policy &= SCHED_POLICY_MASK;
2830 if (policy <= SCHED_DEADLINE)
29
- printed = scnprintf(bf, size, "%s", policies[policy]);
31
+ printed = scnprintf(bf, size, "%s%s", show_prefix ? prefix : "", policies[policy]);
3032 else
3133 printed = scnprintf(bf, size, "%#x", policy);
3234
3335 #define P_POLICY_FLAG(n) \
3436 if (flags & SCHED_##n) { \
35
- printed += scnprintf(bf + printed, size - printed, "|%s", #n); \
37
+ printed += scnprintf(bf + printed, size - printed, "|%s%s", show_prefix ? prefix : "", #n); \
3638 flags &= ~SCHED_##n; \
3739 }
3840