Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 声明它之前已包含头文件)。
Expand Down
21 changes: 21 additions & 0 deletions pkgs/o/openkal-emscripten.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 21 additions & 0 deletions pkgs/o/openkal-linux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 21 additions & 0 deletions pkgs/o/openkal-macos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 21 additions & 0 deletions pkgs/o/openkal-windows.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 21 additions & 0 deletions pkgs/o/openkal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions tests/examples/openkal/mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
51 changes: 50 additions & 1 deletion tests/examples/openkal/tests/kal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <openkal/env.h>
#include <openkal/fs.h>
#include <openkal/map.h>
#include <openkal/memory.h>
#include <openkal/process.h>
#include <openkal/region.h>
#include <openkal/stream.h>
#include <openkal/task.h>
#include <openkal/version.h>
Expand Down Expand Up @@ -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<unsigned char*>(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;
}
Loading