Skip to content

Implement openkal.terminal, and follow openkal 0.8 - #11

Merged
Sunrisepeak merged 5 commits into
mainfrom
feat/openkal-0.8
Aug 27, 2026
Merged

Implement openkal.terminal, and follow openkal 0.8#11
Sunrisepeak merged 5 commits into
mainfrom
feat/openkal-0.8

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Paired with mcpplibs/openkal#13.

The terminal ioctls this kernel offers are the ones kal_stream_props already uses, so the interface is a natural extension rather than a new mechanism: TIOCGETA and TIOCSETA for the mode, TIOCGWINSZ for the size.

The request numbers encode the size of the structure they carry, so the layout is declared in this file and asserted with a static_assert rather than named from a header. A header stating it would belong to a C library, and this implementation has none.

The mode is read, modified and written rather than written alone. The structure carries a baud rate and twenty control characters that the interface does not name; composing one from the mode word would discard them, and the terminal a program returned to would not be the one it found.

kal_terminal_props asks TIOCGWINSZ rather than deriving the answer from TIOCGETA. A pseudo terminal answers both and a serial line answers only the first, so a word derived from one would claim a facility the next call refuses — the disagreement clause 6.2 exists to prevent.

The other four interfaces version 0.8 adds are not provided, which clause 6.1 makes an absence at the link rather than a deviation.

`xim:glibc` 的 `latest` 从 `2.44` 移到了 `2.44.2`。载荷目录按请求**解析成**的版本
命名,而 RuntimeBinding 带的是**声明的**版本 —— 而一个已发布的 mcpp vendor 进自己
沙箱的那份 xlings 仍然声明 `2.44`。于是干净机器装出 `2.44.2`,工具链 fixup 要
`2.44`,构建在编译任何东西之前就停住:

    error: selected RuntimeBinding glibc@2.44 requires payload
           '.../xpkgs/xim-x-glibc/2.44', but it is not installed

⚠️ 在每一台**新**机器上出现,在任何已存在的机器上都不出现 —— 所以开发机看不见。
索引的 `pkgs/g/glibc.lua` 把这次失败逐字记着,并给出规则:
「The index is DATA and the client is a PROGRAM: the consumer ships first。」

## ⚠️ 我先试过 bump xlings,撤回了

把 `XLINGS_VERSION` 提到 2026.8.27.1 会让**沙箱里那份** xlings 被换掉
(mcpp 的 `acquire_xlings_binary` 在 pin 前移时更新它),绑定于是**前移**到
`glibc@2.44.2`,而已经装好的是 `2.44` —— 请求比已装的**更新**。那是更糟的一侧:
接受一个更旧的载荷去回答更新的请求,等于静默用上索引明说
「IT IS NOT THE ONE TO INSTALL」的那份(带 mcpp#484 的 preload 缺陷)。

⇒ 保持 xlings 不动,把缺的那个载荷直接装上。

⭐ 待 mcpp 2026.8.27.1(mcpp-community/mcpp#515)发布后移除:它接受
「版本精化了请求」的已装载荷,从它引导就不需要这一步。
The terminal ioctls this kernel offers are the ones kal_stream_props already
uses, so the interface is a natural extension rather than a new mechanism:
TIOCGETA and TIOCSETA for the mode, TIOCGWINSZ for the size.

The request numbers encode the size of the structure they carry, so the layout is
declared here and asserted rather than named from a header. A header stating it
would belong to a C library, and this implementation has none.

The mode is read, modified and written rather than written alone. The structure
carries a baud rate and twenty control characters that the interface does not
name; composing one from the mode word would discard them, and the terminal a
program returned to would not be the one it found.

kal_terminal_props asks TIOCGWINSZ rather than deriving the answer from TIOCGETA.
A pseudo terminal answers both and a serial line answers only the first, so a
word derived from one would claim a facility the next call refuses.

The other four interfaces version 0.8 adds are not provided, which clause 6.1
makes an absence at the link rather than a deviation.
ADDING TO AN EXISTING INTERFACE OBLIGES EVERY IMPLEMENTATION OF IT, and adding a
new interface obliges none. Clause 6.1 makes an interface a backend does not
provide absent at the link and not a deviation; it makes one provided IN PART a
deviation. The five interfaces version 0.8 adds are therefore free to decline,
and the three names added to openkal.process are not.

The specification's own surface checker said so before anything else noticed:

    openkal.process is provided in part: 3 of 8 names are not exported --
        kal_process_channel
        kal_process_channel_close
        kal_process_spawn_with

kal_process_channel is this kernel's `pipe', which reports BOTH descriptors as
return values rather than through a buffer. That is a property of the calling
convention, and src/sys.h already meets the same difference for the duplication
primitive; a second wrapper is added beside it rather than the difference being
hidden.

There is no pipe2 here, so close-on-exec is set afterwards with fcntl. The two
steps are not equivalent to one under a concurrent spawn, and that is stated
rather than concealed: a caller that spawns from one context, which is what a
program using this operation does, is unaffected.

dup2 onto the same number succeeds and does nothing, where the other kernel's
dup3 refuses. Either is right for the placement loop; only the reason differs,
and it is written down so that a reader comparing the two implementations does
not take one for an oversight.
The number was already in the table. I added it again beside nr_pipe rather than
looking, and this kernel's table is one enumeration, so the second declaration is
an error rather than a duplicate:

    src/sys.h:178:5: error: redefinition of enumerator 'nr_fcntl'

Not visible from a machine that cannot build for this system, which is why the
check that found it is the one that runs on it. The whole table was then examined
for the same shape rather than this one line corrected: no other name is declared
twice, in either architecture's block, in this repository or in the other
backend that has such a table.
openkal 0.8.0 is published, so the manifest names it by version rather than by
branch. A branch is how a change spanning these repositories is developed and is
not a form a published package may carry: a consumer resolving from the index
would be handed a reference that moves.

The engine pin moves to mcpp 2026.8.27.1 and the repository variable
MCPP_SOURCE_REF is cleared, so what this repository tests is the engine a user
installs.
@Sunrisepeak
Sunrisepeak merged commit 3da0934 into main Aug 27, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants