Skip to content

Commit 7a443c9

Browse files
openkal 0.20.0; openkal-linux 0.21.0, openkal-macos 0.18.0, openkal-windows 0.16.0, openkal-emscripten 0.9.0 (#660)
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent 4487e21 commit 7a443c9

8 files changed

Lines changed: 165 additions & 6 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
### Added
1717

18+
- **openkal 0.20.0;openkal-linux 0.21.0、openkal-macos 0.18.0、openkal-windows 0.16.0、openkal-emscripten 0.9.0。** 按偏移的传输
19+
(`kal_fs_read_at`/`kal_fs_write_at`,不用也不改位置);程序与单元的内存用量(`KAL_PINFO_MEMORY`、`kal_process_job_usage`)与
20+
单元的内存限额(`kal_process_job_limit`,HARD/SUPERVISED);可选接口 `openkal.region`(保留、分段提交、归还与丢弃、整体释放);
21+
加载器提供的 `openkal.prof`/`openkal.debug`。测试成员 `openkal` 随之移动,并观察按偏移的传输、本程序的内存与区域。
22+
GLOBAL 为 GitHub 标签归档,CN 为 GitCode `mcpp-res` 镜像,sha256 两处一致。
1823
- **compat.mimalloc 3.6.1。** 与 3.4.5 并存;同一份源文件列表同时写出两个版本的目录布局(3.6.1 分为 `alloc/`、`arena/`、
1924
`heap/`、`prim/`、`profile/`、`util/` 七个目录,新增 `profile/` 三个单元),列表中某版本没有的名字在该版本下不选中任何文件。
2025
按 c11 编译时补上 `_DEFAULT_SOURCE`(上游以 gnu11 编译;3.6.1 的 `prim/prim.c` 在 `prim/unix/prim.c` 声明它之前已包含头文件)。

‎pkgs/o/openkal-emscripten.lua‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ package = {
4646

4747
xpm = {
4848
linux = {
49+
["0.9.0"] = {
50+
url = {
51+
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.9.0.tar.gz",
52+
CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.9.0/openkal-emscripten-0.9.0.tar.gz",
53+
},
54+
sha256 = "effc74936b1d7d476d848c90cbbd24ac50488d6be6ba65fb0ef4b3ec9cb65247",
55+
},
4956
["0.8.0"] = {
5057
url = {
5158
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz",
@@ -118,6 +125,13 @@ package = {
118125
},
119126
},
120127
macosx = {
128+
["0.9.0"] = {
129+
url = {
130+
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.9.0.tar.gz",
131+
CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.9.0/openkal-emscripten-0.9.0.tar.gz",
132+
},
133+
sha256 = "effc74936b1d7d476d848c90cbbd24ac50488d6be6ba65fb0ef4b3ec9cb65247",
134+
},
121135
["0.8.0"] = {
122136
url = {
123137
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz",
@@ -190,6 +204,13 @@ package = {
190204
},
191205
},
192206
windows = {
207+
["0.9.0"] = {
208+
url = {
209+
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.9.0.tar.gz",
210+
CN = "https://gitcode.com/mcpp-res/openkal-emscripten/releases/download/0.9.0/openkal-emscripten-0.9.0.tar.gz",
211+
},
212+
sha256 = "effc74936b1d7d476d848c90cbbd24ac50488d6be6ba65fb0ef4b3ec9cb65247",
213+
},
193214
["0.8.0"] = {
194215
url = {
195216
GLOBAL = "https://github.com/mcpplibs/openkal-emscripten/archive/refs/tags/0.8.0.tar.gz",

‎pkgs/o/openkal-linux.lua‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ package = {
1919

2020
xpm = {
2121
linux = {
22+
["0.21.0"] = {
23+
url = {
24+
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz",
25+
CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.21.0/openkal-linux-0.21.0.tar.gz",
26+
},
27+
sha256 = "bf427de8411e0b8252d4ab8fb74863b7d93283fa6fe7cf7af94be11ab86c2fd0",
28+
},
2229
["0.20.0"] = {
2330
url = {
2431
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz",
@@ -196,6 +203,13 @@ package = {
196203
},
197204
},
198205
macosx = {
206+
["0.21.0"] = {
207+
url = {
208+
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz",
209+
CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.21.0/openkal-linux-0.21.0.tar.gz",
210+
},
211+
sha256 = "bf427de8411e0b8252d4ab8fb74863b7d93283fa6fe7cf7af94be11ab86c2fd0",
212+
},
199213
["0.20.0"] = {
200214
url = {
201215
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz",
@@ -373,6 +387,13 @@ package = {
373387
},
374388
},
375389
windows = {
390+
["0.21.0"] = {
391+
url = {
392+
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.21.0.tar.gz",
393+
CN = "https://gitcode.com/mcpp-res/openkal-linux/releases/download/0.21.0/openkal-linux-0.21.0.tar.gz",
394+
},
395+
sha256 = "bf427de8411e0b8252d4ab8fb74863b7d93283fa6fe7cf7af94be11ab86c2fd0",
396+
},
376397
["0.20.0"] = {
377398
url = {
378399
GLOBAL = "https://github.com/mcpplibs/openkal-linux/archive/refs/tags/0.20.0.tar.gz",

‎pkgs/o/openkal-macos.lua‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ package = {
1919

2020
xpm = {
2121
linux = {
22+
["0.18.0"] = {
23+
url = {
24+
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz",
25+
CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.18.0/openkal-macos-0.18.0.tar.gz",
26+
},
27+
sha256 = "d14ec6808e6f5e580a09d57c20175aa28e4ee207ef2dcf686b1e88842ddd37ec",
28+
},
2229
["0.17.1"] = {
2330
url = {
2431
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.1.tar.gz",
@@ -196,6 +203,13 @@ package = {
196203
},
197204
},
198205
macosx = {
206+
["0.18.0"] = {
207+
url = {
208+
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz",
209+
CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.18.0/openkal-macos-0.18.0.tar.gz",
210+
},
211+
sha256 = "d14ec6808e6f5e580a09d57c20175aa28e4ee207ef2dcf686b1e88842ddd37ec",
212+
},
199213
["0.17.1"] = {
200214
url = {
201215
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.1.tar.gz",
@@ -373,6 +387,13 @@ package = {
373387
},
374388
},
375389
windows = {
390+
["0.18.0"] = {
391+
url = {
392+
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.18.0.tar.gz",
393+
CN = "https://gitcode.com/mcpp-res/openkal-macos/releases/download/0.18.0/openkal-macos-0.18.0.tar.gz",
394+
},
395+
sha256 = "d14ec6808e6f5e580a09d57c20175aa28e4ee207ef2dcf686b1e88842ddd37ec",
396+
},
376397
["0.17.1"] = {
377398
url = {
378399
GLOBAL = "https://github.com/mcpplibs/openkal-macos/archive/refs/tags/0.17.1.tar.gz",

‎pkgs/o/openkal-windows.lua‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ package = {
2121

2222
xpm = {
2323
linux = {
24+
["0.16.0"] = {
25+
url = {
26+
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz",
27+
CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.16.0/openkal-windows-0.16.0.tar.gz",
28+
},
29+
sha256 = "aaa324dca9a6795c9ffd13bc77b351f5bc7b6f445c9f5371af352080a9a9bb0a",
30+
},
2431
["0.15.0"] = {
2532
url = {
2633
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz",
@@ -219,6 +226,13 @@ package = {
219226
},
220227
},
221228
macosx = {
229+
["0.16.0"] = {
230+
url = {
231+
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz",
232+
CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.16.0/openkal-windows-0.16.0.tar.gz",
233+
},
234+
sha256 = "aaa324dca9a6795c9ffd13bc77b351f5bc7b6f445c9f5371af352080a9a9bb0a",
235+
},
222236
["0.15.0"] = {
223237
url = {
224238
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz",
@@ -417,6 +431,13 @@ package = {
417431
},
418432
},
419433
windows = {
434+
["0.16.0"] = {
435+
url = {
436+
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.16.0.tar.gz",
437+
CN = "https://gitcode.com/mcpp-res/openkal-windows/releases/download/0.16.0/openkal-windows-0.16.0.tar.gz",
438+
},
439+
sha256 = "aaa324dca9a6795c9ffd13bc77b351f5bc7b6f445c9f5371af352080a9a9bb0a",
440+
},
420441
["0.15.0"] = {
421442
url = {
422443
GLOBAL = "https://github.com/mcpplibs/openkal-windows/archive/refs/tags/0.15.0.tar.gz",

‎pkgs/o/openkal.lua‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ package = {
2222

2323
xpm = {
2424
linux = {
25+
["0.20.0"] = {
26+
url = {
27+
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz",
28+
CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.20.0/openkal-0.20.0.tar.gz",
29+
},
30+
sha256 = "f6ce55dd754d7aceb790a551d545da99e9c3c1459a50444db0e4faea04ee1b14",
31+
},
2532
["0.19.0"] = {
2633
url = {
2734
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz",
@@ -157,6 +164,13 @@ package = {
157164
},
158165
},
159166
macosx = {
167+
["0.20.0"] = {
168+
url = {
169+
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz",
170+
CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.20.0/openkal-0.20.0.tar.gz",
171+
},
172+
sha256 = "f6ce55dd754d7aceb790a551d545da99e9c3c1459a50444db0e4faea04ee1b14",
173+
},
160174
["0.19.0"] = {
161175
url = {
162176
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz",
@@ -292,6 +306,13 @@ package = {
292306
},
293307
},
294308
windows = {
309+
["0.20.0"] = {
310+
url = {
311+
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.20.0.tar.gz",
312+
CN = "https://gitcode.com/mcpp-res/openkal/releases/download/0.20.0/openkal-0.20.0.tar.gz",
313+
},
314+
sha256 = "f6ce55dd754d7aceb790a551d545da99e9c3c1459a50444db0e4faea04ee1b14",
315+
},
295316
["0.19.0"] = {
296317
url = {
297318
GLOBAL = "https://github.com/mcpplibs/openkal/archive/refs/tags/0.19.0.tar.gz",

‎tests/examples/openkal/mcpp.toml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ name = "openkal-tests"
1818
version = "0.1.0"
1919

2020
[dependencies.mcpplibs]
21-
openkal = "0.19.0"
21+
openkal = "0.20.0"
2222

2323
[target.'cfg(os = "linux")'.dependencies.mcpplibs]
24-
openkal-linux = "0.20.0"
24+
openkal-linux = "0.21.0"
2525

2626
[target.'cfg(os = "macos")'.dependencies.mcpplibs]
27-
openkal-macos = "0.17.1"
27+
openkal-macos = "0.18.0"
2828

2929
[target.'cfg(windows)'.dependencies.mcpplibs]
30-
openkal-windows = "0.15.0"
30+
openkal-windows = "0.16.0"
3131

3232
[target.'cfg(all(os = "linux", env = "musl"))'.dependencies.mcpplibs]
3333
openkal-llvm-runtime = "0.16.15"
3434

3535
[target.'cfg(arch = "wasm32")'.dependencies.mcpplibs]
36-
openkal-emscripten = "0.8.0"
36+
openkal-emscripten = "0.9.0"
3737

3838
[target.'cfg(arch = "riscv64")'.dependencies.mcpplibs]
3939
openkal-opensbi = "0.8.3"

‎tests/examples/openkal/tests/kal.cpp‎

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
// (0.17.1) a joined command line is refused where programs receive vectors;
99
// (0.18) a file is mapped, the region holds its bytes and zero after its end;
1010
// (0.19) the cores are no more than the processors, and a started context
11-
// lowers its claim on the processors where the implementation claims it.
11+
// lowers its claim on the processors where the implementation claims it;
12+
// (0.20) a transfer at an offset neither uses nor moves the file's position,
13+
// this program is told the memory it occupies and its peak, and a region is
14+
// reserved, backed, written, its backing returned and backed again reading
15+
// zero, and released.
1216
// The terminal is not observed here,
1317
// because a test run has none; the implementations observe it on a terminal
1418
// they make.
1519
#include <openkal/env.h>
1620
#include <openkal/fs.h>
1721
#include <openkal/map.h>
22+
#include <openkal/memory.h>
1823
#include <openkal/process.h>
24+
#include <openkal/region.h>
1925
#include <openkal/stream.h>
2026
#include <openkal/task.h>
2127
#include <openkal/version.h>
@@ -138,6 +144,49 @@ int main() {
138144
}
139145
}
140146

147+
if (kal_fs_preopen_count() > 0 && kal_fs_preopen(0, &root, nullptr, 0, nullptr) == kal_ok) {
148+
kal_file f{};
149+
if (kal_fs_open(root, "okt.p", 5, KAL_OPEN_READ | KAL_OPEN_WRITE | KAL_OPEN_CREATE | KAL_OPEN_TRUNCATE, &f) == kal_ok) {
150+
kal_stream_write(kal_fs_stream(f), "abcdef", 6);
151+
check(kal_fs_write_at(f, "XY", 2, 1) == 2, "a write at an offset writes the whole buffer");
152+
kal_u64 at = 0;
153+
check(kal_fs_seek(f, 0, KAL_SEEK_CURRENT, &at) == kal_ok && at == 6,
154+
"and leaves the position where it was");
155+
char b[8] = {};
156+
check(kal_fs_read_at(f, b, 6, 0) == 6 && b[0] == 'a' && b[1] == 'X' && b[2] == 'Y' && b[5] == 'f',
157+
"a read at an offset reads what is there");
158+
check(kal_fs_read_at(f, b, 6, 6) == 0, "a read at the end reads nothing");
159+
kal_fs_close_file(f);
160+
}
161+
kal_fs_remove(root, "okt.p", 5);
162+
}
163+
164+
{
165+
kal_process me{};
166+
if (kal_process_self(&me) == kal_ok) {
167+
kal_program_info info{};
168+
info.self_size = sizeof info;
169+
if (kal_process_info(me, KAL_PINFO_MEMORY, &info) == kal_ok && (info.present & KAL_PINFO_MEMORY))
170+
check(info.memory_bytes > 0 && info.memory_peak_bytes >= info.memory_bytes,
171+
"this program is told the memory it occupies, and a peak no smaller");
172+
kal_process_close(me);
173+
}
174+
}
175+
176+
if (kal_interfaces() & KAL_IFACE_REGION) {
177+
const kal_uintptr g = kal_memory_granularity();
178+
auto* r = static_cast<unsigned char*>(kal_region_reserve(4 * g, g, 0));
179+
check(r != nullptr, "a region is reserved");
180+
if (r) {
181+
check(kal_region_commit(r, g) == kal_ok, "a part of it is backed");
182+
r[0] = 7; r[g - 1] = 9;
183+
check(kal_region_decommit(r, g) == kal_ok && kal_region_commit(r, g) == kal_ok,
184+
"its backing is returned and it is backed again");
185+
check(r[0] == 0 && r[g - 1] == 0, "and it reads as zero");
186+
kal_region_release(r, 4 * g);
187+
}
188+
}
189+
141190
if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14);
142191
return failures == 0 ? 0 : 1;
143192
}

0 commit comments

Comments
 (0)