zephyr/lib/posix/options/mlock.c
Chris Friedt d949c9c8b8 posix: add support for mlock() and munlock()
Add support for mlock() and munlock(). These two functions
comprise the _POSIX_MEMLOCK_RANGE Option which is
required by PSE51, PSE52, PSE53, and PSE54.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-14 14:01:05 -04:00

25 lines
339 B
C

/*
* Copyright (c) 2024, Tenstorrent AI ULC
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <zephyr/kernel.h>
#include <zephyr/posix/sys/mman.h>
int mlock(const void *addr, size_t len)
{
k_mem_pin(addr, len);
return 0;
}
int munlock(const void *addr, size_t len)
{
k_mem_unpin(addr, len);
return 0;
}