@@ -156,6 +156,12 @@ BPF_MAP(_name, BPF_MAP_TYPE_PROG_ARRAY, u32, u32, _max_entries);
156
156
#define BPF_PERF_OUTPUT (_name ) \
157
157
BPF_MAP(_name, BPF_MAP_TYPE_PERF_EVENT_ARRAY, int, __u32, 1024);
158
158
159
+ #ifdef RHEL_RELEASE_CODE
160
+ #if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION (8 , 0 ))
161
+ #define RHEL_RELEASE_GT_8_0
162
+ #endif
163
+ #endif
164
+
159
165
#if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 14 , 0 )
160
166
#error Minimal required kernel version is 4.14
161
167
#endif
@@ -273,7 +279,7 @@ static __always_inline u32 get_task_ns_pid(struct task_struct *task)
273
279
{
274
280
unsigned int level = READ_KERN (READ_KERN (READ_KERN (task -> nsproxy )-> pid_ns_for_children )-> level );
275
281
276
- #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 19 , 0 )
282
+ #if ( LINUX_VERSION_CODE < KERNEL_VERSION (4 , 19 , 0 ) && !defined( RHEL_RELEASE_GT_8_0 ) )
277
283
// kernel 4.14-4.18:
278
284
return READ_KERN (READ_KERN (task -> pids [PIDTYPE_PID ].pid )-> numbers [level ].nr );
279
285
#else
@@ -287,7 +293,7 @@ static __always_inline u32 get_task_ns_tgid(struct task_struct *task)
287
293
unsigned int level = READ_KERN (READ_KERN (READ_KERN (task -> nsproxy )-> pid_ns_for_children )-> level );
288
294
struct task_struct * group_leader = READ_KERN (task -> group_leader );
289
295
290
- #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 19 , 0 )
296
+ #if ( LINUX_VERSION_CODE < KERNEL_VERSION (4 , 19 , 0 ) && !defined( RHEL_RELEASE_GT_8_0 ) )
291
297
// kernel 4.14-4.18:
292
298
return READ_KERN (READ_KERN (group_leader -> pids [PIDTYPE_PID ].pid )-> numbers [level ].nr );
293
299
#else
@@ -301,7 +307,7 @@ static __always_inline u32 get_task_ns_ppid(struct task_struct *task)
301
307
struct task_struct * real_parent = READ_KERN (task -> real_parent );
302
308
unsigned int level = READ_KERN (READ_KERN (READ_KERN (real_parent -> nsproxy )-> pid_ns_for_children )-> level );
303
309
304
- #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 19 , 0 )
310
+ #if ( LINUX_VERSION_CODE < KERNEL_VERSION (4 , 19 , 0 ) && !defined( RHEL_RELEASE_GT_8_0 ) )
305
311
// kernel 4.14-4.18:
306
312
return READ_KERN (READ_KERN (real_parent -> pids [PIDTYPE_PID ].pid )-> numbers [level ].nr );
307
313
#else
0 commit comments