User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:ubf:binit.3

binit

Name

Binit — Initialise UBF buffer

Synopsis

#include <ubf.h>

int Binit (UBFH *p_ub, BFLDLEN len);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Initialise UBF buffer manually. Normally tpalloc(3) does this. But it is possible to make other buffers than XATMI to function as UBF. p_ub is pointer to memory block, len is memory size in bytes.

For example:

char buf[1024];
UBFH *p_ub = (UBFH *)buf;

if (0!=Binit(p_ub, sizeof(buf)))
{
        fprintf(stderr, "Failed to Binit: %s\n", Bstrerror(Berror));
}

RETURN VALUE

On success, Binit() return zero; on error, -1 is returned, with Berror set to indicate the error.

ERRORS

Note that Bstrerror() returns generic error message plus custom message with debug info from last function call.

BNOTFLD p_ub is NULL.

BNOSPACE No space in buffer. The sizeof(UBF_header_t) is minimum size of buffer.

EXAMPLE

See ubftest/ubfunit1.c for sample code.

BUGS

Report bugs to support@mavimax.com

SEE ALSO

CBinit(3) Badd(3) CBadd(3) Bget(3) CBget(3)

COPYING

© Mavimax, Ltd