kfifo_put(9)
π«Ά 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
0if 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:
DECLARE_KFIFO_PTR(9)DECLARE_KFIFO(9)INIT_KFIFO(9)DEFINE_KFIFO(9)kfifo_initialized(9)kfifo_esize(9)kfifo_recsize(9)kfifo_size(9)kfifo_reset(9)kfifo_reset_out(9)kfifo_len(9)kfifo_is_empty(9)kfifo_is_empty_spinlocked(9)kfifo_is_empty_spinlocked_noirqsave(9)kfifo_is_full(9)kfifo_avail(9)kfifo_skip_count(9)kfifo_skip(9)kfifo_peek_len(9)kfifo_alloc(9)kfifo_alloc_node(9)kfifo_free(9)kfifo_init(9)kfifo_get(9)kfifo_peek(9)kfifo_in(9)kfifo_in_spinlocked(9)kfifo_in_spinlocked_noirqsave(9)kfifo_out(9)kfifo_out_spinlocked(9)kfifo_out_spinlocked_noirqsave(9)kfifo_from_user(9)kfifo_to_user(9)kfifo_dma_in_prepare_mapped(9)kfifo_dma_in_finish(9)kfifo_dma_out_prepare_mapped(9)kfifo_dma_out_finish(9)kfifo_out_peek(9)kfifo_out_linear(9)kfifo_out_linear_ptr(9)
like, the whole squad showed up. go read them all, iykyk ππ
π¦ so yeah, that'skfifo_putβ copies a value in, returns0when 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms