wait_event_cmd(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_cmd β€” the kernel API manual, but make it make sense ✨

ok so bestie, welcome to the wait_event_cmd(9) page πŸ’– this is a page from the Kernel API Manual, and it's genuinely one of the cutest lil' sleep-until-something-happens helpers in the whole waitqueue family. let's get into it πŸŽ€


✨ SYNOPSIS ✨

wait_event_cmd (wq_head , condition , cmd1 , cmd2 );

that's the whole shape of it, no cap πŸ‘‘ four things go in, and the vibe is "wait here until condition says go, and run a lil command on each side of the nap."


🌸 ARGUMENTS 🌸

  • wq_head β€” the waitqueue you're waiting on. this is your spot in the group chat where you're lurking until someone pings you 🫢
  • condition β€” a C expression for the event you're waiting for. it stays false, you stay asleep. it flips true, you're up πŸ’…
  • cmd1 β€” the command that gets executed before sleep. like your lil pre-nap routine 🧚
  • cmd2 β€” the command that gets executed after sleep. the post-nap stretch, iconic 🌸

πŸ¦‹ DESCRIPTION πŸ¦‹

ok so here's the tea: the process gets put to sleep in TASK_UNINTERRUPTIBLE until the condition evaluates to true πŸ”₯ and every single time the waitqueue wq_head gets woken up, that condition gets checked again β€” like a vibe check but for your wait state ⭐

⚠️ important one, bestie: wake_up has to be called after changing any variable that could change the result of the wait condition. otherwise your process is just gonna keep napping forever and nobody wants that 😭

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/wait.h β€” and honestly the whole waitqueue friend group is here, they're all so iconic:


and that's the page, bestie 🫢 this one lives in ./include/linux, dated October 2026, straight out of the Kernel API Manual β€” go take a nap, you earned it πŸ’œ

πŸ“¦ where this page comes from