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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

### Added

- **openkal 0.18.0、openkal-linux 0.19.0、openkal-macos 0.16.0、openkal-windows 0.14.0。** 新的可选接口
`openkal.map`(`KAL_IFACE_MAP`):`kal_map_file` 把文件的一部分映射到地址空间(偏移为 `KAL_MAP_ALIGNMENT`,即
64 KiB 的倍数;读或写、私有或共享),`kal_map_sync` 使共享区域的写入对文件读取可见,`kal_map_release` 按地址与长度
释放。区域不越过文件末尾、不可执行;末页中文件末尾之后的字节读为零。三个实现分别以 mmap、mmap 与 section/view
实现。测试成员 `openkal` 随之移动,并观察 0.18 的映射。GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,
sha256 两处一致。
- **mcpplibs.os 0.2.3。** 钉 openkal-linux 0.18.3:目录句柄以 `O_PATH` 打开,进程可搜索而不可读的目录中按绝对名
启动的程序能被找到(Android 应用沙箱,mcpp-community/mcpp#857)。测试成员 `os` 随之移动。GLOBAL 为 GitHub 标签归档,CN 为 GitCode
`mcpp-res` 镜像,sha256 两处一致。
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.19.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.19.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.19.0/openkal-linux-0.19.0.tar.gz",
},
sha256 = "bd5d13009404c1d87f0828ba9b26d6f28340982901723bcbe7c9a729a5acb331",
},
["0.18.3"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.18.3.tar.gz",
Expand Down Expand Up @@ -182,6 +189,13 @@ package = {
},
},
macosx = {
["0.19.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.19.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.19.0/openkal-linux-0.19.0.tar.gz",
},
sha256 = "bd5d13009404c1d87f0828ba9b26d6f28340982901723bcbe7c9a729a5acb331",
},
["0.18.3"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.18.3.tar.gz",
Expand Down Expand Up @@ -345,6 +359,13 @@ package = {
},
},
windows = {
["0.19.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.19.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.19.0/openkal-linux-0.19.0.tar.gz",
},
sha256 = "bd5d13009404c1d87f0828ba9b26d6f28340982901723bcbe7c9a729a5acb331",
},
["0.18.3"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.18.3.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.16.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.16.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.16.0/openkal-macos-0.16.0.tar.gz",
},
sha256 = "9597ad34c49f49da7b62ef81c94bd1ce20dc7c056d897f7f5ffc94e389831c08",
},
["0.15.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.15.1.tar.gz",
Expand Down Expand Up @@ -175,6 +182,13 @@ package = {
},
},
macosx = {
["0.16.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.16.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.16.0/openkal-macos-0.16.0.tar.gz",
},
sha256 = "9597ad34c49f49da7b62ef81c94bd1ce20dc7c056d897f7f5ffc94e389831c08",
},
["0.15.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.15.1.tar.gz",
Expand Down Expand Up @@ -331,6 +345,13 @@ package = {
},
},
windows = {
["0.16.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.16.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.16.0/openkal-macos-0.16.0.tar.gz",
},
sha256 = "9597ad34c49f49da7b62ef81c94bd1ce20dc7c056d897f7f5ffc94e389831c08",
},
["0.15.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.15.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.14.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.14.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.14.0/openkal-windows-0.14.0.tar.gz",
},
sha256 = "756112f71bd4a2cadd9273dd23d07415d61def3b2ef6e0188e271c27fdc645cd",
},
["0.13.3"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.13.3.tar.gz",
Expand Down Expand Up @@ -205,6 +212,13 @@ package = {
},
},
macosx = {
["0.14.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.14.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.14.0/openkal-windows-0.14.0.tar.gz",
},
sha256 = "756112f71bd4a2cadd9273dd23d07415d61def3b2ef6e0188e271c27fdc645cd",
},
["0.13.3"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.13.3.tar.gz",
Expand Down Expand Up @@ -389,6 +403,13 @@ package = {
},
},
windows = {
["0.14.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.14.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.14.0/openkal-windows-0.14.0.tar.gz",
},
sha256 = "756112f71bd4a2cadd9273dd23d07415d61def3b2ef6e0188e271c27fdc645cd",
},
["0.13.3"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.13.3.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.18.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.18.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.18.0/openkal-0.18.0.tar.gz",
},
sha256 = "d6feb5acff4cb5162dc4306dc0d46b3df67051ccd03894857a03ebf6032dae26",
},
["0.17.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.17.1.tar.gz",
Expand Down Expand Up @@ -143,6 +150,13 @@ package = {
},
},
macosx = {
["0.18.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.18.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.18.0/openkal-0.18.0.tar.gz",
},
sha256 = "d6feb5acff4cb5162dc4306dc0d46b3df67051ccd03894857a03ebf6032dae26",
},
["0.17.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.17.1.tar.gz",
Expand Down Expand Up @@ -264,6 +278,13 @@ package = {
},
},
windows = {
["0.18.0"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.18.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.18.0/openkal-0.18.0.tar.gz",
},
sha256 = "d6feb5acff4cb5162dc4306dc0d46b3df67051ccd03894857a03ebf6032dae26",
},
["0.17.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.17.1.tar.gz",
Expand Down
8 changes: 4 additions & 4 deletions tests/examples/openkal/mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ name = "openkal-tests"
version = "0.1.0"

[dependencies.mcpplibs]
openkal = "0.17.1"
openkal = "0.18.0"

[target.'cfg(os = "linux")'.dependencies.mcpplibs]
openkal-linux = "0.18.3"
openkal-linux = "0.19.0"

[target.'cfg(os = "macos")'.dependencies.mcpplibs]
openkal-macos = "0.15.1"
openkal-macos = "0.16.0"

[target.'cfg(windows)'.dependencies.mcpplibs]
openkal-windows = "0.13.3"
openkal-windows = "0.14.0"

[target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs]
openkal-llvm-runtime = "0.16.9"
Expand Down
21 changes: 20 additions & 1 deletion tests/examples/openkal/tests/kal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
// size and has the room; a closed directory's enumeration is refused; and
// (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.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.
// 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/process.h>
#include <openkal/stream.h>
#include <openkal/task.h>
Expand Down Expand Up @@ -44,6 +46,7 @@ void room(void* p) {
int main() {
check(KAL_VERSION_MINOR >= 17u || KAL_VERSION_MAJOR > 0u, "the declarations are openkal 0.17 or later");
check(KAL_VERSION_MINOR > 17u || KAL_VERSION_PATCH >= 1u || KAL_VERSION_MAJOR > 0u, "and 0.17.1 or later");
check(KAL_VERSION_MINOR >= 18u || KAL_VERSION_MAJOR > 0u, "and 0.18 or later");
check(kal_version() >= KAL_VERSION, "the implementation is at least as new as the declarations");

probe q{0, 0};
Expand Down Expand Up @@ -102,6 +105,22 @@ int main() {
"a joined command line is refused where programs receive vectors");
}

if (root.h && (kal_interfaces() & KAL_IFACE_MAP) != 0) {
kal_file f{};
if (kal_fs_open(root, "okt.m", 5, KAL_OPEN_READ | KAL_OPEN_WRITE | KAL_OPEN_CREATE | KAL_OPEN_TRUNCATE, &f) == kal_ok) {
kal_stream_write(kal_fs_stream(f), "mapped", 6);
void* region = nullptr;
check(kal_map_file(f, 0, 6, 0, &region) == kal_ok, "a file is mapped");
if (region) {
const volatile char* b = static_cast<const char*>(region);
check(b[0] == 'm' && b[5] == 'd' && b[6] == 0, "the region holds the file's bytes and zero after its end");
kal_map_release(region, 6);
}
kal_fs_close_file(f);
}
kal_fs_remove(root, "okt.m", 5);
}

if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14);
return failures == 0 ? 0 : 1;
}
Loading