.\" Automatically generated man page, do not edit .TH QBRB.H 3 2023-07-21 "LIBQB" "libqb Programmer's Manual" .SH NAME qbrb.h \- This implements a ring buffer that works in "chunks", not bytes. .SH SYNOPSIS .nf .B #include .SH DESCRIPTION .PP So you write/read a complete chunk or not at all. There are two types of ring buffer: normal and overwrite. Overwrite will reclaim the oldest chunks inorder to make way for new ones, the normal version will refuse to write a new chunk if the ring buffer is full. .PP This implementation is capable of working across processes, but one process must only write and the other process read. .PP The read process will do the following: .nf rb = qb_rb_open("test2", 2000, QB_RB_FLAG_SHARED_PROCESS|QB_RB_FLAG_CREATE); for (i = 0; i < 200; i++) { try_read_again: l = qb_rb_chunk_read(rb, (void *)out, 32, 1000); if (l < 0) { goto try_read_again; } } \[char46].. qb_rb_close(rb); .fi .PP The write process will do the following: .nf rb = qb_rb_open("test2", 2000, QB_RB_FLAG_SHARED_PROCESS); for (i = 0; i < 200; i++) { try_write_again: l = qb_rb_chunk_write(rb, &v, sizeof(v)); if (l < sizeof(v)) { goto try_write_again; } } \[char46].. qb_rb_close(rb); .fi .SH SEE ALSO .PP .nh .ad l \fIqb_rb_close\fR(3), \fIqb_rb_refcount_get\fR(3), \fIqb_rb_chmod\fR(3), \fIqb_rb_chown\fR(3), \fIqb_rb_open\fR(3), \fIqb_rb_write_to_file\fR(3), \fIqb_rb_create_from_file\fR(3), \fIqb_rb_chunks_used\fR(3), \fIqb_rb_chunk_reclaim\fR(3), \fIqb_rb_space_used\fR(3), \fIqb_rb_chunk_write\fR(3), \fIqb_rb_shared_user_data_get\fR(3), \fIqb_rb_chunk_commit\fR(3), \fIqb_rb_chunk_peek\fR(3), \fIqb_rb_space_free\fR(3), \fIqb_rb_name_get\fR(3), \fIqb_rb_chunk_alloc\fR(3), \fIqb_rb_chunk_read\fR(3) .ad .hy .SH "COPYRIGHT" .PP Copyright (C) 2010-2020 Red Hat, Inc.