Skip to content

0.14.0 --- the keystrokes this kernel keeps for itself are a position now - #28

Merged
Sunrisepeak merged 1 commit into
mainfrom
openkal-0.14
Sep 20, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
openkal-0.14

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

跟随 openkal 0.14(mcpplibs/openkal#38):模式字第三个位 KAL_TERM_PASS_CONTROL 的读写,以及规范在 set_mode 旁新增的两条规则。

  • 位的映射取本环境保留按键机制的全集(termios: ISIG|IXON|IEXTEN;console: ENABLE_PROCESSED_INPUT),否则同一个模式字在两个系统上含义不同。
  • 请求值与当前值相同的位不写。
  • 关行组装时确立「读至少等一个字节」,否则 kal_stream_read 会报出一个不是输入结束的 0(条款 7.4)。

依赖:openkal 0.14.0。各仓库同名分支 openkal-0.14,CI 会检出同名规范分支。端到端验证(^C 以 0x03 到达、^S 不冻结、恢复后终端回到原样)在 openkal-musl 的 pty 探针里与宿主 C 库对照。

… now

openkal 0.14 adds KAL_TERM_PASS_CONTROL, and this implementation reads and
writes it.

* THE POSITION IS THREE FLAGS AND NOT ISIG. It states that the environment
  reserves NO keystroke, so it is reported only where every mechanism by
  which this kernel reserves one is off: ISIG for the interrupt and its
  neighbours, IXON for the pair that stops and starts output, IEXTEN for the
  one that takes the next keystroke literally. An implementation mapping ISIG
  alone would leave one mode word meaning two things on two kernels --- the
  keystroke that stops output would still be swallowed here and not on a
  console.

* A POSITION WHOSE REQUESTED VALUE IS THE ONE IN EFFECT IS NOT WRITTEN. The
  specification states the rule beside set_mode and this position is why: it
  stands for three flags, so establishing it again would settle two
  mechanisms the caller never asked about. A user who had released the
  keystroke that stops output keeps it released while a program turns the
  echo off and back on.

* AND A MODE IS NOT A WAY TO END THE INPUT. With line assembly off, how long
  a read waits is decided by VMIN and VTIME; a terminal left at VMIN=0 by
  whatever ran before made kal_stream_read report zero, which clause 7.4 says
  denotes the end of the input. The least count is established with the mode
  that needs it.

Measured: the conformance suite of openkal-0.14, run upon a pseudo-terminal,
reports 199 held and 0 did not hold; this package's own tests pass, and the
terminal section observes the position round-tripping where it used to have
nothing to observe.
@Sunrisepeak
Sunrisepeak merged commit f5ca3ed into main Sep 20, 2026
2 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.

1 participant