sk_wait_data(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ 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 level
  • skb β€” the last skb seen on sk_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:

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