Expand description
The process at the other end of a local connection, pinned: held so that it names that one process for as long as it is kept, never another that later runs under the same pid.
Each platform pins it its own way, and every pin answers the same questions: which process
it is (Pinned::pid), whether it still runs (Pinned::alive), whether a pid and start
another part of the system names are it (Pinned::is), and, for a tokio caller, when it
ends ([Pinned::exited]).
- Linux: the pidfd the kernel hands for the socket’s peer (
SO_PEERPIDFD), which refers to that task alone and becomes readable when it exits. - macOS: the peer’s pid (
LOCAL_PEERPID), with its start time read before and after a kqueueNOTE_EXITwatch is set on it: the same start on both sides means the watch is on the process that connected, not one that took its pid after it. - Windows: the pipe’s client process (
GetNamedPipeClientProcessId), opened as a handle and then checked against the pipe: while the pipe is still connected the process holding its end runs, so the handle is that process and not one that reused its pid. - Android, whose kernel pins no process behind a socket: only this process, which runs while it asks. A peer that is any other process is pinned by nothing.
Structs§
- Pinned
- A process pinned at the other end of a connection. Clones share the one pin.