wait_task_stopped(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay so bestie, this is wait_task_stopped(9) from the Kernel API Manual, and it's literally here to Wait for %TASK_STOPPED or %TASK_TRACED. no cap. πŸ’…

✨ SYNOPSIS ✨

int wait_task_stopped (struct wait_opts *wo , int ptrace , struct
       task_struct *p );

copy that signature exactly, bestie β€” commas, spaces, semicolon, all of it. 🫢

🌸 ARGUMENTS 🌸

  • wo β€” wait options. the options bag, basically.
  • ptrace β€” is the wait for ptrace.
  • p β€” task to wait for. the task we're waiting on, periodt.

πŸ’… DESCRIPTION πŸ’…

So the job is: handle sys_wait4 work for p in state TASK_STOPPED or TASK_TRACED. that's it, that's the function. iconic. ✨

πŸ”’ CONTEXT πŸ”’

Context is read_lock(tasklist_lock), which is released if the return value is non-zero. Also, it grabs and releases p->sighand->siglock. so yeah, lock business is happening β€” don't forget it. πŸ’€

🧚 RETURN 🧚

  • 0 β€” the wait condition didn't exist, and the search for other wait conditions should continue. keep looking, bestie. πŸ‘€
  • Non-zero return β€” -errno on failure and p's pid on success. this implies that tasklist_lock is released and the wait condition search should terminate. so stop searching when you see it. πŸ”₯

🌈 SEE ALSO 🌈

Kernel file ./kernel/exit.c β€” go read it, iykyk. πŸ“–


mwah πŸ’‹ β€” source/version: ./kernel; date: October 2026. that's the cute little footer sign-off, bestie, byeeee πŸ«ΆπŸ’–

πŸ“¦ where this page comes from