I need to get the current system time in my BTF probe. How can I call bpf_ktime_get_boot_ns() on kernels 5.8 and newer, and bpf_ktime_get_ns() on older kernels where bpf_ktime_get_boot_ns is not yet available ?
If possible I'd like to avoid building sets of probes for multiple kernel versions, since there are other similar helpers not available in all kernels, like bpf_probe_read_kernel_str().
I need to get the time from multiple probes, so maybe defining different functions that wrap the bpf_ktime... helpers might work but it doesn't look trivial to implement.
And disassembling the bpf bytecode and patching the call opcodes also doesn't look very appealing.