ring_buffer_poll_wait(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ring_buffer_poll_wait β€” poll on buffer input (yes bestie, it's the kernel API manual, we're doing this) πŸŽ€

okay so real talk: this page lives in the Kernel API Manual section 9, and it's about making a task wait on the tracing ring buffer until there's actually data to read. no busy-looping, no "are we there yet" energy β€” we poll properly. slay. ✨


🌸 SYNOPSIS 🌸

__poll_t ring_buffer_poll_wait (struct trace_buffer *buffer , int cpu ,
       struct file *filp , poll_table *poll_table , int full );

that's the whole signature, no cap. five args, one return type __poll_t. copy it exactly, don't get creative 😌


πŸ¦‹ ARGUMENTS πŸ¦‹

  • buffer β€” the buffer you're waiting on. like, the actual ring buffer object. main character.
  • cpu β€” which cpu buffer you're waiting on. yes, per-cpu, very demure, very mindful.
  • filp β€” the file descriptor. the struct file *. hi bestie πŸ‘‹
  • poll_table β€” the poll descriptor. this is the poll_table * doing the poll-table things.
  • full β€” wait until the percentage of pages are available... but only if cpu != RING_BUFFER_ALL_CPUS. read that condition twice, i'm serious 🫢

πŸ’– DESCRIPTION πŸ’–

here's the vibe check. if cpu == RING_BUFFER_ALL_CPUS, then your task wakes up as soon as data is added to any of the buffer's cpu buffers. any of them. first one to show up wins, basically πŸ’€

otherwise β€” so when it's not RING_BUFFER_ALL_CPUS β€” it waits for data to be added to one specific cpu buffer. no queue-jumping for the other cpus. loyalty. πŸ‘‘

and the return? it returns EPOLLIN | EPOLLRDNORM if data exists in the buffers, and zero otherwise. that's it. that's the whole return contract, bestie, don't overthink it πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

the source of truth is the kernel file ./kernel/trace/ring_buffer.c, and honestly the whole ring buffer friend group shows up here. literally the entire group chat:


✨ reminder bestie: this page is from ./kernel/trace, dated October 2026. that's the footer, iykyk β€” no need to re-read the last line, i already told you πŸ’œ

okay that's the page, go poll something, you're gonna do amazing πŸ§šπŸ’–

πŸ“¦ where this page comes from