diff --git a/CHANGELOG.md b/CHANGELOG.md index 684cfb4f..2ddf58b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ ### Added +- **openkal 0.19.0;openkal-linux 0.20.0、openkal-macos 0.17.0、openkal-windows 0.15.0、openkal-emscripten 0.8.0。** + `openkal.task` 增加两项:`kal_task_cores`(程序可运行于其上的处理器的物理核数,0 为无法回答)与 + `kal_task_set_priority`(调用者所在上下文对处理器的占用:DEFAULT、LOW、BACKGROUND,属性位 `KAL_TASK_PROP_PRIORITY`, + 升回被拒绝为 `kal_err_permission`);规范 §1.1 写明边界:下层的东西不向上穿透,实现之间只在规范留名的余地内不同,绕过 + openkal 的使用者绑定它所绕到的东西。各实现:Linux 以 sysfs 拓扑与 SCHED_OTHER/BATCH/IDLE,macOS 以 `hw.physicalcpu` + 与 QoS 类,Windows 以处理器核心关系与后台模式,Emscripten 两者都答"无法回答/不支持"。测试成员 `openkal` 随之移动, + 并观察 0.19 的两项。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。 - **openkal-platform 0.19.2。** openkal 0.18 的版本组,openkal-ld/run/tools 0.1.7、openkal-musl 0.23.2、 openkal-llvm-runtime 0.16.12:Linux aarch64 上 okrun 在处理器表明有 SHA-256 指令时以其接纳映像。openkal 0.18.0 与三个 实现不变。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。 diff --git a/pkgs/o/openkal-emscripten.lua b/pkgs/o/openkal-emscripten.lua index 81962faa..ebcbf905 100644 --- a/pkgs/o/openkal-emscripten.lua +++ b/pkgs/o/openkal-emscripten.lua @@ -46,6 +46,13 @@ package = { xpm = { linux = { + ["0.8.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.8.0/openkal-emscripten-0.8.0.tar.gz", + }, + sha256 = "5caf0d10e889762b557ae5342c35a7386b856dfe9cc45a89bba90d37dc5ed95f", + }, ["0.7.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.7.0.tar.gz", @@ -111,6 +118,13 @@ package = { }, }, macosx = { + ["0.8.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.8.0/openkal-emscripten-0.8.0.tar.gz", + }, + sha256 = "5caf0d10e889762b557ae5342c35a7386b856dfe9cc45a89bba90d37dc5ed95f", + }, ["0.7.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.7.0.tar.gz", @@ -176,6 +190,13 @@ package = { }, }, windows = { + ["0.8.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.8.0/openkal-emscripten-0.8.0.tar.gz", + }, + sha256 = "5caf0d10e889762b557ae5342c35a7386b856dfe9cc45a89bba90d37dc5ed95f", + }, ["0.7.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.7.0.tar.gz", diff --git a/pkgs/o/openkal-linux.lua b/pkgs/o/openkal-linux.lua index b6951eb6..52aa2908 100644 --- a/pkgs/o/openkal-linux.lua +++ b/pkgs/o/openkal-linux.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.20.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.20.0/openkal-linux-0.20.0.tar.gz", + }, + sha256 = "1edbe561101ca392f838394242177e7d71e06650f54444095be18aa313da33dd", + }, ["0.19.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.19.0.tar.gz", @@ -189,6 +196,13 @@ package = { }, }, macosx = { + ["0.20.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.20.0/openkal-linux-0.20.0.tar.gz", + }, + sha256 = "1edbe561101ca392f838394242177e7d71e06650f54444095be18aa313da33dd", + }, ["0.19.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.19.0.tar.gz", @@ -359,6 +373,13 @@ package = { }, }, windows = { + ["0.20.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.20.0/openkal-linux-0.20.0.tar.gz", + }, + sha256 = "1edbe561101ca392f838394242177e7d71e06650f54444095be18aa313da33dd", + }, ["0.19.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.19.0.tar.gz", diff --git a/pkgs/o/openkal-macos.lua b/pkgs/o/openkal-macos.lua index 360168cd..fdd6f240 100644 --- a/pkgs/o/openkal-macos.lua +++ b/pkgs/o/openkal-macos.lua @@ -19,6 +19,13 @@ package = { xpm = { linux = { + ["0.17.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.17.0/openkal-macos-0.17.0.tar.gz", + }, + sha256 = "93f006f74536f55d2a46b130013b65f34c7f3b4dffdc32cf2942d3fd8504eb29", + }, ["0.16.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.16.0.tar.gz", @@ -182,6 +189,13 @@ package = { }, }, macosx = { + ["0.17.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.17.0/openkal-macos-0.17.0.tar.gz", + }, + sha256 = "93f006f74536f55d2a46b130013b65f34c7f3b4dffdc32cf2942d3fd8504eb29", + }, ["0.16.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.16.0.tar.gz", @@ -345,6 +359,13 @@ package = { }, }, windows = { + ["0.17.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.17.0/openkal-macos-0.17.0.tar.gz", + }, + sha256 = "93f006f74536f55d2a46b130013b65f34c7f3b4dffdc32cf2942d3fd8504eb29", + }, ["0.16.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.16.0.tar.gz", diff --git a/pkgs/o/openkal-windows.lua b/pkgs/o/openkal-windows.lua index ba669b14..26f74660 100644 --- a/pkgs/o/openkal-windows.lua +++ b/pkgs/o/openkal-windows.lua @@ -21,6 +21,13 @@ package = { xpm = { linux = { + ["0.15.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.15.0/openkal-windows-0.15.0.tar.gz", + }, + sha256 = "2836fe7f645a353dd94a92219a9b3025531ee72f9cfb7d3ec903b605b7e6eb29", + }, ["0.14.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.14.0.tar.gz", @@ -212,6 +219,13 @@ package = { }, }, macosx = { + ["0.15.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.15.0/openkal-windows-0.15.0.tar.gz", + }, + sha256 = "2836fe7f645a353dd94a92219a9b3025531ee72f9cfb7d3ec903b605b7e6eb29", + }, ["0.14.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.14.0.tar.gz", @@ -403,6 +417,13 @@ package = { }, }, windows = { + ["0.15.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.15.0/openkal-windows-0.15.0.tar.gz", + }, + sha256 = "2836fe7f645a353dd94a92219a9b3025531ee72f9cfb7d3ec903b605b7e6eb29", + }, ["0.14.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.14.0.tar.gz", diff --git a/pkgs/o/openkal.lua b/pkgs/o/openkal.lua index 0e054d60..88c7a9f7 100644 --- a/pkgs/o/openkal.lua +++ b/pkgs/o/openkal.lua @@ -22,6 +22,13 @@ package = { xpm = { linux = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.19.0/openkal-0.19.0.tar.gz", + }, + sha256 = "3b08cb7497feccbf33426dd7dbbd9b086c54bee7f81c05e61e1807ce7d48c73b", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.18.0.tar.gz", @@ -150,6 +157,13 @@ package = { }, }, macosx = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.19.0/openkal-0.19.0.tar.gz", + }, + sha256 = "3b08cb7497feccbf33426dd7dbbd9b086c54bee7f81c05e61e1807ce7d48c73b", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.18.0.tar.gz", @@ -278,6 +292,13 @@ package = { }, }, windows = { + ["0.19.0"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.19.0/openkal-0.19.0.tar.gz", + }, + sha256 = "3b08cb7497feccbf33426dd7dbbd9b086c54bee7f81c05e61e1807ce7d48c73b", + }, ["0.18.0"] = { url = { GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.18.0.tar.gz", diff --git a/tests/examples/openkal/mcpp.toml b/tests/examples/openkal/mcpp.toml index 0e40e8b0..f853366b 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.18.0" +openkal = "0.19.0" [target.'cfg(os = "linux")'.dependencies.mcpplibs] -openkal-linux = "0.19.0" +openkal-linux = "0.20.0" [target.'cfg(os = "macos")'.dependencies.mcpplibs] -openkal-macos = "0.16.0" +openkal-macos = "0.17.0" [target.'cfg(windows)'.dependencies.mcpplibs] -openkal-windows = "0.14.0" +openkal-windows = "0.15.0" [target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs] openkal-llvm-runtime = "0.16.12" [target.'cfg(arch = "wasm32")'.dependencies.mcpplibs] -openkal-emscripten = "0.7.0" +openkal-emscripten = "0.8.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 a06703f2..365407d0 100644 --- a/tests/examples/openkal/tests/kal.cpp +++ b/tests/examples/openkal/tests/kal.cpp @@ -6,7 +6,9 @@ // (0.17) the system is named, this program names itself with the moment it // started, and a rename that does not replace refuses a name that is taken; // (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.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. // The terminal is not observed here, // because a test run has none; the implementations observe it on a terminal // they make. @@ -34,6 +36,9 @@ long (*volatile g_recurse)(long) = recurse; long recurse(long n) { volatile char pad[1000]; pad[0] = static_cast(n); return n ? g_recurse(n - 1) + pad[0] : 0; } struct probe { kal_uintptr told; volatile int done; }; + +int g_claim = -1; +void lowers(void*) { g_claim = kal_task_set_priority(KAL_TASK_PRIORITY_BACKGROUND); } void room(void* p) { auto* q = static_cast(p); void* base = nullptr; kal_uintptr size = 0; @@ -121,6 +126,18 @@ int main() { kal_fs_remove(root, "okt.m", 5); } + { + const kal_uintptr cores = kal_task_cores(), processors = kal_task_parallelism(); + check(processors == 0 || cores <= processors, "the cores are no more than the processors"); + kal_task t{}; + if (kal_task_start(lowers, nullptr, &t) == kal_ok) { + kal_task_join(t); + const bool claims = (kal_task_props() & KAL_TASK_PROP_PRIORITY) != 0; + check(claims ? g_claim == kal_ok : g_claim == kal_err_not_supported, + "a started context lowers its claim to background, or is told the implementation has none"); + } + } + if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14); return failures == 0 ? 0 : 1; }