Skip to content

Commit a61f22e

Browse files
committed
docs(platform): POSIX platform
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
1 parent 42b607f commit a61f22e

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/PlatformPosix.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# POSIX Platform
2+
3+
In Linux, pthreads are enabled by compiling with `-pthread` and linking with `-lpthread`. This might not be required for other POSIX platforms. The required build flags are automatically selected by the cmake build system.
4+
5+
## WAMR
6+
7+
WAMR has built-in support for most POSIX operating systems, including Linux. The WAMR integration is out of scope of the Ocre Posix platform.
8+
9+
Check [WAMR porting guide](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/port_wamr.md) for more information about WAMR platform requirements.
10+
11+
## container loading
12+
13+
For loading the container into the memory, we use `mmap(2)` by default. This is the recommended way as this can provide XIP functionality.
14+
15+
We also provide other alternative implementations in case the system does not support `mmap(2)`:
16+
17+
- Using POSIX syscalls
18+
- Using file streams
19+
20+
Check the files in `src/platform/posix/file_alloc_*.c` for reference implementations.
21+
22+
## user memory
23+
24+
Since in POSIX or Linux there is no standard tiered memory API, these are implemented as `malloc(3)`, `realloc(3)` and `free(3)`
25+
26+
## logging
27+
28+
`LOG_MODULE_REGISTER(module, ...)` and `LOG_MODULE_DECLARE(module, ...)` will just define some `static const` variable with the module name; while the `LOG_*(fmt, ...)` macros will use `fprintf(3)` to log the message to `stderr`.
29+
30+
## config.h
31+
32+
This file, in the platform is required to define the following macro:
33+
34+
- `CONFIG_OCRE_DEFAULT_WORKING_DIRECTORY` is set to `src/ocre/var/lib/ocre`, since we currently do not build a production build.
35+
36+
All Ocre specific optionals are enabled. Since in Linux the memory impact of these features are negligible, we enable them by default.

0 commit comments

Comments
 (0)