mirror of
https://github.com/netdata/libbpf.git
synced 2026-11-08 20:00:43 +08:00
libbpf: Introduce bpf_prog_stream_read() API
Introduce a libbpf API so that users can read data from a given BPF stream for a BPF prog fd. For now, only the low-level syscall wrapper is provided, we can add a bpf_program__* accessor as a follow up if needed. Acked-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20250703204818.925464-11-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
1 parent
9bb5c46da4
commit
c2850a3840
3 files changed
+42
No files matched your search
@@ -709,6 +709,27 @@ struct bpf_token_create_opts {
|
||||
LIBBPF_API int bpf_token_create(int bpffs_fd,
|
||||
struct bpf_token_create_opts *opts);
|
||||
|
||||
struct bpf_prog_stream_read_opts {
|
||||
size_t sz;
|
||||
size_t :0;
|
||||
};
|
||||
#define bpf_prog_stream_read_opts__last_field sz
|
||||
/**
|
||||
* @brief **bpf_prog_stream_read** reads data from the BPF stream of a given BPF
|
||||
* program.
|
||||
*
|
||||
* @param prog_fd FD for the BPF program whose BPF stream is to be read.
|
||||
* @param stream_id ID of the BPF stream to be read.
|
||||
* @param buf Buffer to read data into from the BPF stream.
|
||||
* @param buf_len Maximum number of bytes to read from the BPF stream.
|
||||
* @param opts optional options, can be NULL
|
||||
*
|
||||
* @return The number of bytes read, on success; negative error code, otherwise
|
||||
* (errno is also set to the error code)
|
||||
*/
|
||||
LIBBPF_API int bpf_prog_stream_read(int prog_fd, __u32 stream_id, void *buf, __u32 buf_len,
|
||||
struct bpf_prog_stream_read_opts *opts);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user