[−][src]Module solana_rbpf::helpers
This module implements some built-in helpers that can be called from within an eBPF program.
These helpers may originate from several places:
- Some of them mimic the helpers available in the Linux kernel.
- Some of them were proposed as example helpers in uBPF and they were adapted here.
- Other helpers may be specific to rbpf.
The prototype for helpers is always the same: five u64
as arguments, and a u64
as a return
value. Hence some helpers have unused arguments, or return a 0 value in all cases, in order to
respect this convention.
Constants
BPF_KTIME_GETNS_IDX | Index of helper |
BPF_TRACE_PRINTK_IDX | Index of helper |
Functions
bpf_time_getns | Get monotonic time (since boot time) in nanoseconds. All arguments are unused. |
bpf_trace_printf | Prints its last three arguments to standard output. The first two arguments are unused. Returns the number of bytes written. |
gather_bytes | The idea is to assemble five bytes into a single |
memfrob | Same as |
rand | Returns a random u64 value comprised between |
sqrti | Compute and return the square root of argument 1, cast as a float. Arguments 2 to 5 are unused. |
strcmp | C-like |