sk_wait_data(9)
π€ sk_wait_data(9) β the kernel API manual, bestie edition π€
okay so bestie, welcome to sk_wait_data(9), straight out of the Kernel API Manual. this is the little guy that sits there and waits for data to show up at sk_receive_queue. it's giving patient main character energy fr fr π
πΈ NAME πΈ
sk_wait_data β wait for data to arrive at sk_receive_queue β¨
π¦ SYNOPSIS π¦
int sk_wait_data (struct sock *sk , long *timeo , const struct sk_buff
*skb );
like, exactly that, no cap. copy it character for character, the kernel does NOT do typos π
π ARGUMENTS π
skβ the sock to wait on π this is the one doing the waiting, okay?timeoβ for how long β³ yes queen, tell it your patience levelskbβ the last skb seen onsk_receive_queueπ the most recent one you clocked on the queue
π₯ DESCRIPTION π₯
so here's the tea π΅ β now socket state, including sk->sk_err, is changed only under lock, hence we may omit checks after joining the wait queue. like, the locking situation is handled, so we don't gotta double-check after we join. slay.
and we check the receive queue before schedule only as an optimization β¨ it is very likely that release_sock added new data, so likeβ¦ we peek first because chances are there's already something there. lowkey smart, highkey iconic π§
ngl bestie, do NOT go adding extra checks thinking you're helping β the whole point is that the state is only touched under lock, so the post-join-queue checks just aren't needed π
π SEE ALSO π
Kernel file ./net/core/sock.c:
sk_ns_capable(9)sk_capable(9)sk_net_capable(9)sk_set_memalloc(9)sk_alloc(9)sk_clone(9)skb_page_frag_refill(9)__sk_mem_raise_allocated(9)__sk_mem_schedule(9)__sk_mem_reduce_allocated(9)__sk_mem_reclaim(9)
go read them all, iykyk π
mwah π this page lives in ./net/core and it's dated October 2026 β that's the version/date flex, periodt. now go wait for your data like a good little socket π«Ά
π¦ 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