BTF (BPF Type Format) parsing and type introspection
BTF (BPF Type Format) parsing and type introspection
(btf-available?)Check if BTF is available on this system.
Returns true if /sys/kernel/btf/vmlinux exists and is readable.
Example: (btf-available?) => true
Check if BTF is available on this system. Returns true if /sys/kernel/btf/vmlinux exists and is readable. Example: (btf-available?) => true
Reverse map: kind number to keyword
Reverse map: kind number to keyword
(find-function btf name)Find a function by name.
Parameters:
Returns function type information or nil.
Example: (find-function btf "sys_read")
Find a function by name. Parameters: - btf: BTF data (from load-btf-file) - name: Function name Returns function type information or nil. Example: (find-function btf "sys_read")
(find-type-by-name btf name)Find type by name.
Parameters:
Returns type information or nil if not found.
Example: (find-type-by-name btf "task_struct")
Find type by name. Parameters: - btf: BTF data (from load-btf-file) - name: Type name to search for Returns type information or nil if not found. Example: (find-type-by-name btf "task_struct")
(get-enum-values btf type-info)Get enum values with names.
Parameters:
Returns vector of enum values with :name added.
Example: (get-enum-values btf enum-type)
Get enum values with names. Parameters: - btf: BTF data (from load-btf-file) - type-info: Enum type information Returns vector of enum values with :name added. Example: (get-enum-values btf enum-type)
(get-func-params btf type-info)Get function parameters with names.
Parameters:
Returns vector of parameters with :name added.
Example: (get-func-params btf func-proto-type)
Get function parameters with names. Parameters: - btf: BTF data (from load-btf-file) - type-info: Function prototype type information Returns vector of parameters with :name added. Example: (get-func-params btf func-proto-type)
(get-function-signature btf func-type)Get function signature with return type and parameter names/types.
Parameters:
Returns map with :return-type, :params.
Example: (get-function-signature btf func-type)
Get function signature with return type and parameter names/types. Parameters: - btf: BTF data (from load-btf-file) - func-type: Function type information Returns map with :return-type, :params. Example: (get-function-signature btf func-type)
(get-struct-members btf type-info)Get struct or union members with names.
Parameters:
Returns vector of members with :name added.
Example: (get-struct-members btf struct-type)
Get struct or union members with names. Parameters: - btf: BTF data (from load-btf-file) - type-info: Struct/union type information Returns vector of members with :name added. Example: (get-struct-members btf struct-type)
(get-type-by-id btf type-id)Get type information by type ID.
Parameters:
Returns type information or nil if not found.
Example: (get-type-by-id btf 42)
Get type information by type ID. Parameters: - btf: BTF data (from load-btf-file) - type-id: Type ID to look up Returns type information or nil if not found. Example: (get-type-by-id btf 42)
(get-type-name btf type-info)Get the name of a type.
Parameters:
Returns the type name string or nil.
Example: (get-type-name btf type-info)
Get the name of a type. Parameters: - btf: BTF data (from load-btf-file) - type-info: Type information (from get-type-by-id) Returns the type name string or nil. Example: (get-type-name btf type-info)
(get-type-size btf type-id)Get the size of a type in bytes.
Parameters:
Returns size in bytes or nil if size is not defined.
Example: (get-type-size btf type-id)
Get the size of a type in bytes. Parameters: - btf: BTF data (from load-btf-file) - type-id: Type ID Returns size in bytes or nil if size is not defined. Example: (get-type-size btf type-id)
(list-types btf kind)List all types of a specific kind.
Parameters:
Returns vector of matching types.
Example: (list-types btf :struct) (list-types btf :func)
List all types of a specific kind. Parameters: - btf: BTF data (from load-btf-file) - kind: Type kind keyword (e.g., :struct, :func, :typedef) Returns vector of matching types. Example: (list-types btf :struct) (list-types btf :func)
(load-btf-file)(load-btf-file path)Load and parse a BTF file.
Parameters:
Returns a map with:
Example: (load-btf-file) (load-btf-file "/sys/kernel/btf/vmlinux")
Load and parse a BTF file. Parameters: - path: Path to BTF file (default: /sys/kernel/btf/vmlinux) Returns a map with: - :header - BTF header information - :strings - String section lookup map - :types - Vector of types indexed by type ID Example: (load-btf-file) (load-btf-file "/sys/kernel/btf/vmlinux")
(resolve-type btf type-id)Resolve a type through typedef/const/volatile/restrict indirections.
Parameters:
Returns the resolved type ID (may be the same if not an indirection).
Example: (resolve-type btf typedef-id)
Resolve a type through typedef/const/volatile/restrict indirections. Parameters: - btf: BTF data (from load-btf-file) - type-id: Type ID to resolve Returns the resolved type ID (may be the same if not an indirection). Example: (resolve-type btf typedef-id)
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |