modus
Menu
On this page

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

FactValue
KindModules with an entry
Sourcesrc/modules/system/console
Boot imageyes: in the boot image, 973145 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat 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. 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. 2. The terminal (terminal.open).
  3. 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. 4. The second thread, run_lines, which runs each line.
  5. 5. The first line on the terminal, the edit line, and the log record console: ready.
  6. 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.
Source
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

WhatValueAs the root service says
Grants

The console is the shell of the machine, and its commands need each grant:

  • Root_Ring: start, stop, grants, revoke, connect and the commands of the principals ask this service.
  • Inspect: memory, locks and process_modules read the reports of the machine.
  • Stop: shutdown stops the machine.
  • Image: load and isolate map the modules of the boot image.
  • Debug_Image: a stop report names the procedures and the source lines.
  • Replacements and Replace: replacements reads the replacement table, replace changes it.
  • Terminal: the console has no surface of its own.
  • Store: connect storage opens its private store, with a small limit of blocks that a test reaches.
  • History_Store: the line history, apart from that store.
  • Acts_For_Principal: a service that it connects to shows what it holds for all callers.
  • Palette: its commands show in the palette of the desktop, and the palette names the one that the input chose. It gives the log to the processes that it starts, which write on it.
Other terms of its start grant setstore_blocks = 3, log_gives = true
Budget that it asks for
  • working memory pages 7727
  • pages of its threads 167
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 5
  • threads 6
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 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 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.

src/library/modus/terminal/terminal.odin:333

commands_start procedure of the package console

commands_start :: proc "contextless" ()

commands_start maps what the root service granted, and lists the commands.

src/modules/system/console/commands.odin:229

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.

src/modules/system/console/main.odin:372

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.

src/modules/system/console/history_store.odin:116