Thread (31 messages) read the whole thread 31 messages, 4 authors, 2021-04-10

Re: [PATCHv2 bpf-next 02/15] bpf: Add minimal bpf() command documentation

From: Yonghong Song <hidden>
Date: 2021-03-03 22:57:35
Also in: bpf, linux-man


On 3/2/21 9:19 AM, Joe Stringer wrote:
Introduce high-level descriptions of the intent and return codes of the
bpf() syscall commands. Subsequent patches may further flesh out the
content to provide a more useful programming reference.

Acked-by: Toke Høiland-Jørgensen <redacted>
Reviewed-by: Quentin Monnet <redacted>
Signed-off-by: Joe Stringer <redacted>
With a nit to update NOTES section,
Acked-by: Yonghong Song <redacted>
quoted hunk ↗ jump to hunk
---
  include/uapi/linux/bpf.h | 368 +++++++++++++++++++++++++++++++++++++++
  1 file changed, 368 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index fb16c590e6d9..052bbfe65f77 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -204,6 +204,374 @@ union bpf_iter_link_info {
   *		A new file descriptor (a nonnegative integer), or -1 if an
   *		error occurred (in which case, *errno* is set appropriately).
   *
+ * BPF_OBJ_PIN
+ *	Description
+ *		Pin an eBPF program or map referred by the specified *bpf_fd*
+ *		to the provided *pathname* on the filesystem.
+ *
+ *	Return
+ *		Returns zero on success. On error, -1 is returned and *errno*
+ *		is set appropriately.
+ *
+ * BPF_OBJ_GET
+ *	Description
+ *		Open a file descriptor for the eBPF object pinned to the
+ *		specified *pathname*.
+ *
+ *	Return
+ *		A new file descriptor (a nonnegative integer), or -1 if an
+ *		error occurred (in which case, *errno* is set appropriately).
+ *
[...]
+ * BPF_PROG_BIND_MAP
+ *	Description
+ *		Bind a map to the lifetime of an eBPF program.
+ *
+ *		The map identified by *map_fd* is bound to the program
+ *		identified by *prog_fd* and only released when *prog_fd* is
+ *		released. This may be used in cases where metadata should be
+ *		associated with a program which otherwise does not contain any
+ *		references to the map (for example, embedded in the eBPF
+ *		program instructions).
+ *
+ *	Return
+ *		Returns zero on success. On error, -1 is returned and *errno*
+ *		is set appropriately.
+ *
   * NOTES
   *	eBPF objects (maps and programs) can be shared between processes.
   *	For example, after **fork**\ (2), the child inherits file descriptors
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help