06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pNA+ <strong>System</strong> <strong>Calls</strong> pna_allocb<br />

pna_allocb Allocates a message block.<br />

#include <br />

mblk_t *pna_allocb(size, pri)<br />

int size;<br />

int pri;<br />

Description<br />

Arguments<br />

Return Value<br />

pna_allocb allocates a message block with a data buffer of a specified size.<br />

The pNA+ memory manager searches the buffer list for the size that best fits the<br />

requested size. If a buffer of that size is not available, the call returns NULL.<br />

pna_allocb uses the following algorithm to find the best fit:<br />

1. The pNA+ memory manager first searches for an exact match.<br />

2. If a match is not available, the pNA+ memory manager searches for the smallest<br />

size able to contain the requested size.<br />

3. If none is available, the maximum size configured in the pNA+ memory manager<br />

is used.<br />

The following example illustrates this algorithm:<br />

Let buffers of sizes 0, 128, 1024, and 4096 bytes be configured in pNA+. If a buffer<br />

of size 1024 is requested, the pNA+ memory manager allocates a buffer from the<br />

1024-byte buffer list. A request for a 2048-byte buffer results in the pNA+ memory<br />

manager allocating a buffer from the 4096-byte buffer list, and a request for a size<br />

8192 buffer results in the allocation of a 4096-byte buffer.<br />

size Specifies the size of the data buffer.<br />

pri Unused by the pNA+ memory manager.<br />

This system call returns a pointer to the message block if successful; otherwise, it<br />

returns a null pointer.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 4-39<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!