Skip to content

Commit

Permalink
posix: options: mlock: include demand paging header
Browse files Browse the repository at this point in the history
Fix a compile error because `k_mem_pin()` and `k_mem_unpin()`
are not defined.

Signed-off-by: Chris Friedt <[email protected]>
  • Loading branch information
cfriedt authored and kartben committed Jan 9, 2025
1 parent 712da72 commit 587490d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/posix/options/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@
#include <zephyr/kernel.h>
#include <zephyr/posix/sys/mman.h>

#include <zephyr/kernel/mm/demand_paging.h>

int mlock(const void *addr, size_t len)
{
k_mem_pin(addr, len);
void *const _addr = (void *)addr;

k_mem_pin(_addr, len);

return 0;
}

int munlock(const void *addr, size_t len)
{
k_mem_unpin(addr, len);
void *const _addr = (void *)addr;

k_mem_unpin(_addr, len);

return 0;
}

0 comments on commit 587490d

Please sign in to comment.