blob: 22802d5a58b6747186f684ae8df389f12cb153cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# System abstraction
`system.h` is the only OS-facing API used by the application and storage
layers. Paths and process arguments are UTF-8 strings on every platform.
The API owns these responsibilities:
- process argument conversion and absolute/path-join operations;
- directory creation, temporary directories, and path removal/replacement;
- opaque file handles, locking, read/write/seek/truncate/flush operations;
- wall-clock and monotonic milliseconds;
- cryptographically secure random bytes.
Returned strings are heap allocated and must be released with `free()`. Files
must be initialized or opened through this API and closed with
`tiny_sys_file_close()`.
Platform selection is intentionally confined to the single conditional block
in `system.c`. Windows uses wide Win32 calls internally; non-Windows builds use
the POSIX implementation. No Win32 or POSIX type is exposed by `system.h`.
|