BINIT(3)


Table of Contents

1. NAME
2. SYNOPSIS
3. DESCRIPTION
4. RETURN VALUE
5. ERRORS
6. EXAMPLE
7. BUGS
8. SEE ALSO
9. COPYING

1. NAME

Binit - Initialise UBF buffer

2. SYNOPSIS

#include <ubf.h>

int Binit (UBFH *p_ub, BFLDLEN len);

Link with -lubf -lnstd -lm -lpthread

3. 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));
}

4. RETURN VALUE

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

5. 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.

6. EXAMPLE

See ubftest/ubfunit1.c for sample code.

7. BUGS

Report bugs to support@mavimax.com

8. SEE ALSO

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

9. COPYING

© Mavimax, Ltd