kfifo_in_spinlocked(9)
π kfifo_in_spinlocked β kernel API manual, but make it cute
okay so bestie, welcome to the kfifo_in_spinlocked(9) page π this is a kernel API manual entry, and honestly? it's a small one, but it's iconic. it does exactly one thing and it does it with a spinlock, which is the most "i have main character energy but i also need to be thread-safe" move ever. periodt.
β¨ NAME β¨
kfifo_in_spinlocked β put data into the fifo using a spinlock for locking ππ«
like, that's the whole vibe. you got data, you got a fifo, and you got a spinlock holding it down so nothing gets messy. no cap.
πΈ SYNOPSIS πΈ
kfifo_in_spinlocked (fifo , buf , n , lock );
yes she's a macro, yes she takes four things, yes the spacing is a little funky, we don't judge π
π¦ ARGUMENTS π¦
fifoβ address of the fifo to be used. this is your girl, your container, the whole point πbufβ the data to be added. this is what you're sliding in there β¨nβ number of elements to be added. how many lil guys are we talking πlockβ pointer to the spinlock to use for locking. pointer, bestie, it's a pointer π
π§ DESCRIPTION π§
so here's the tea β this macro copies the given values buffer into the fifo, and then it returns the number of copied elements. that's it. that's the whole function. she's efficient, she's locked, she's slaying π
and reminder: the return value is literally the count of what actually got copied, so don't be out here assuming it's always n, because it is not claiming that π
π SEE ALSO π
the full kfifo friend group, assembled, in original order, no one left out π«Ά this is the group chat and everyone's here:
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(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)
also, the kernel file lives at ./include/linux/kfifo.h β that's the home base, the source of truth, go read her π
ok one tiny note bestie: this page literally just says the macro copies the values buffer in and returns the number of copied elements. that's the entire description. no extra lore, no hidden mechanics have been invented here, so don't come for me if you wanted more tea π i'm just telling you what the page tells you, fr fr.
and that's the page!! π ty for coming to my ted talk, go forth and fifo responsibly. this lil beauty is from ./include/linux, dated October 2026, and it's the kfifo_in_spinlocked(9) page β mwah πβπ
π¦ 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