kfifo_out_linear(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kfifo_out_linear(9) β€” like, the kernel API manual, but make it make sense

okay so real talk bestie, this one's from the Kernel API Manual and it's genuinely not scary, i promise 🫢 it's a macro. a little macro. and it's about to make your linear data processing slay.


✨ NAME ✨

kfifo_out_linear β€” gets a tail of/offset to available data πŸ‘‘


🌸 SYNOPSIS 🌸

kfifo_out_linear (fifo , tail , n );

πŸŽ€ ARGUMENTS πŸŽ€

  • fifo β€” address of the fifo to be used. yes bestie, the actual fifo, hand it over πŸ’–
  • tail β€” pointer to an unsigned int to store the value of tail. it's a pointer, so we're writing through it, not copying it, okay? πŸ¦‹
  • n β€” max. number of elements to point at. like a cap. a limit. a "girl, don't go past this" number 🎯

πŸ¦‹ DESCRIPTION πŸ¦‹

so this macro does the cute thing where it obtains the offset (tail) to the available data in the fifo buffer, and then it returns the numbers of elements available. two jobs, one macro, main character energy fr fr ✨

here's the part that's lowkey iconic: it returns the available count till the end of data or till the end of the buffer. whichever comes first. so you can literally use it for linear data processing β€” the manpage's own example is a memcpy of (fifo->data + tail) with the count returned. yes. that. exactly that. slay πŸ’…

⚠️ important caveat, do not skip: note that with only one concurrent reader and one concurrent writer, you don't need extra locking to use these macro. one reader, one writer, that's the vibe. more than that? you're on your own, bestie 😭

🌈 SEE ALSO 🌈

the whole friend group, no cap β€” Kernel file ./include/linux/kfifo.h plus:


πŸ’€ one more time for the people in the back: kfifo_out_linear_ptr(9) is a different function. don't @ me. iykyk 🧚

and that's the whole page, bestie! this one came from ./include/linux, dated October 2026 β€” so go forth, process your data linearly, and remember: one reader, one writer, no extra locking needed πŸ’œβ­πŸ“

πŸ“¦ where this page comes from