miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
pipe_t Struct Reference

#include <pipe.h>

Public Attributes

uint8_t buf [PIPE_SIZE]
uint32_t write_pos
uint32_t read_pos
uint32_t ref_count
uint8_t write_closed

Detailed Description

pipe_t - Kernel object for an anonymous pipe.

Uses monotonically increasing uint32_t cursors (never reset). The actual buffer index is cursor % PIPE_SIZE. This eliminates the full/empty ambiguity that plagues same-value-cursor designs.

Available bytes = write_pos - read_pos Free space = PIPE_SIZE - (write_pos - read_pos)

uint32_t overflow at 2^32 wraps cleanly because PIPE_SIZE is a power of 2 and all arithmetic is unsigned modulo 2^32.

Member Data Documentation

◆ buf

uint8_t pipe_t::buf[PIPE_SIZE]

◆ read_pos

uint32_t pipe_t::read_pos

◆ ref_count

uint32_t pipe_t::ref_count

◆ write_closed

uint8_t pipe_t::write_closed

◆ write_pos

uint32_t pipe_t::write_pos

The documentation for this struct was generated from the following file: