Blame docs/man3/qbrb.h.3

Packit 979a56
.TH "qbrb.h" 3 "Thu Dec 21 2017" "Version 1.0.3" "libqb" \" -*- nroff -*-
Packit 979a56
.ad l
Packit 979a56
.nh
Packit 979a56
.SH NAME
Packit 979a56
qbrb.h \- 
Packit 979a56
.PP
Packit 979a56
This implements a ring buffer that works in 'chunks', not bytes\&.  
Packit 979a56
Packit 979a56
.SH SYNOPSIS
Packit 979a56
.br
Packit 979a56
.PP
Packit 979a56
\fC#include <sys/types\&.h>\fP
Packit 979a56
.br
Packit 979a56
\fC#include <stdint\&.h>\fP
Packit 979a56
.br
Packit 979a56
Packit 979a56
.SS "Macros"
Packit 979a56
Packit 979a56
.in +1c
Packit 979a56
.ti -1c
Packit 979a56
.RI "#define \fBQB_RB_FLAG_CREATE\fP   0x01"
Packit 979a56
.br
Packit 979a56
.RI "\fICreate a ring buffer (rather than open and existing one)\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "#define \fBQB_RB_FLAG_OVERWRITE\fP   0x02"
Packit 979a56
.br
Packit 979a56
.RI "\fINew calls to \fBqb_rb_chunk_write()\fP will call \fBqb_rb_chunk_reclaim()\fP if there is not enough space\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "#define \fBQB_RB_FLAG_SHARED_THREAD\fP   0x04"
Packit 979a56
.br
Packit 979a56
.RI "\fIThe ringbuffer will be shared between pthreads not processes\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "#define \fBQB_RB_FLAG_SHARED_PROCESS\fP   0x08"
Packit 979a56
.br
Packit 979a56
.RI "\fIThe ringbuffer will be shared between processes\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "#define \fBQB_RB_FLAG_NO_SEMAPHORE\fP   0x10"
Packit 979a56
.br
Packit 979a56
.RI "\fIDon't use semaphores, only atomic ops\&. \fP"
Packit 979a56
.in -1c
Packit 979a56
.SS "Typedefs"
Packit 979a56
Packit 979a56
.in +1c
Packit 979a56
.ti -1c
Packit 979a56
.RI "typedef struct qb_ringbuffer_s \fBqb_ringbuffer_t\fP"
Packit 979a56
.br
Packit 979a56
.in -1c
Packit 979a56
.SS "Functions"
Packit 979a56
Packit 979a56
.in +1c
Packit 979a56
.ti -1c
Packit 979a56
.RI "\fBqb_ringbuffer_t\fP * \fBqb_rb_open\fP (const char *name, size_t size, uint32_t flags, size_t shared_user_data_size)"
Packit 979a56
.br
Packit 979a56
.RI "\fICreate the ring buffer with the given type\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "void \fBqb_rb_close\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIDereference the ringbuffer and, if we are the last user, destroy it\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "char * \fBqb_rb_name_get\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIGet the name of the ringbuffer\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "void * \fBqb_rb_shared_user_data_get\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIGet a point to user shared data area\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_chunk_write\fP (\fBqb_ringbuffer_t\fP *rb, const void *data, size_t len)"
Packit 979a56
.br
Packit 979a56
.RI "\fIWrite a chunk to the ring buffer\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "void * \fBqb_rb_chunk_alloc\fP (\fBqb_ringbuffer_t\fP *rb, size_t len)"
Packit 979a56
.br
Packit 979a56
.RI "\fIAllocate space for a chunk of the given size\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "int32_t \fBqb_rb_chunk_commit\fP (\fBqb_ringbuffer_t\fP *rb, size_t len)"
Packit 979a56
.br
Packit 979a56
.RI "\fIFinalize the chunk\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_chunk_peek\fP (\fBqb_ringbuffer_t\fP *rb, void **data_out, int32_t ms_timeout)"
Packit 979a56
.br
Packit 979a56
.RI "\fIRead (without reclaiming) the last chunk\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "void \fBqb_rb_chunk_reclaim\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIReclaim the oldest chunk\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_chunk_read\fP (\fBqb_ringbuffer_t\fP *rb, void *data_out, size_t len, int32_t ms_timeout)"
Packit 979a56
.br
Packit 979a56
.RI "\fIRead the oldest chunk into data_out\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "int32_t \fBqb_rb_refcount_get\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIGet the reference count\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_space_free\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIThe amount of free space in the ring buffer\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_space_used\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIThe total amount of data in the buffer\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_chunks_used\fP (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
.br
Packit 979a56
.RI "\fIThe total number of chunks in the buffer\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "ssize_t \fBqb_rb_write_to_file\fP (\fBqb_ringbuffer_t\fP *rb, int32_t fd)"
Packit 979a56
.br
Packit 979a56
.RI "\fIWrite the contents of the Ring Buffer to file\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "\fBqb_ringbuffer_t\fP * \fBqb_rb_create_from_file\fP (int32_t fd, uint32_t flags)"
Packit 979a56
.br
Packit 979a56
.RI "\fILoad the saved ring buffer from file into tempory memory\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "int32_t \fBqb_rb_chown\fP (\fBqb_ringbuffer_t\fP *rb, uid_t owner, gid_t group)"
Packit 979a56
.br
Packit 979a56
.RI "\fILike 'chown', it changes the owner and group of the ringbuffer's resources\&. \fP"
Packit 979a56
.ti -1c
Packit 979a56
.RI "int32_t \fBqb_rb_chmod\fP (\fBqb_ringbuffer_t\fP *rb, mode_t mode)"
Packit 979a56
.br
Packit 979a56
.RI "\fILike 'chmod', it changes the mode of the ringbuffer's resources\&. \fP"
Packit 979a56
.in -1c
Packit 979a56
.SH "Detailed Description"
Packit 979a56
.PP 
Packit 979a56
This implements a ring buffer that works in 'chunks', not bytes\&. 
Packit 979a56
Packit 979a56
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\&.
Packit 979a56
.PP
Packit 979a56
This implementation is capable of working across processes, but one process must only write and the other process read\&.
Packit 979a56
.PP
Packit 979a56
The read process will do the following: 
Packit 979a56
.PP
Packit 979a56
.nf
Packit 979a56
*       rb = qb_rb_open("test2", 2000, QB_RB_FLAG_SHARED_PROCESS|QB_RB_FLAG_CREATE);
Packit 979a56
*       for (i = 0; i < 200; i++) {
Packit 979a56
* try_read_again:
Packit 979a56
*               l = qb_rb_chunk_read(rb, (void *)out, 32, 1000);
Packit 979a56
*               if (l < 0) {
Packit 979a56
*                       goto try_read_again;
Packit 979a56
*               }
Packit 979a56
*       }
Packit 979a56
*       \&.\&.\&.
Packit 979a56
*       qb_rb_close(rb);
Packit 979a56
* 
Packit 979a56
* 
Packit 979a56
Packit 979a56
.fi
Packit 979a56
.PP
Packit 979a56
.PP
Packit 979a56
The write process will do the following: 
Packit 979a56
.PP
Packit 979a56
.nf
Packit 979a56
*       rb = qb_rb_open("test2", 2000, QB_RB_FLAG_SHARED_PROCESS);
Packit 979a56
*       for (i = 0; i < 200; i++) {
Packit 979a56
* try_write_again:
Packit 979a56
*               l = qb_rb_chunk_write(rb, &v, sizeof(v));
Packit 979a56
*               if (l < sizeof(v)) {
Packit 979a56
*                       goto try_write_again;
Packit 979a56
*               }
Packit 979a56
*       }
Packit 979a56
*       \&.\&.\&.
Packit 979a56
*       qb_rb_close(rb);
Packit 979a56
* 
Packit 979a56
Packit 979a56
.fi
Packit 979a56
.PP
Packit 979a56
.PP
Packit 979a56
\fBAuthor:\fP
Packit 979a56
.RS 4
Packit 979a56
Angus Salkeld asalkeld@redhat.com 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SH "Macro Definition Documentation"
Packit 979a56
.PP 
Packit 979a56
.SS "#define QB_RB_FLAG_CREATE   0x01"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Create a ring buffer (rather than open and existing one)\&. 
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_open()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "#define QB_RB_FLAG_NO_SEMAPHORE   0x10"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Don't use semaphores, only atomic ops\&. This mean that the timeout passed into \fBqb_rb_chunk_read()\fP will be ignored\&. 
Packit 979a56
.SS "#define QB_RB_FLAG_OVERWRITE   0x02"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
New calls to \fBqb_rb_chunk_write()\fP will call \fBqb_rb_chunk_reclaim()\fP if there is not enough space\&. If this is not set then new writes will be refused\&. 
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_open()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "#define QB_RB_FLAG_SHARED_PROCESS   0x08"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
The ringbuffer will be shared between processes\&. This effects the type of locks/semaphores that are used\&. 
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_open()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "#define QB_RB_FLAG_SHARED_THREAD   0x04"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
The ringbuffer will be shared between pthreads not processes\&. This effects the type of locks/semaphores that are used\&. 
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_open()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SH "Typedef Documentation"
Packit 979a56
.PP 
Packit 979a56
.SS "typedef struct qb_ringbuffer_s \fBqb_ringbuffer_t\fP"
Packit 979a56
Packit 979a56
.SH "Function Documentation"
Packit 979a56
.PP 
Packit 979a56
.SS "int32_t qb_rb_chmod (\fBqb_ringbuffer_t\fP *rb, mode_tmode)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Like 'chmod', it changes the mode of the ringbuffer's resources\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fImode\fP mode to change to 
Packit 979a56
.br
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturn values:\fP
Packit 979a56
.RS 4
Packit 979a56
\fI0\fP == ok 
Packit 979a56
.br
Packit 979a56
\fI-errno\fP for error 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "int32_t qb_rb_chown (\fBqb_ringbuffer_t\fP *rb, uid_towner, gid_tgroup)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Like 'chown', it changes the owner and group of the ringbuffer's resources\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIowner\fP uid of the owner to change to 
Packit 979a56
.br
Packit 979a56
\fIgroup\fP gid of the group to change to 
Packit 979a56
.br
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
status (0 = ok, -errno for error) 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "void* qb_rb_chunk_alloc (\fBqb_ringbuffer_t\fP *rb, size_tlen)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Allocate space for a chunk of the given size\&. If type == QB_RB_FLAG_OVERWRITE and NULL is returned, memory corruption of the memory file has occurred\&. The ringbuffer should be destroyed\&. If type == QB_RB_NORMAL then when there is not enough space it will return NULL\&.
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.br
Packit 979a56
\fIlen\fP (in) the size to allocate\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
pointer to chunk to write to, or NULL (if no space)\&.
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_chunk_alloc()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "int32_t qb_rb_chunk_commit (\fBqb_ringbuffer_t\fP *rb, size_tlen)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Finalize the chunk\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.br
Packit 979a56
\fIlen\fP (in) the size of the chunk\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_chunk_peek (\fBqb_ringbuffer_t\fP *rb, void **data_out, int32_tms_timeout)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Read (without reclaiming) the last chunk\&. This function is a way of accessing the next chunk without a memcpy()\&. You can read the chunk data in place\&.
Packit 979a56
.PP
Packit 979a56
\fBNote:\fP
Packit 979a56
.RS 4
Packit 979a56
This function will not 'pop' the chunk, you will need to call \fBqb_rb_chunk_reclaim()\fP\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.br
Packit 979a56
\fIdata_out\fP (out) a pointer to the next chunk to read (not copied)\&. 
Packit 979a56
.br
Packit 979a56
\fIms_timeout\fP (in) time to wait for new data\&.
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
the size of the chunk (0 if buffer empty)\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_chunk_read (\fBqb_ringbuffer_t\fP *rb, void *data_out, size_tlen, int32_tms_timeout)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Read the oldest chunk into data_out\&. This is the same as \fBqb_rb_chunk_peek()\fP memcpy() and \fBqb_rb_chunk_reclaim()\fP\&.
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.br
Packit 979a56
\fIdata_out\fP (in/out) the chunk will be memcpy'ed into this\&. 
Packit 979a56
.br
Packit 979a56
\fIlen\fP (in) the size of data_out\&. 
Packit 979a56
.br
Packit 979a56
\fIms_timeout\fP the amount od time to wait for new data\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
the size of the chunk, or error\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "void qb_rb_chunk_reclaim (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Reclaim the oldest chunk\&. You will need to call this if using \fBqb_rb_chunk_peek()\fP\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_chunk_write (\fBqb_ringbuffer_t\fP *rb, const void *data, size_tlen)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Write a chunk to the ring buffer\&. This simply calls \fBqb_rb_chunk_alloc()\fP and then \fBqb_rb_chunk_commit()\fP\&.
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.br
Packit 979a56
\fIdata\fP (in) the data to write 
Packit 979a56
.br
Packit 979a56
\fIlen\fP (in) the size of the chunk\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
the amount of bytes actually buffered (either len or -1)\&.
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_chunk_alloc()\fP 
Packit 979a56
.PP
Packit 979a56
\fBqb_rb_chunk_commit()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_chunks_used (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
The total number of chunks in the buffer\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "void qb_rb_close (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Dereference the ringbuffer and, if we are the last user, destroy it\&. All files, mmaped memory, semaphores and locks will be destroyed\&.
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "\fBqb_ringbuffer_t\fP* qb_rb_create_from_file (int32_tfd, uint32_tflags)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Load the saved ring buffer from file into tempory memory\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIfd\fP file with saved ringbuffer data\&. 
Packit 979a56
.br
Packit 979a56
\fIflags\fP same flags as passed into \fBqb_rb_open()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
new ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_write_to_file()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "char* qb_rb_name_get (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Get the name of the ringbuffer\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
name\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "\fBqb_ringbuffer_t\fP* qb_rb_open (const char *name, size_tsize, uint32_tflags, size_tshared_user_data_size)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Create the ring buffer with the given type\&. This creates allocates a ring buffer in shared memory\&.
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIname\fP the unique name of this ringbuffer\&. 
Packit 979a56
.br
Packit 979a56
\fIsize\fP the requested size\&. 
Packit 979a56
.br
Packit 979a56
\fIflags\fP or'ed flags 
Packit 979a56
.br
Packit 979a56
\fIshared_user_data_size\fP size for a shared data area\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBNote:\fP
Packit 979a56
.RS 4
Packit 979a56
the actual size will be rounded up to the next page size\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
a new ring buffer or NULL if there was a problem\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBQB_RB_FLAG_CREATE\fP, \fBQB_RB_FLAG_OVERWRITE\fP, \fBQB_RB_FLAG_SHARED_THREAD\fP, \fBQB_RB_FLAG_SHARED_PROCESS\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "int32_t qb_rb_refcount_get (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Get the reference count\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
the number of references 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "void* qb_rb_shared_user_data_get (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Get a point to user shared data area\&. 
Packit 979a56
.PP
Packit 979a56
\fBNote:\fP
Packit 979a56
.RS 4
Packit 979a56
this is of size 'shared_user_data_size' passed into \fBqb_rb_open()\fP
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBReturns:\fP
Packit 979a56
.RS 4
Packit 979a56
pointer to shared data\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_space_free (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
The amount of free space in the ring buffer\&. 
Packit 979a56
.PP
Packit 979a56
\fBNote:\fP
Packit 979a56
.RS 4
Packit 979a56
Some of this space will be consumed by the chunk headers\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_space_used (\fBqb_ringbuffer_t\fP *rb)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
The total amount of data in the buffer\&. 
Packit 979a56
.PP
Packit 979a56
\fBNote:\fP
Packit 979a56
.RS 4
Packit 979a56
This includes the chunk headers (8 bytes per chunk)\&. 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SS "ssize_t qb_rb_write_to_file (\fBqb_ringbuffer_t\fP *rb, int32_tfd)"
Packit 979a56
Packit 979a56
.PP
Packit 979a56
Write the contents of the Ring Buffer to file\&. 
Packit 979a56
.PP
Packit 979a56
\fBParameters:\fP
Packit 979a56
.RS 4
Packit 979a56
\fIfd\fP open file to write the ringbuffer data to\&. 
Packit 979a56
.br
Packit 979a56
\fIrb\fP ringbuffer instance 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
\fBSee Also:\fP
Packit 979a56
.RS 4
Packit 979a56
\fBqb_rb_create_from_file()\fP 
Packit 979a56
.RE
Packit 979a56
.PP
Packit 979a56
Packit 979a56
.SH "Author"
Packit 979a56
.PP 
Packit 979a56
Generated automatically by Doxygen for libqb from the source code\&.