Skip to documentation
SLOP

tiny.sys.PulseControlStorage

Reference tiny.sys PulseControlStorage

Defined in pulse.

API (13)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

No direct callersNo direct callspulseControlStorage
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/sys/src/pulse.zig:109

zig
pub const ControlStorage = struct {    phase: alloc_phase.capacity.Phase,    capacity: ControlCapacity,    bytes: []u8,    pub const Limits: type = ControlLimits;    pub const Capacity: type = ControlCapacity;    pub const Exhaustion = error{ControlPayloadCapacityExceeded};    pub const InitError = std.mem.Allocator.Error || error{CapacityOverflow};    pub const claim: alloc_phase.capacity.Declaration = .{        .source = .{            .id = "sys.pulse_control_storage",            .kind = .phase_static,            .limit_source = .caller,            .storage = .{                .covered = &.{                    .{                        .id = "one_reusable_pulseaudio_control_payload_region",                        .lifetime = .steady,                        .detail = "one reusable PulseAudio control payload region",                    },                },                .excluded = &.{                    "socket and kernel buffers, stream handles, and PulseAudio server state",                    "caller-owned PCM frames and fixed frame-header stack values",                    "process environment, cookie file handle, and fixed cookie stack bytes",                },            },            .capacity = .{                .inputs = &.{                    alloc_phase.capacity.bindInput(ControlLimits, "inbound_control_payload_bytes", "inbound_control_payload_bytes"),                    alloc_phase.capacity.bindInput(ControlLimits, "client_name_bytes", "client_name_bytes"),                    alloc_phase.capacity.bindInput(ControlLimits, "channels", "channels"),                },                .type_selectors = &.{},                .nodes = &.{                    .{ .input = 0 },                    .{ .input = 1 },                    .{ .input = 2 },                    .{ .scale = .{ .node = 2, .coefficient = .{ .literal = 4 } } },                    .{ .add = .{ .left = 1, .right = 3 } },                    .{ .maximum = .{ .left = 0, .right = 4 } },                },                .assertions = &.{.{                    .scope = .closure_total,                    .measure = .retained,                    .relation = .exact,                    .expression = 5,                }},            },            .overload = .{                .kind = .reject_before_mutation,                .detail = "oversize payloads reject before reusable bytes mutate",            },            .risks = .{                .transitive = .{                    .status = .open,                    .detail = "playback control traverses separate stream and environment owners",                },                .foreign = .{                    .status = .open,                    .detail = "control I/O enters socket, kernel, and PulseAudio server storage",                },            },            .obligations = &.{                .{ .key = "sys_pulse_control_capacity", .role = .capacity_model },                .{ .key = "sys_pulse_control_oom_retry", .role = .custom },                .{ .key = "sys_pulse_control_sealed", .role = .overload },                .{ .key = "sys_pulse_control_semantics", .role = .custom },                .{ .key = "sys_pulse_control_drain", .role = .custom },            },        },        .bindings = .{            .owner = @This(),            .seal = .{                .family = alloc_phase.capacity.selector(@This().activate),                .premise = .{                    .class = .checked_semantic_fact,                    .authority = .checker,                },            },            .teardown = .{                .family = alloc_phase.capacity.selector(@This().deinit),                .premise = .{                    .class = .checked_semantic_fact,                    .authority = .checker,                },            },        },    };    pub fn init(allocator: std.mem.Allocator, limits: ControlLimits) InitError!ControlStorage {        const capacity = try ControlCapacity.derive(limits);        const bytes = if (capacity.storage_bytes == 0)            @as([]u8, &.{})        else            try allocator.alloc(u8, capacity.storage_bytes);        return .{            .phase = .initialization,            .capacity = capacity,            .bytes = bytes,        };    }    pub fn activate(self: *ControlStorage) void {        std.debug.assert(self.phase == .initialization);        std.debug.assert(self.bytes.len == self.capacity.storage_bytes);        self.phase = .steady;    }    pub fn inbound(self: *ControlStorage, length: usize) Exhaustion![]u8 {        std.debug.assert(self.phase != .teardown);        if (length > self.capacity.inbound_control_payload_bytes) {            return error.ControlPayloadCapacityExceeded;        }        return self.bytes[0..length];    }    pub fn outbound(self: *ControlStorage, length: usize) Exhaustion![]u8 {        std.debug.assert(self.phase != .teardown);        if (length > self.capacity.outbound_control_payload_bytes) {            return error.ControlPayloadCapacityExceeded;        }        return self.bytes[0..length];    }    pub fn deinit(self: *ControlStorage, allocator: std.mem.Allocator) void {        std.debug.assert(self.phase != .teardown);        std.debug.assert(self.bytes.len == self.capacity.storage_bytes);        self.phase = .teardown;        if (self.bytes.len != 0) allocator.free(self.bytes);        self.bytes = &.{};    }};

Source: lib/sys/src/root.zig:62

zig
pub const PulseControlStorage = @import("pulse.zig").ControlStorage;
Called byCallsNo direct callstest sourcelib.sys.src.pulsetest: pulse control storage is sealed...test sourcelib.sys.src.pulsetest: pulse control storage retries a...PulseControlStorageactivate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callspulse.Playbackclosepulse.Playbackopenprivate sourcelib.sys.src.pulsecheckControlStorageInitFailurestest sourcelib.sys.src.pulsetest: pulse control storage is sealed...test sourcelib.sys.src.pulsetest: pulse control storage retries a...PulseControlStoragedeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.sys.src.pulse.PlaybackreadControltest sourcelib.sys.src.pulsetest: pulse control storage is sealed...PulseControlStorageinbound
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callspulse.Playbackopenprivate sourcelib.sys.src.pulsecheckControlStorageInitFailurestest sourcelib.sys.src.pulsetest: pulse control storage is sealed...test sourcelib.sys.src.pulsetest: pulse control storage retries a...test sourcelib.sys.src.pulsetest: pulse playback drains through s...PulseControlStorageinit
Static calls · unresolved targets: 1 · external targets: 1.
Called byCallsNo direct callsprivate sourcelib.sys.src.pulse.Playbackauthenticateprivate sourcelib.sys.src.pulse.PlaybackcreateStreampulse.Playbackdrainprivate sourcelib.sys.src.pulse.PlaybacksetClientNametest sourcelib.sys.src.pulsetest: pulse control storage is sealed...PulseControlStorageoutbound
Static calls · unresolved targets: 0 · external targets: 0.

Audit

Definitions11
Public names22
Members4
Version26.7.0
Revisiondaab053ee433