From f70b5439691c72c15d7bf9c400738ef8073cc52c Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Mon, 2 Nov 2026 05:34:29 +0900 Subject: [PATCH] openkal 0.20.0; openkal-linux 0.21.0, openkal-macos 0.18.0, openkal-windows 0.16.0, openkal-emscripten 0.9.0 Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> --- CHANGELOG.md | 5 +++ pkgs/o/openkal-emscripten.lua | 21 ++++++++++++ pkgs/o/openkal-linux.lua | 21 ++++++++++++ pkgs/o/openkal-macos.lua | 21 ++++++++++++ pkgs/o/openkal-windows.lua | 21 ++++++++++++ pkgs/o/openkal.lua | 21 ++++++++++++ tests/examples/openkal/mcpp.toml | 10 +++--- tests/examples/openkal/tests/kal.cpp | 51 +++++++++++++++++++++++++++- 8 files changed, 165 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f673fe04..6371fae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ ### Added +- **openkal 0.20.0;openkal-linux 0.21.0、openkal-macos 0.18.0、openkal-windows 0.16.0、openkal-emscripten 0.9.0。** 按偏移的传输 + (`kal_fs_read_at`/`kal_fs_write_at`,不用也不改位置);程序与单元的内存用量(`KAL_PINFO_MEMORY`、`kal_process_job_usage`)与 + 单元的内存限额(`kal_process_job_limit`,HARD/SUPERVISED);可选接口 `openkal.region`(保留、分段提交、归还与丢弃、整体释放); + 加载器提供的 `openkal.prof`/`openkal.debug`。测试成员 `openkal` 随之移动,并观察按偏移的传输、本程序的内存与区域。 + GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。 - **compat.mimalloc 3.6.1。** 与 3.4.5 并存;同一份源文件列表同时写出两个版本的目录布局(3.6.1 分为 `alloc/`、`arena/`、 `heap/`、`prim/`、`profile/`、`util/` 七个目录,新增 `profile/` 三个单元),列表中某版本没有的名字在该版本下不选中任何文件。 按 c11 编译时补上 `_DEFAULT_SOURCE`(上游以 gnu11 编译;3.6.1 的 `prim/prim.c` 在 `prim/unix/prim.c` 声明它之前已包含头文件)。 diff --git a/pkgs/o/openkal-emscripten.lua b/pkgs/o/openkal-emscripten.lua index ebcbf905..7eec0cbf 100644 --- a/pkgs/o/openkal-emscripten.lua +++ b/pkgs/o/openkal-emscripten.lua @@ -46,6 +46,13 @@ package = { xpm = { linux = { + ["0.9.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.9.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.9.0/openkal-emscripten-0.9.0.tar.gz", + }, + sha256 = "effc74936b1d7d476d848c90cbbd24ac50488d6be6ba65fb0ef4b3ec9cb65247", + }, ["0.8.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz", @@ -118,6 +125,13 @@ package = { }, }, macosx = { + ["0.9.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.9.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.9.0/openkal-emscripten-0.9.0.tar.gz", + }, + sha256 = "effc74936b1d7d476d848c90cbbd24ac50488d6be6ba65fb0ef4b3ec9cb65247", + }, ["0.8.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz", @@ -190,6 +204,13 @@ package = { }, }, windows = { + ["0.9.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.9.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.9.0/openkal-emscripten-0.9.0.tar.gz", + }, + sha256 = "effc74936b1d7d476d848c90cbbd24ac50488d6be6ba65fb0ef4b3ec9cb65247", + }, ["0.8.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz", diff --git a/pkgs/o/openkal-linux.lua b/pkgs/o/openkal-linux.lua index 52aa2908..3049dc8e 100644 --- a/pkgs/o/openkal-linux.lua +++ b/pkgs/o/openkal-linux.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.21.0/openkal-linux-0.21.0.tar.gz", + }, + sha256 = "bf427de8411e0b8252d4ab8fb74863b7d93283fa6fe7cf7af94be11ab86c2fd0", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz", @@ -196,6 +203,13 @@ package = { }, }, macosx = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.21.0/openkal-linux-0.21.0.tar.gz", + }, + sha256 = "bf427de8411e0b8252d4ab8fb74863b7d93283fa6fe7cf7af94be11ab86c2fd0", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz", @@ -373,6 +387,13 @@ package = { }, }, windows = { + ["0.21.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.21.0/openkal-linux-0.21.0.tar.gz", + }, + sha256 = "bf427de8411e0b8252d4ab8fb74863b7d93283fa6fe7cf7af94be11ab86c2fd0", + }, ["0.20.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz", diff --git a/pkgs/o/openkal-macos.lua b/pkgs/o/openkal-macos.lua index 7c87d8a5..e26f03f2 100644 --- a/pkgs/o/openkal-macos.lua +++ b/pkgs/o/openkal-macos.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.18.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.18.0/openkal-macos-0.18.0.tar.gz", + }, + sha256 = "d14ec6808e6f5e580a09d57c20175aa28e4ee207ef2dcf686b1e88842ddd37ec", + }, ["0.17.1"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.1.tar.gz", @@ -196,6 +203,13 @@ package = { }, }, macosx = { + ["0.18.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.18.0/openkal-macos-0.18.0.tar.gz", + }, + sha256 = "d14ec6808e6f5e580a09d57c20175aa28e4ee207ef2dcf686b1e88842ddd37ec", + }, ["0.17.1"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.1.tar.gz", @@ -373,6 +387,13 @@ package = { }, }, windows = { + ["0.18.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.18.0/openkal-macos-0.18.0.tar.gz", + }, + sha256 = "d14ec6808e6f5e580a09d57c20175aa28e4ee207ef2dcf686b1e88842ddd37ec", + }, ["0.17.1"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.1.tar.gz", diff --git a/pkgs/o/openkal-windows.lua b/pkgs/o/openkal-windows.lua index 26f74660..97217177 100644 --- a/pkgs/o/openkal-windows.lua +++ b/pkgs/o/openkal-windows.lua @@ -21,6 +21,13 @@ package = { xpm = { linux = { + ["0.16.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.16.0/openkal-windows-0.16.0.tar.gz", + }, + sha256 = "aaa324dca9a6795c9ffd13bc77b351f5bc7b6f445c9f5371af352080a9a9bb0a", + }, ["0.15.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz", @@ -219,6 +226,13 @@ package = { }, }, macosx = { + ["0.16.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.16.0/openkal-windows-0.16.0.tar.gz", + }, + sha256 = "aaa324dca9a6795c9ffd13bc77b351f5bc7b6f445c9f5371af352080a9a9bb0a", + }, ["0.15.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz", @@ -417,6 +431,13 @@ package = { }, }, windows = { + ["0.16.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.16.0/openkal-windows-0.16.0.tar.gz", + }, + sha256 = "aaa324dca9a6795c9ffd13bc77b351f5bc7b6f445c9f5371af352080a9a9bb0a", + }, ["0.15.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz", diff --git a/pkgs/o/openkal.lua b/pkgs/o/openkal.lua index 88c7a9f7..6658f448 100644 --- a/pkgs/o/openkal.lua +++ b/pkgs/o/openkal.lua @@ -22,6 +22,13 @@ package = { xpm = { linux = { + ["0.20.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.20.0/openkal-0.20.0.tar.gz", + }, + sha256 = "f6ce55dd754d7aceb790a551d545da99e9c3c1459a50444db0e4faea04ee1b14", + }, ["0.19.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz", @@ -157,6 +164,13 @@ package = { }, }, macosx = { + ["0.20.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.20.0/openkal-0.20.0.tar.gz", + }, + sha256 = "f6ce55dd754d7aceb790a551d545da99e9c3c1459a50444db0e4faea04ee1b14", + }, ["0.19.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz", @@ -292,6 +306,13 @@ package = { }, }, windows = { + ["0.20.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.20.0/openkal-0.20.0.tar.gz", + }, + sha256 = "f6ce55dd754d7aceb790a551d545da99e9c3c1459a50444db0e4faea04ee1b14", + }, ["0.19.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz", diff --git a/tests/examples/openkal/mcpp.toml b/tests/examples/openkal/mcpp.toml index 663b65a9..10e7840f 100644 --- a/tests/examples/openkal/mcpp.toml +++ b/tests/examples/openkal/mcpp.toml @@ -18,22 +18,22 @@ name = "openkal-tests" version = "0.1.0" [dependencies.mcpplibs] -openkal = "0.19.0" +openkal = "0.20.0" [target.'cfg(os = "linux")'.dependencies.mcpplibs] -openkal-linux = "0.20.0" +openkal-linux = "0.21.0" [target.'cfg(os = "macos")'.dependencies.mcpplibs] -openkal-macos = "0.17.1" +openkal-macos = "0.18.0" [target.'cfg(windows)'.dependencies.mcpplibs] -openkal-windows = "0.15.0" +openkal-windows = "0.16.0" [target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs] openkal-llvm-runtime = "0.16.15" [target.'cfg(arch = "wasm32")'.dependencies.mcpplibs] -openkal-emscripten = "0.8.0" +openkal-emscripten = "0.9.0" [target.'cfg(arch = "riscv64")'.dependencies.mcpplibs] openkal-opensbi = "0.8.3" diff --git a/tests/examples/openkal/tests/kal.cpp b/tests/examples/openkal/tests/kal.cpp index 365407d0..da3ded4d 100644 --- a/tests/examples/openkal/tests/kal.cpp +++ b/tests/examples/openkal/tests/kal.cpp @@ -8,14 +8,20 @@ // (0.17.1) a joined command line is refused where programs receive vectors; // (0.18) a file is mapped, the region holds its bytes and zero after its end; // (0.19) the cores are no more than the processors, and a started context -// lowers its claim on the processors where the implementation claims it. +// lowers its claim on the processors where the implementation claims it; +// (0.20) a transfer at an offset neither uses nor moves the file's position, +// this program is told the memory it occupies and its peak, and a region is +// reserved, backed, written, its backing returned and backed again reading +// zero, and released. // The terminal is not observed here, // because a test run has none; the implementations observe it on a terminal // they make. #include #include #include +#include #include +#include #include #include #include @@ -138,6 +144,49 @@ int main() { } } + if (kal_fs_preopen_count() > 0 && kal_fs_preopen(0, &root, nullptr, 0, nullptr) == kal_ok) { + kal_file f{}; + if (kal_fs_open(root, "okt.p", 5, KAL_OPEN_READ | KAL_OPEN_WRITE | KAL_OPEN_CREATE | KAL_OPEN_TRUNCATE, &f) == kal_ok) { + kal_stream_write(kal_fs_stream(f), "abcdef", 6); + check(kal_fs_write_at(f, "XY", 2, 1) == 2, "a write at an offset writes the whole buffer"); + kal_u64 at = 0; + check(kal_fs_seek(f, 0, KAL_SEEK_CURRENT, &at) == kal_ok && at == 6, + "and leaves the position where it was"); + char b[8] = {}; + check(kal_fs_read_at(f, b, 6, 0) == 6 && b[0] == 'a' && b[1] == 'X' && b[2] == 'Y' && b[5] == 'f', + "a read at an offset reads what is there"); + check(kal_fs_read_at(f, b, 6, 6) == 0, "a read at the end reads nothing"); + kal_fs_close_file(f); + } + kal_fs_remove(root, "okt.p", 5); + } + + { + kal_process me{}; + if (kal_process_self(&me) == kal_ok) { + kal_program_info info{}; + info.self_size = sizeof info; + if (kal_process_info(me, KAL_PINFO_MEMORY, &info) == kal_ok && (info.present & KAL_PINFO_MEMORY)) + check(info.memory_bytes > 0 && info.memory_peak_bytes >= info.memory_bytes, + "this program is told the memory it occupies, and a peak no smaller"); + kal_process_close(me); + } + } + + if (kal_interfaces() & KAL_IFACE_REGION) { + const kal_uintptr g = kal_memory_granularity(); + auto* r = static_cast(kal_region_reserve(4 * g, g, 0)); + check(r != nullptr, "a region is reserved"); + if (r) { + check(kal_region_commit(r, g) == kal_ok, "a part of it is backed"); + r[0] = 7; r[g - 1] = 9; + check(kal_region_decommit(r, g) == kal_ok && kal_region_commit(r, g) == kal_ok, + "its backing is returned and it is backed again"); + check(r[0] == 0 && r[g - 1] == 0, "and it reads as zero"); + kal_region_release(r, 4 * g); + } + } + if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14); return failures == 0 ? 0 : 1; }