kfifo_put(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🫢 kfifo_put β€” the Kernel API Manual, bestie edition πŸ’…

okay so bestie, welcome to kfifo_put(9), straight out of the Kernel API Manual ✨ grab a strawberry πŸ“ and let's get into it.


🌸 NAME 🌸

kfifo_put β€” literally just: put data into the fifo. that's the whole assignment. iconic behavior honestly πŸ‘‘


✨ SYNOPSIS ✨

kfifo_put (fifo , val );

yes bestie, that comma is doing the most with those spaces, but it's canon, don't touch it πŸ™ˆ copy it exactly. periodt.


πŸŽ€ ARGUMENTS πŸŽ€

  • fifo β€” the address of the fifo you're gonna use πŸ’– this is the main character, point at it correctly or it's giving πŸ’€
  • val β€” the data you want added in there. the actual payload. the reason we're all here πŸ¦‹

🧚 DESCRIPTION 🧚

okay so what this macro does: it copies the given value into the fifo. simple, clean, no cap πŸ’…

then the return value β€” listen up:

  • it returns 0 if the fifo was full 😭 (tragic, but she's honest about it)
  • otherwise, it returns the number processed elements ✨
πŸ”₯ big caveat, do NOT skip this one: with only one concurrent reader and one concurrent writer, you don't need extra locking to use these macro. note that this blessing is conditional β€” one reader, one writer, that's the vibe check. do not go adding extra readers and writers and expect it to still slay, because the manpage only promised this for that exact setup, fr fr. 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file itself lives at ./include/linux/kfifo.h β€” go say hi to the source, she has lore 🌈

and there's a whole kfifo friend group, all of them:

like, the whole squad showed up. go read them all, iykyk πŸ“šπŸ’œ


πŸ¦‹ so yeah, that's kfifo_put β€” copies a value in, returns 0 when full, returns processed count otherwise, and only avoids needing locking in that one-reader-one-writer setup. go be a good fifo citizen bestie πŸŽ€

🌸 mwah, this page came from the source path ./include/linux, dated October 2026, and it's kfifo_put(9) β€” okay bye, ily, drink some water πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from