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 7char _license[] SEC("license") = "GPL"; 8 9pid_t tgid = 0; 10 11SEC("struct_ops/test_maybe_null_struct_ptr") 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 20SEC(".struct_ops.link") 21struct bpf_testmod_ops testmod_struct_ptr = { 22 .test_maybe_null = (void *)test_maybe_null_struct_ptr, 23}; 24 25