Skip to content
BSD syscall#436

svc · unix #436

pid_shutdown_sockets

Force-closes the open network sockets of the target process; used by the system to evict background apps from the network.

Prototype

int pid_shutdown_sockets(int pid, int level);

Returns: int

Arguments

NameTypeDirDescription
pidint-
levelint-

Version history

XNU tagmacOS#
xnu-1699.24.8macOS 10.7 Lion436
xnu-2050.18.24macOS 10.8 Mountain Lion436
xnu-4570.1.46macOS 10.13 High Sierra436
xnu-4903.221.2macOS 10.14 Mojave436
xnu-6153.11.26macOS 10.15 Catalina436
xnu-7195.50.7.100.1macOS 11.0 Big Sur436
xnu-8019.41.5macOS 12.0 Monterey436
xnu-8792.41.9macOS 13.0 Ventura436
xnu-10002.1.13macOS 14.0 Sonoma436
xnu-11215.1.10macOS 15.0 Sequoia436
xnu-11417.101.15macOS 15.4 Sequoia436
xnu-12377.1.9macOS 26.0 Tahoe436
xnu-10002.41.9—436
xnu-10002.61.3—436
xnu-10002.81.5—436
xnu-10063.101.15—436
xnu-10063.121.3—436
xnu-10063.141.1—436
xnu-11215.41.3—436
xnu-11215.61.5—436
xnu-11215.81.4—436
xnu-11417.121.6—436
xnu-11417.140.69—436
xnu-12377.101.15—436
xnu-12377.41.6—436
xnu-12377.61.12—436
xnu-12377.81.4—436
xnu-1699.22.73—436
xnu-1699.22.81—436
xnu-1699.24.23—436
xnu-1699.26.8—436
xnu-1699.32.7—436
xnu-2050.22.13—436
xnu-2050.24.15—436
xnu-2050.48.11—436
xnu-2050.7.9—436
xnu-2050.9.2—436
xnu-4570.20.62—436
xnu-4570.31.3—436
xnu-4570.41.2—436
xnu-4570.51.1—436
xnu-4570.61.1—436
xnu-4570.71.2—436
xnu-4903.231.4—436
xnu-4903.241.1—436
xnu-4903.270.47—436
xnu-6153.101.6—436
xnu-6153.121.1—436
xnu-6153.141.1—436
xnu-6153.41.3—436
xnu-6153.61.1—436
xnu-6153.81.5—436
xnu-7195.101.1—436
xnu-7195.121.3—436
xnu-7195.141.2—436
xnu-7195.60.75—436
xnu-7195.81.3—436
xnu-8019.61.5—436
xnu-8019.80.24—436
xnu-8020.101.4—436
xnu-8020.121.3—436
xnu-8020.140.41—436
xnu-8792.61.2—436
xnu-8792.81.2—436
xnu-8796.101.5—436
xnu-8796.121.2—436
xnu-8796.141.3—436

Notes

Takes a pid and a level flag (SHUTDOWN_SOCKET_LEVEL_DISCONNECT_SVC, _ALL, _ALL_FOR_RESUME). nsurlsessiond and the cellular/Wi-Fi assertion daemons call it when a process loses its network entitlement or its NetworkExtension assertion. Affected sockets return ENOTCONN / EPIPE on subsequent I/O.

Related APIs

shutdownclosenecp_session_actionpid_suspend