kfifo_from_user(9)
πΈ kfifo_from_user β the group-chat recap
okay so this is from the Kernel API Manual, section 9 (the kernel API girlies know π ), and honestly? it's giving "smuggle data from user space into the fifo" and i'm obsessed.
β¨ NAME β¨
kfifo_from_user β literally puts some data from user space into the fifo π«Ά no cap, that's the whole job.
π SYNOPSIS π
kfifo_from_user (fifo , from , len , copied );
like yes bestie it's a macro, yes it takes four things, yes the spacing is iconic, don't touch it π
β ARGUMENTS β
fifoβ the address of the fifo you're gonna use. your main character fifo. the one we're filling πfromβ pointer to the data to be added. this is where the good stuff comes from β¨lenβ the length of the data to be added. how much we're yeeting in π¦copiedβ pointer to an output variable that stores the number of copied bytes. yes, it writes back to you. it's a two-way conversation fr fr πΈ
π₯ DESCRIPTION π₯
so this macro copies at most len bytes from from into the fifo, depending on the available space, and returns -EFAULT / 0. that's it, that's the vibe check π
ok important caveat bestie, listen up π«Ά β with only one concurrent reader and one concurrent writer, you don't need extra locking to use these macro. one reader, one writer, no extra locks, periodt. anything more chaotic than that and you're on your own π
π SEE ALSO π
Kernel file ./include/linux/kfifo.h β and the whole extended kfifo friend group, because nobody does it alone:
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(9)kfifo_in_spinlocked_noirqsave(9)kfifo_out(9)kfifo_out_spinlocked(9)kfifo_out_spinlocked_noirqsave(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)
π ok that's the page!! sourced from./include/linux, dated October 2026, and it's filed underkfifo_from_user(9)in case you need to find it again. mwah, go copy some bytes responsibly bestie πβ¨π§
π¦ 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