STRUCT PIPE_INODE_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct pipe_inode_info(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” this one's all about struct pipe_inode_info, which is, like, the data structure behind every pipe in the linux kernel. yes THAT pipe, the one you've been piping ls into grep with since forever. she's the main character fr fr πŸ‘‘


✨ NAME ✨

struct pipe_inode_info β€” a linux kernel pipe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct pipe_inode_info {
    struct mutex mutex;
    wait_queue_head_t rd_wait, wr_wait;
    union pipe_index;
    unsigned int max_usage;
    unsigned int ring_size;
    unsigned int nr_accounted;
    unsigned int readers;
    unsigned int writers;
    unsigned int files;
    unsigned int r_counter;
    unsigned int w_counter;
    bool pseudo_edgetrigger;
  #ifdef CONFIG_WATCH_QUEUE;
    bool note_loss;
  #endif;
    struct anon_pipe_prealloc prealloc;
    struct fasync_struct *fasync_readers;
    struct fasync_struct *fasync_writers;
    struct pipe_buffer *bufs;
    struct user_struct *user;
  #ifdef CONFIG_WATCH_QUEUE;
    struct watch_queue *watch_queue;
  #endif;
 };

like, just look at her. iconic. no notes. πŸ’…


🌸 Members 🌸

time for the member-by-member vibe check, one at a time, no skipping, we're doing ALL of them 🫢

  • mutex β€” the mutex protecting the whole thing. yes, the whole thing. she's the bouncer at the door of this entire struct, respectfully πŸ’€
  • rd_wait β€” the reader wait point, for when the pipe is empty. reader besties hang out here when there's literally nothing to read 😭
  • wr_wait β€” the writer wait point, for when the pipe is full. writer besties queue up here when there's no room left to write πŸ“
  • pipe_index β€” the pipe indeces ✨ (yes, that's the spelling, we keep it, we don't fix it)
  • max_usage β€” The maximum number of slots that may be used in the ring. like a capacity limit but make it ring-buffer core πŸ‘‘
  • ring_size β€” total number of buffers (should be a power of 2). should be. the kernel is trusting you on this one, no cap 🫢
  • nr_accounted β€” The amount this pipe accounts for in user->pipe_bufs. keeping the receipts, ngl 🧾
  • readers β€” number of current readers of this pipe πŸ’–
  • writers β€” number of current writers of this pipe πŸ’œ
  • files β€” number of struct file referring this pipe (protected by ->i_lock). note the lock, bestie, that detail matters πŸ”₯
  • r_counter β€” reader counter
  • w_counter β€” writer counter
  • pseudo_edgetrigger β€” has an EPOLLET consumer, enable per-write wakeups. so basically sarahah but for wakeups ✨
  • note_loss β€” The next read should insert a data-lost message. lowkey ominous of her but okay πŸ’€ (this one only exists #ifdef CONFIG_WATCH_QUEUE;)
  • prealloc β€” per-pipe page preallocation pool. she pre-games. she prepares. we love a planner πŸŽ€
  • fasync_readers β€” reader side fasync
  • fasync_writers β€” writer side fasync
  • bufs β€” the circular array of pipe buffers. circular!! she goes around!! 🌈
  • user β€” the user who created this pipe. credit where credit is due πŸ‘‘
  • watch_queue β€” If this pipe is a watch_queue, this is the stuff for that. very "iykyk" of her πŸ’… (again, only #ifdef CONFIG_WATCH_QUEUE;)

⭐ SEE ALSO ⭐

Kernel file ./include/linux/pipe_fs_i.h β€” and the whole friend group, go say hi:


ok that's the whole page, you ate that honestly. go forth and pipe things 🫢

mwah πŸ’‹ this page lives in ./include/linux, dated October 2026, and yes the footer says struct pipe_inode_info(9) β€” that's her name, don't wear it out 🌸✨

πŸ“¦ where this page comes from