# `MaeBPF.Probe`
[🔗](https://github.com/cocoa-xu/MaeBPF/blob/v0.1.0/maebpf/lib/maebpf/probe.ex#L1)

Host kernel capability probing, privilege inspection, and human-readable
feature diagnostics for Linux eBPF environments.

On non-Linux hosts (such as macOS), `capabilities/0` returns a clean
`supported: false` capability map without invoking the Linux NIF.

# `kernel_version`

```elixir
@type kernel_version() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
```

# `capabilities`

```elixir
@spec capabilities() :: {:ok, map()} | {:error, term()}
```

Probes the current host's Linux kernel, BPF feature support, process
capabilities, and `RLIMIT_MEMLOCK`.

On non-Linux platforms (such as `:darwin`), returns `{:ok, %{platform: ..., supported: false, ...}}`.

# `check_requirement`

```elixir
@spec check_requirement(map(), atom()) :: :ok | {:error, String.t()}
```

Checks whether a probed capability map satisfies the kernel version, feature,
privilege, and memory-lock requirements for `feature`.

Returns `:ok` if supported or `{:error, message}` with an actionable
remediation string.

# `format_diagnostic`

```elixir
@spec format_diagnostic(map(), atom()) :: String.t()
```

Formats a human-readable diagnostic summary for `feature` against `caps`.

Returns `"<feature>: supported"` when all requirements pass, or a detailed
remediation string when one or more checks fail.

# `parse_cap_eff`

```elixir
@spec parse_cap_eff(binary()) :: {:ok, map()} | {:error, :invalid_cap_eff}
```

Parses a Linux `CapEff` hex bitmask string or full `/proc/self/status` text
and decodes the BPF-relevant capability flags:

  * `cap_net_admin` (`CAP_NET_ADMIN`, bit 12)
  * `cap_sys_admin` (`CAP_SYS_ADMIN`, bit 21)
  * `cap_perfmon` (`CAP_PERFMON`, bit 38)
  * `cap_bpf` (`CAP_BPF`, bit 39)

# `parse_kernel_release`

```elixir
@spec parse_kernel_release(binary()) ::
  {:ok, kernel_version()} | {:error, :invalid_kernel_release}
```

Parses a Linux `uname -r` kernel release string into `{major, minor, patch}`.

Examples:
  * `"6.18.57-current-rockchip64"` -> `{:ok, {6, 18, 57}}`
  * `"5.15.0"` -> `{:ok, {5, 15, 0}}`
  * `"6.6"` -> `{:ok, {6, 6, 0}}`

# `version_at_least?`

```elixir
@spec version_at_least?(kernel_version(), kernel_version()) :: boolean()
```

Compares two `{major, minor, patch}` kernel version tuples.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
