XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · VERSION 0.9.0 · BUILD FROM SOURCE
libxtos-rtxtos_rt_free_locked

xtos_rt_free_locked

Unlocks and frees a block returned by xtos_rt_alloc_locked.

On this page

Declaration

c
#include <xtos/rt.h>

int xtos_rt_free_locked(void *address, size_t length);

Parameters

ParameterTypeDescription
addressvoid *The original non-NULL pointer returned by alloc_locked.
lengthsize_tThe 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

errnoCondition
EINVALaddress is NULL or length is zero.
system errnoPreserves 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.