Skip to main content

fd_soft_limit

Function fd_soft_limit 

Source
pub fn fd_soft_limit() -> Option<u64>
Expand description

The process’s soft limit on open file descriptors, or None if it has none.

Every tunnel holds one, so this is the ceiling the tunnel quota has to fit under: exhausting it does not degrade the proxy gracefully, it makes every accept, connect and socket call fail at once, including the ones the QUIC endpoint needs. Checked at startup against limits.max_targets_per_conn rather than discovered at 3am.

getrlimit needs no cfg split: it is POSIX and present on both the Linux production host and the macOS dev host. It also cannot fail for a resource the kernel always knows about, which is why rustix’s wrapper returns no Result — so None here is RLIM_INFINITY rather than a failed read: the process has no ceiling at all, and there is nothing for the startup check to compare a budget against. See crate::quic’s warn_if_fd_budget_is_tight, which treats that as room to spare.