SafeAPI Backend POSIX
POSIX/Linux OAL backend for safeAPIFreamwork
Loading...
Searching...
No Matches
safeAPIBackendPosix

The POSIX/Linux OAL (Operating system Abstraction Layer) backend for safeAPIFreamwork — a real, working implementation of the backend contract safeAPIFreamwork's ADR-018/ADR-005 define: a backend is an integrator-supplied implementation, not part of the reusable safety framework itself, so it lives in its own project rather than inside the framework.

Establishes the naming convention safeAPIBackend<OS> for any future backend (safeAPIBackendQNX, safeAPIBackendFreeRTOS, …) — only this POSIX one exists today as a real implementation; the others are documented conventions, not scaffolded placeholders, until there's something real to build.

What's here

  • src/sapi_posix_backend*.c + include/safeapi/posix_backend/*.h — the implementation and its own public headers.
  • Builds libsafeapi_posix_backend.a (static). Depends only on safeapi::core/safeapi::oal from safeAPIFreamwork plus system Threads — zero coupling to any application-layer code.
  • sapi_posix_backend_platform.c (ADR-035) — real-time bring-up: mlockall() + stack pre-fault + SCHED_FIFO on Linux, a safe no-op on any other POSIX host. Deliberately gates MCL_FUTURE on RLIMIT_MEMLOCK being unbounded — applying it unconditionally under a typical bounded desktop/CI limit (e.g. 8 MiB) makes the next pthread_create() fail with EAGAIN, killing every timer/task thread at startup. A bounded limit locks MCL_CURRENT only and logs a warning instead.

Consumers

safeAPIRBC2oo2GP calls directly into this backend's public headers (sapi_posix_backend_register_all(), sapi_posix_backend_reboot_set_argv()) — the sanctioned ADR-005 registration seam, an ordinary one-directional static-linking dependency (no circular-callback indirection needed, unlike the GP↔GA boundary). Backend behaviour is reached through the framework's own OAL vtables (e.g. sapi_platform_realtime_init()), not by calling this project's functions directly, except at that one registration point.

Building

Same dual-mode consumption of safeAPIFreamwork every SAPI C project uses:

cmake -S . -B build -DSAPI_FRAMEWORK_DIR=../safeAPIFreamwork # or -DSAPI_USE_INSTALLED_FRAMEWORK=ON
cmake --build build
ctest --test-dir build --output-on-failure
cmake --install build --prefix . # -> dist/<platform>/lib/libsafeapi_posix_backend.a