xs_connect(9)
π xs_connect β connect a socket to a remote endpoint β¨
okay so real talk, this is a page from the Kernel API Manual (section 9, the kernel-dev girly section, iykyk) and honestly? it's giving "small function, big feelings." it's xs_connect(9), bestie, and we're gonna get into it π«Ά
β¨ SYNOPSIS β¨
void xs_connect (struct rpc_xprt *xprt , struct rpc_task *task );
literally that's it. void, so nothing comes back β no return value, no drama, no receipts. she just does the thing π
π ARGUMENTS π
xprtβ pointer to the transport structure. the transport. the whole vibe carrier. she's astruct rpc_xprt *and she's the main character here.taskβ the address of the RPC task that manages the state of the connect request. so like, the task is the one holding the clipboard and tracking where we are in the whole "are we connected yet" journey πβ¨
π¦ DESCRIPTION π¦
TCP: if the remote end dropped the connection, delay reconnecting. no cap β we're not out here spam-reconnecting the second things get rocky. we wait. we chill. we come back. πΈ
UDP socket connects are synchronous, but we use a work queue anyway β and the reason is lowkey iconic: it guarantees that even unprivileged user processes can set up a socket on a privileged port. yes bestie, the work queue is doing the heavy lifting so regular-degular processes can get a privileged port without needing the fancy permissions π
and if a UDP socket connect fails? the delay behavior here prevents retry floods (hard mounts). π so like, the built-in delay isn't laziness, it's protection β otherwise you'd get a whole flood of retries and nobody wants that kind of chaos, especially on hard mounts. the delay is the vibe check. π
π SEE ALSO π
bestie she has a huge friend group, we're listing every single one, no skipping π«Ά
Kernel file ./net/sunrpc/xprtsock.c and also: xs_nospace(9), xs_local_send_request(9), xs_udp_send_request(9), xs_tcp_send_request(9), xs_error_report(9), xs_close(9), xs_destroy(9), xs_udp_data_read_skb(9), xs_data_ready(9), xs_local_state_change(9), xs_tcp_state_change(9), xs_udp_write_space(9), xs_tcp_write_space(9), xs_udp_set_buffer_size(9), xs_udp_timer(9), xs_set_port(9), xs_local_setup_socket(9), xs_enable_swap(9), xs_disable_swap(9), xs_tcp_shutdown(9), xs_tcp_setup_socket(9), xs_tls_handshake_done(9), xs_tcp_tls_setup_socket(9), xs_local_print_stats(9), xs_udp_print_stats(9), xs_tcp_print_stats(9), bc_send_request(9), xs_setup_local(9), xs_setup_udp(9), xs_setup_tcp(9), xs_setup_tcp_tls(9), xs_setup_bc_tcp(9), init_socket_xprt(9), cleanup_socket_xprt(9) π
ngl the whole squad is in ./net/sunrpc and they all said hi π
β and that's the page!! sourced from ./net/sunrpc, dated October 2026 β so go forth, connect that socket, delay that reconnect, and slay β¨ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms