kfifo_in(9)
π kfifo_in β like, the Kernel API Manual page, but make it make sense π
okay so bestie, this is kfifo_in(9) from the Kernel API Manual β yes, the kernel, the big one, the main character of your whole operating system π§π. It's a macro. It's small. It's iconic. Let's get into it β¨
β¨ NAME β¨
kfifo_in β put data into the fifo π
like literally just yeet your data into the fifo. that's the whole job. slay.
π SYNOPSIS π
kfifo_in (fifo , buf , n );
that's it. three things in, magic out. no cap π«Ά
πΈ ARGUMENTS πΈ
fifoβ the address of the fifo you're gonna use π like, hand me the fifo please, thank you.bufβ the data you want to add. this is the actual stuff going in π¦β¨nβ how many elements you're adding. the count. the amount. the number of little guys π§
π¦ DESCRIPTION π¦
so this macro copies the given buffer into the fifo and returns the number of copied elements π yes, it returns a count β it's giving "here's how much actually made it in", which is highkey useful, iykyk.
β οΈ okay important caveat bestie, listen: with only one concurrent reader and one concurrent writer, you don't need extra locking to use these macro. that's it. that's the deal. don't add locks you don't need, but also don't get cute and add more readers/writers than that and expect it to just work π
literally the whole vibe: one reader, one writer, no locking, we're chilling π
π₯ SEE ALSO π₯
- Kernel file
./include/linux/kfifo.hπ β go read it, it's the source of truth, the blueprint, the origin story 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_put(9)kfifo_get(9)kfifo_peek(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, that's the whole kfifo friend group and they're ALL invited to the group chat π«Άπ
π cute sign-off π
this page lives in ./include/linux, dated October 2026, and it's page kfifo_in(9) of the Kernel API Manual. mwah. go forth and fifo responsibly π
β¨π
π¦ 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