Provide mediated C terminal identification and window controls #19

Open
opened 2026-10-29 19:39:07 +01:00 by erikinkinen · 1 comment
Owner

Problem and motivation

C callers cannot identify or observe and resize their admitted terminal through
the process-root descriptor runtime. The native terminal service now has typed,
separately granted state and resize operations with original-owner retirement.
These should be usable without endpoint discovery or a second provider path.

Proposed behavior and scope

Add erix_c_isatty and fixed, nonvariadic erix_c_ioctl window GET/SET requests.
Define an 8-byte window record of four 16-bit dimensions and checked conversion
from the native 32-bit state. GET publishes the entire record after retirement;
errors leave it unchanged. Success preserves errno. Unknown requests, invalid
geometry and unsupported dimension values receive documented ordinary errors.

Use the existing IO runtime, shared process heap and authenticated Posixd bridge,
with a reviewed typed compatibility operation. Preserve existing native rights
and byte protocols. Full termios, conventional aliases and handler delivery are
follow-up requirements: legacy native mode bits cannot manufacture them.

Authority, security and reliability

STATE is required for positive terminal identification/window observation;
RESIZE is required for changing dimensions. A missing grant cannot establish
ENOTTY. A nonterminal result needs actual descriptor/provider evidence. Neither
paths, names, descriptor numbers, credentials nor session identifiers grant rights.

Keep each control view tied to its original descriptor description through
concurrent calls, replacement, cancellation and cleanup. Dispose it before the
byte source. Retain each caller's packets, raw results and first failure until
cleanup completes. Uncertain transport or retirement must keep those owners
and prevent replay. Existing workloads receive no extra Clock or terminal
grants. Missing or incomplete runtime binding keeps its existing trap behavior.

Acceptance criteria

  • Implement and document the namespaced signatures, fixed requests, record
    layout, strict codec/version domains and checked width/error precedence.
  • Demonstrate positive terminal identification and window observation/change
    through the same original admitted realm and independently granted native view.
  • Cover invalid/known nonterminal descriptors, missing rights, all aliases,
    width overflow, unchanged error outputs and success errno preservation.
  • Cover concurrent pending calls, close/dup2, lender loss/reset, malformed and
    unreturned callbacks, original retirement and control-before-byte cleanup.
  • Add an explicitly provisioned C/native workload and producer/VM controls
    without widening existing products; preserve header/C++/export/source guards.
  • Update the technical manual and keep full termios, conventional aliases
    and compatibility-startup acceptance explicitly separate.

Alternatives and tradeoffs

Calling the provider directly would bypass the descriptor mediator's identity
and lifetime rules. Inferring terminal identity from missing grants or names
would produce false negatives. A full termios adapter needs additional real
provider state and behavior; exposing invented values would mislead callers.
This proposal completes the existing state/window surface independently.

Tracking and rollout

Build on Ttyd's terminal adapter design
and the compatibility scope.
Agree the compatibility contract first, then land the runtime, mediator,
explicitly provisioned workload and manual with matching protocol revisions.

## Problem and motivation C callers cannot identify or observe and resize their admitted terminal through the process-root descriptor runtime. The native terminal service now has typed, separately granted state and resize operations with original-owner retirement. These should be usable without endpoint discovery or a second provider path. ## Proposed behavior and scope Add `erix_c_isatty` and fixed, nonvariadic `erix_c_ioctl` window GET/SET requests. Define an 8-byte window record of four 16-bit dimensions and checked conversion from the native 32-bit state. GET publishes the entire record after retirement; errors leave it unchanged. Success preserves errno. Unknown requests, invalid geometry and unsupported dimension values receive documented ordinary errors. Use the existing IO runtime, shared process heap and authenticated Posixd bridge, with a reviewed typed compatibility operation. Preserve existing native rights and byte protocols. Full termios, conventional aliases and handler delivery are follow-up requirements: legacy native mode bits cannot manufacture them. ## Authority, security and reliability STATE is required for positive terminal identification/window observation; RESIZE is required for changing dimensions. A missing grant cannot establish ENOTTY. A nonterminal result needs actual descriptor/provider evidence. Neither paths, names, descriptor numbers, credentials nor session identifiers grant rights. Keep each control view tied to its original descriptor description through concurrent calls, replacement, cancellation and cleanup. Dispose it before the byte source. Retain each caller's packets, raw results and first failure until cleanup completes. Uncertain transport or retirement must keep those owners and prevent replay. Existing workloads receive no extra Clock or terminal grants. Missing or incomplete runtime binding keeps its existing trap behavior. ## Acceptance criteria - [x] Implement and document the namespaced signatures, fixed requests, record layout, strict codec/version domains and checked width/error precedence. - [ ] Demonstrate positive terminal identification and window observation/change through the same original admitted realm and independently granted native view. - [ ] Cover invalid/known nonterminal descriptors, missing rights, all aliases, width overflow, unchanged error outputs and success errno preservation. - [ ] Cover concurrent pending calls, close/dup2, lender loss/reset, malformed and unreturned callbacks, original retirement and control-before-byte cleanup. - [x] Add an explicitly provisioned C/native workload and producer/VM controls without widening existing products; preserve header/C++/export/source guards. - [x] Update the technical manual and keep full termios, conventional aliases and compatibility-startup acceptance explicitly separate. ## Alternatives and tradeoffs Calling the provider directly would bypass the descriptor mediator's identity and lifetime rules. Inferring terminal identity from missing grants or names would produce false negatives. A full termios adapter needs additional real provider state and behavior; exposing invented values would mislead callers. This proposal completes the existing state/window surface independently. ## Tracking and rollout Build on [Ttyd's terminal adapter design](https://git.erikinkinen.fi/erix/ttyd/issues/5) and [the compatibility scope](https://git.erikinkinen.fi/erix/integration/issues/65). Agree the compatibility contract first, then land the runtime, mediator, explicitly provisioned workload and manual with matching protocol revisions.
Author
Owner

The namespaced terminal calls are implemented and pushed with the runtime and original C probe, the Posixd bridge and the opt-in workload. Window output is checked as a whole; missing control rights remain distinct from a proven non-terminal. The C probe includes restoration and descriptor-alias checks. Native/VM execution and complete termios remain open.

The namespaced terminal calls are implemented and pushed with [the runtime and original C probe](https://git.erikinkinen.fi/erix/lib-cstd/commit/53b1261df0ee2533b667028446429f4325988e66), [the Posixd bridge](https://git.erikinkinen.fi/erix/posixd/commit/b67bc1957091f73bf2a8c1760da1f4aec802b6a2) and [the opt-in workload](https://git.erikinkinen.fi/erix/integration/commit/4318f8a7cd55bb2c9b35d38c76bbab583c4d13b0). Window output is checked as a whole; missing control rights remain distinct from a proven non-terminal. The C probe includes restoration and descriptor-alias checks. Native/VM execution and complete termios remain open.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:41 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/lib-cstd#19
No description provided.