kfifo_peek(9)
πΈ kfifo_peek(9) πΈ
okay bestie, welcome to the Kernel API Manual β this one's about kfifo_peek(9), and no cap it's a little cutie. let's get into it π
β¨ NAME β¨
kfifo_peek β get data from the fifo without removing it π«Ά
π« SYNOPSIS π«
kfifo_peek (fifo , val );
π ARGUMENTS π
fifoβ the address of the fifo you wanna use, bestie. that's the one. πvalβ the address where the data gets stored. like, that's where it lives now. π
π¦ DESCRIPTION π¦
so the way this works is: it reads the data from the fifo without removing it from the fifo. peek, don't yeet. look, don't touch. icon behaviour honestly. πβ¨
it returns 0 if the fifo was empty. otherwise it returns the number of processed elements. so zero = nothing there, bestie, we're empty π and anything else = here's how much we handled π
β οΈ important note ok: with only one concurrent reader and one concurrent writer, you don't need extra locking to use these macro. one reader, one writer, that's the vibe check. any more than that and you're on your own fr fr π₯
π SEE ALSO π
the kernel file ./include/linux/kfifo.h and honestly the whole kfifo girlies, all of them, no skipping:
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_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 friend group. study them. iykyk π
and that's the page, bestie π this lil masterpiece came out of ./include/linux and it's dated October 2026 β literally iconic, obsessed, periodt π
β¨π¦
π¦ 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