> 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_syscall.4.md).

# dtrace\_syscall.4

`dtrace_syscall` — 用于系统调用的 DTrace 提供者

## 名称

`dtrace_syscall`

## 概要

`syscall:abi:syscall:entry syscall:abi:syscall:return`

## 描述

`syscall` 提供者为系统调用提供入口和返回探测。

探测描述中的模块为 `abi`，用于指示 `syscall` 所属的系统调用 ABI。`syscall` 支持以下系统调用 ABI：

**`freebsd`** 原生 ABI。

**`freebsd32`** 非原生的 32 位 ABI。

**`linux`** 参见 [linux(4)](/man/man4/linux.4.md)。

**`linux32`** 参见 [linux(4)](/man/man4/linux.4.md)。

`entry` 探测的参数为传递给系统调用的参数。

`return` 探测将系统调用的返回值同时存储在 `arg0` 和 `arg1` 中。

检查 [d(7)](/man/man7/d.7.md) 中的 `errno` 变量可判断系统调用是否失败。

## 实例

### 实例 1：统计系统调用次数

以下脚本跟踪所有系统调用，并对系统中每个进程进行计数。

```sh
syscall:::entry {
    @[execname, pid] = count();
}
```

## 参见

[dtrace(1)](/man/man1/dtrace.1.md), intro(2), [tracing(7)](/man/man7/tracing.7.md)

> *The illumos Dynamic Tracing Guide*, 2008, Chapter syscall Provider.

> Brendan Gregg, Jim Mauro, *DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD*, pp. pp. 315-327, Prentice Hall, 2011, Chapter Syscall Provider.

## 作者

本手册页由 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_syscall.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.
