Projects / Virtual Ring Buffer

Virtual Ring Buffer

The VRB library is a virtual ring buffer. It uses 2 mirrored ranges of memory to avoid most needs to check for buffer wraparound. This allows the caller to have direct access to buffer space and buffer data as a linear contiguous block.

Tags
Licenses
Operating Systems
Implementation

Recent releases

  •  07 Mar 2006 06:35

    Release Notes: A vrb_empty function was added. Dead code in vrb_take was cleaned up. A poll loop was implemented in vbuf. vbuf now uses getopt. Buffer size calculation and data type/format were fixed in vbuf.

    •  01 Oct 2002 01:08

      Release Notes: The Typedef names have changed (with a compatibility impact) to a more standard form. Guard pages (like "Electric Fence") and new manpages have been added.

      •  10 Dec 2001 09:30

        No changes have been submitted for this release.

        •  04 Mar 2001 08:05

          No changes have been submitted for this release.

          Recent comments

          10 Dec 2001 05:57 philhoward

          Re: Virtual ring buffer

          If the calls to shmat() are made with the address (arg 2) specified as 0, the system will find an "unmapped" region of address space. There is no guarantee it will place the mapping of 2 such calls together, as VRB needs. Only by specifying an exact address can this be guaranteed. And in order to know what such addresses should be, mmap() is called initially to find an opening in the address space of the proper size (twice the buffer need).

          The 2 bugs have now been corrected in the latest release, 0.3.0 (beta).

          18 Nov 2001 19:24 wdale

          Virtual ring buffer
          SMALL BUG 1
          -----------
          File vrb_init.c line 255:
          if ( ! ( tempname = alloca( strlen( arg_name ) ) ) ) {
          Surely this should be:
          if ( ! ( tempname = alloca( strlen( arg_name ) + 1 ) ) ) {

          SMALL BUG 2
          -----------
          File vrb_prefix.h line 201:
          #define vrb_is_full(b) (((b)->length)==((b)->capacity))
          You probably meant:
          #define vrb_is_full(b) ((vrb_data_len((b)))==((b)->capacity))

          CLARIFICATION
          -------------
          In vrb_init.c when (arg_name == NULL) you need to make two shmat() calls, and you require that the return addresses are exactly "req_size" bytes apart.
          Why do you do you first make a mmap() call and then an mummap() call?
          Does that -really- enhance your chances?
          Will you necessarily get the same address as that from mmap()?

          Screenshot

          Project Spotlight

          OpenStack4j

          A Fluent OpenStack client API for Java.

          Screenshot

          Project Spotlight

          TurnKey TWiki Appliance

          A TWiki appliance that is easy to use and lightweight.