xtos_ rt_ lock_ memory
Locks an existing caller-owned user-memory range through mlock.
On this page
Declaration
#include <xtos/rt.h>
int xtos_rt_lock_memory(void *address, size_t length);Parameters
| Parameter | Type | Description |
|---|---|---|
| address | void * | Start of the range to lock; must not be NULL. The caller remains responsible for allocation and release. |
| length | size_t | Byte count, greater than zero; it is not an element count. |
Return value
Returns 0 on success and -1 on failure. The SDK does not take ownership of the address.
Errors
| errno | Condition |
|---|---|
| EINVAL | address is NULL or length is zero. |
| ENOMEM | The range is unmapped or the locked-memory resource limit is insufficient. |
| EPERM | The process lacks the permission required to lock memory. |
| EAGAIN | The range could not be locked immediately; this errno may be returned by the underlying mlock. |
Notes
- mlock is constrained by RLIMIT_MEMLOCK and permissions; success does not lock the process or future allocations.
- The call does not allocate, free, or initialize memory and does not guarantee zero page faults or a real-time deadline.
Example
Source
This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.