1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ 3 #include <vmlinux.h> 4 #include <bpf/bpf_tracing.h> 5 #include "../bpf_testmod/bpf_testmod.h" 6 7 char _license[] SEC("license") = "GPL"; 8 9 pid_t tgid = 0; 10 11 SEC("struct_ops/test_maybe_null_struct_ptr") BPF_PROG(test_maybe_null_struct_ptr,int dummy,struct task_struct * task)12int BPF_PROG(test_maybe_null_struct_ptr, int dummy, 13 struct task_struct *task) 14 { 15 tgid = task->tgid; 16 17 return 0; 18 } 19 20 SEC(".struct_ops.link") 21 struct bpf_testmod_ops testmod_struct_ptr = { 22 .test_maybe_null = (void *)test_maybe_null_struct_ptr, 23 }; 24 25