xtos_ rt_ free_ locked
Unlocks and frees a block returned by xtos_rt_alloc_locked.
On this page
Declaration
#include <xtos/rt.h>
int xtos_rt_free_locked(void *address, size_t length);Parameters
| Parameter | Type | Description |
|---|---|---|
| address | void * | The original non-NULL pointer returned by alloc_locked. |
| length | size_t | The original positive byte count used for allocation. |
Return value
Returns -1 if munlock fails, otherwise 0; free is called whether or not munlock succeeds.
Errors
| errno | Condition |
|---|---|
| EINVAL | address is NULL or length is zero. |
| system errno | Preserves munlock errno, although the memory has still been freed. |
Notes
- Pass only the original alloc_locked block; never pass a stack address, subrange, duplicate, or differently allocated pointer.
- The address is invalid after return; do not retry freeing it when the return value is -1.
Example
Source
This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.