> 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/man9/p_cansee.9.md).

# p\_cansee.9

`p_cansee` — 确定进程的可见性

## 名称

`p_cansee`

## 概要

```c
#include <sys/proc.h>
```

```c
int
p_cansee(struct thread *td, struct proc *p)
```

## 描述

此函数确定给定进程 `p` 是否对线程 `td` 可见，其中“可见性”的概念可理解为“对其存在的感知”。

此函数明确允许线程始终能看到自己的进程，即使有挂起的凭证更改（参见 [ucred(9)](/man/man9/ucred.9.md)）。否则，它简单地交给 [cr\_cansee(9)](/man/man9/cr_cansee.9.md) 处理。

## 返回值

`p_cansee` 函数如果由 `p` 表示的进程对线程 `td` 可见，则返回 `0`，否则返回 ESRCH。

## 错误

**\[ESRCH]** 线程 `td` 不是进程 `p` 的一部分，并且根据 [cr\_cansee(9)](/man/man9/cr_cansee.9.md) 的判定无法看到它。

## 参见

[cr\_cansee(9)](/man/man9/cr_cansee.9.md), [p\_candebug(9)](/man/man9/p_candebug.9.md), [ucred(9)](/man/man9/ucred.9.md)


---

# 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/man9/p_cansee.9.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.
