> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man4/dtrace_priv.4.md).

# dtrace\_priv.4

`dtrace_priv` — 用于内核权限检查 API 的 DTrace 提供者

## 名称

`dtrace_priv`

## 概要

`priv:kernel:priv_check:priv-ok priv:kernel:priv_check:priv-err`

## 描述

`priv` 提供者允许跟踪 [priv(9)](/man/man9/priv.9.md) API。

`priv`:kernel:priv\_check:priv-ok 探测在内核权限检查成功时触发。

`priv`:kernel:priv\_check:priv-err 探测在内核权限检查失败时触发。

`priv` 探测的唯一参数 `args[0]` 是所请求的权限编号 Ft int priv。

## 实例

### 实例 1：跟踪内核权限检查失败

以下脚本捕获一个计数器数组，每个计数器对应一条导致内核权限检查失败的栈回溯：

```sh
priv:::priv-err
{
	@traces[stack()] = count();
}
```

## 参见

[dtrace(1)](/man/man1/dtrace.1.md), [tracing(7)](/man/man7/tracing.7.md), [priv(9)](/man/man9/priv.9.md), [SDT(9)](https://github.com/FreeBSD-Ask/freebsd-man-sc/tree/main/man9/sdt.9.md)

## 作者

`priv` 提供者由 Robert N. M. Watson <rwatson@FreeBSD.org> 编写。

本手册页由 Mateusz Piotrowski <0mp@FreeBSD.org> 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man4/dtrace_priv.4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
