BUF_create
Application Program Interface
2-21
The segid element can be used to specify the memory segment in which
buffer pool should be created. If attrs is NULL, the new buffer pool is
created the default attributes specified in BUF_ATTRS, which uses the
default memory segment.
BUF_create calls MEM_alloc to dynamically create the BUF object's data
structure and the buffer pool.
BUF_create returns a handle to the buffer pool of type BUF_Handle. If
the buffer pool cannot be created, BUF_create returns NULL. The pool
may not be created if the numbuff or size parameter is zero or if the
memory available in the specified heap is insufficient.
The time required to successfully execute BUF_create is not
deterministic (that is, the time varies over multiple calls).
Constraints and
Calling Context
❏
BUF_create cannot be called from a SWI or HWI.
❏
The product of the size (after adjusting for the alignment) and
numbuff parameters should not exceed the maximum Uns value.
❏
The alignment should be greater than the minimum value and must
be a power of 2. If it is not, proper creation of buffer pool is not
guaranteed.
Example
BUF_Handle myBufpool;
BUF_Attrs myAttrs;
myAttrs = BUF_ATTRS;
myBufpool=BUF_create(5, 4, 2, &myAttrs);
if( myBufpool == NULL ){
LOG_printf(&trace,"BUF_create failed!");
}
See Also