File tree 3 files changed +13
-8
lines changed
tools/testing/selftests/bpf/progs
3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -274,8 +274,13 @@ struct task_group;
274
274
275
275
#define get_current_state () READ_ONCE(current->__state)
276
276
277
- /* Task command name length: */
278
- #define TASK_COMM_LEN 16
277
+ /*
278
+ * Define the task command name length as enum, then it can be visible to
279
+ * BPF programs.
280
+ */
281
+ enum {
282
+ TASK_COMM_LEN = 16 ,
283
+ };
279
284
280
285
extern void scheduler_tick (void );
281
286
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: GPL-2.0
2
2
// Copyright (c) 2018 Facebook
3
3
4
- #include <linux/bpf .h>
4
+ #include <vmlinux .h>
5
5
#include <bpf/bpf_helpers.h>
6
6
7
7
#ifndef PERF_MAX_STACK_DEPTH
@@ -41,11 +41,11 @@ struct {
41
41
/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
42
42
struct sched_switch_args {
43
43
unsigned long long pad ;
44
- char prev_comm [16 ];
44
+ char prev_comm [TASK_COMM_LEN ];
45
45
int prev_pid ;
46
46
int prev_prio ;
47
47
long long prev_state ;
48
- char next_comm [16 ];
48
+ char next_comm [TASK_COMM_LEN ];
49
49
int next_pid ;
50
50
int next_prio ;
51
51
};
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: GPL-2.0
2
2
// Copyright (c) 2017 Facebook
3
3
4
- #include <linux/bpf .h>
4
+ #include <vmlinux .h>
5
5
#include <bpf/bpf_helpers.h>
6
6
7
7
/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
8
8
struct sched_switch_args {
9
9
unsigned long long pad ;
10
- char prev_comm [16 ];
10
+ char prev_comm [TASK_COMM_LEN ];
11
11
int prev_pid ;
12
12
int prev_prio ;
13
13
long long prev_state ;
14
- char next_comm [16 ];
14
+ char next_comm [TASK_COMM_LEN ];
15
15
int next_pid ;
16
16
int next_prio ;
17
17
};
You can’t perform that action at this time.
0 commit comments