File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
source_connectors/dynamic_tracer/dynamic_tracing Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 2525
2626#include <linux/sched.h>
2727
28+ // Between linux v6.1 and v6.8, NSEC_PER_SEC is no longer defined by including
29+ // linux/sched.h. This ifndef covers newer kernels that won't have it defined.
30+ // libbpf provides a trace_helpers.h header that provides NSEC_PER_SEC, so it seems
31+ // tools are moving towards defining their own instead of using a linux header for it.
32+ #ifndef NSEC_PER_SEC
33+ #define NSEC_PER_SEC 1000000000ULL
34+ #endif
35+
2836#include "src/stirling/bpf_tools/bcc_bpf/utils.h"
2937
3038// This is how Linux converts nanoseconds to clock ticks.
Original file line number Diff line number Diff line change @@ -896,6 +896,11 @@ std::vector<std::string> GenIncludes() {
896896 return {
897897 // For struct task_struct.
898898 " #include <linux/sched.h>" ,
899+ // NSEC_PER_SEC is not defined within linux/sched.h for
900+ // 6.x kernels, so we define it here.
901+ " #ifndef NSEC_PER_SEC" ,
902+ " #define NSEC_PER_SEC 1000000000ULL" ,
903+ " #endif" ,
899904 };
900905}
901906
You can’t perform that action at this time.
0 commit comments