The entry console
Live console pre-call / wide-grant confirmation policy, CLDR en/fr localized prompt labels, and role contract listing integrated into console.
console module with an entry
- Hash
3c4a0e3403ddd2f08b8b1ab7b7d30f9618c122e531f357c66d17cf06619e31f6- Size
973145 bytes- Exports
0- Imports
0- Imported by
0- License
- MIT
Live console pre-call / wide-grant confirmation policy, CLDR en/fr localized prompt labels, and role contract listing integrated into console
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/system/console |
| Boot image | yes: in the boot image, 973145 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
entry() | starts the console and runs its first thread: it reads the keys until the machine stops |
entry
entry()
entry starts the console and runs its first thread: it reads the keys until the machine stops.
What it sets up, in order:
- 1. The random generator, from the seed that the root service wrote in the context: it gives the seed of each process that the console starts.
- 2. The terminal (
terminal.open). - 3. The commands (
commands_start): it maps the boot image, the debug image, the root ring and the replacement table that the root service granted, and lists the commands of the console. - 4. The second thread,
run_lines, which runs each line. - 5. The first line on the terminal, the edit line, and the log record
console: ready. - 6. The line history of the run before, from its store (
history_load).
The loop. The thread takes each key of the terminal ring. With no line running, the key edits the line, opens the completion list, walks the history, or runs the line (key). While a line runs, Escape asks the second thread to stop the isolated call, and each other key waits, in order, until the line ends. 128 keys wait in the console; the keys after them stay in the terminal ring, in order, and the console takes them when the line ends. Only while Escape can stop a call of the line does the console read on with 128 keys waiting, to find that Escape: a key that is not Escape is then lost, and the log has the count . The thread then waits for a key, for a change of the second thread, or for 100 ms while a line runs, so that the time of the line on the screen moves.
The stop. With no random seed or no terminal, the console writes the reason on the log (console: no terminal) and stops with Refused; with no second thread, with Failed. Else it never returns: stop("console") or shutdown() ends it.
See: The line of the console: When a line ends, and the keys typed during a line
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/system/console/main.odin:237
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | The console is the shell of the machine, and its commands need each grant:
| |
| Other terms of its start grant set | store_blocks = 3, log_gives = true | |
| Budget that it asks for |
| Itself and four sandboxes, each a call host with its thread. The working memory holds 7583 pages, and the 144 pages of the stack of the second thread past the stack of a thread that names no size. |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
Error_Record struct
A struct of the package errors: 56 bytes, aligned on 8 bytes, 0 bytes of padding. The error record: what a call that failed says about why, as seven integers.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
open procedure of the package terminal_records
open :: proc "contextless" (ctx: ^system.Context, error: ^errors. = nil) -> (terminal: Terminal, ok: bool)
open gives the terminal of this process.
commands_start procedure of the package console
commands_start :: proc "contextless" ()
commands_start maps what the root service granted, and lists the commands.
run_lines procedure of the package console
run_lines :: proc "c" (parameter: rawptr) -> !
run_lines is the entry of the second thread: it runs each line that the.
history_load procedure of the package console
history_load :: proc "contextless" ()
history_load reads the history of the run before, at the start of the.
