|
SafeAPI Backend POSIX
POSIX/Linux OAL backend for safeAPIFreamwork
|
POSIX sapi_platform backend: real-time bring-up for a PREEMPT_RT Linux host (ADR-018, ADR-035). More...
#include "safeapi/posix_backend/sapi_posix_backend.h"Go to the source code of this file.
Functions | |
| static sapi_status_t | backend_realtime_init (uint32_t rt_priority) |
| const sapi_platform_backend_t * | sapi_posix_backend_platform (void) |
| The POSIX sapi_platform backend (ADR-035): real-time bring-up via mlockall() + SCHED_FIFO, best-effort, on Linux; a no-op returning SAPI_STATUS_OK on any other POSIX host. Register it (directly or via sapi_posix_backend_register_all()) and call sapi_platform_realtime_init() through the framework rather than reaching for a backend symbol - see safeAPIFreamwork's docs/architecture/ADR-035-platform-realtime-init.md. | |
Variables | |
| static const sapi_platform_backend_t | s_posix_platform_backend = { backend_realtime_init } |
POSIX sapi_platform backend: real-time bring-up for a PREEMPT_RT Linux host (ADR-018, ADR-035).
Locks the process image resident (mlockall) so cyclic execution is free of demand-paging jitter, pre-faults the current thread stack, and raises the calling thread to SCHED_FIFO at the requested priority. Every step is best-effort per REQ-OAL-PLATFORM-001: an unprivileged host, a kernel without an RT scheduler, or a bounded lockable-memory limit each degrade to a logged WARNING, never a hard failure, and the function still returns SAPI_STATUS_OK.
RLIMIT_MEMLOCK interaction (the reason this is not just mlockall(MCL_CURRENT | MCL_FUTURE)): with a bounded RLIMIT_MEMLOCK, MCL_FUTURE forces every later mapping - including each new thread's stack - to be locked, so the next pthread_create() fails with EAGAIN and the process cannot start its timer/task threads at all (observed on a stock Ubuntu VM: 8 MiB memlock cap, 8 MiB default thread stack). When the limit is not RLIM_INFINITY this backend locks the current footprint only (MCL_CURRENT) and says so; a privileged / memlock=unlimited deployment still gets MCL_CURRENT | MCL_FUTURE.
On any non-Linux POSIX host the whole thing is a no-op that returns OK.
Definition in file sapi_posix_backend_platform.c.
| #define _GNU_SOURCE |
Definition at line 6 of file sapi_posix_backend_platform.c.
|
static |
Local makros Local types declarations Local function declarations
Definition at line 81 of file sapi_posix_backend_platform.c.
| const sapi_platform_backend_t * sapi_posix_backend_platform | ( | void | ) |
The POSIX sapi_platform backend (ADR-035): real-time bring-up via mlockall() + SCHED_FIFO, best-effort, on Linux; a no-op returning SAPI_STATUS_OK on any other POSIX host. Register it (directly or via sapi_posix_backend_register_all()) and call sapi_platform_realtime_init() through the framework rather than reaching for a backend symbol - see safeAPIFreamwork's docs/architecture/ADR-035-platform-realtime-init.md.
Global variables declarations Global functions
Definition at line 73 of file sapi_posix_backend_platform.c.
|
static |
Local variables declarations
Definition at line 67 of file sapi_posix_backend_platform.c.