The entry origin
The source src/modules/demonstrations/origin built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
A demonstration of the origin of a handle and of Handle_Revoke: a process holds only the handles that it was given, and each grant can be revoked with all that came from it.
The kernel keeps, for each handle and each mapping, the handle that it came from. A process takes back what came from a handle of its own: the copies, the handles that other processes received, and their mappings. The window shows each case and the answer of the kernel.
What it is for. It shows that each access in the system can be taken back. A process lends a handle for one call, then revokes it: the kernel ends each copy and each mapping that came from it, in this process and in the processes that received it. No process needs the cooperation of the receiver to take back what it gave.
The cases, in order:
- a copy with the right Read, then a copy of the copy that asks for Write: the kernel gives Read only, because a copy never has more rights;
- the count of what came from a handle, before and after a close;
- a revocation: the copies end, the mapping of the process stays;
- a mapping in another process, then its revocation;
- a revocation in one other process only, with
Handle_Revokeand the handle of that process; - a revocation of a handle that the process does not have:
Bad_Handle.
Start: start("origin") in the console, or the bar of the desktop. Its row of start_grant_sets has no grant: everything that it uses, it makes. Its budget has room for two processes: itself and the process "held", which never runs and only receives.
What a reader sees: the table of the cases and the answers of the kernel. The log has "origin: ok, 12 cases", or "origin: wrong answer: ..." for each case that failed, then the cost of a lent handle: "origin: lend a handle and take it back: N ns with 4 kernel entries; copy and close: M ns with 2".
origin module with an entry
- Hash
0faf029509ea6245e4f061d01a1d7144f4b2d8dc8f2ef907d6d9b7e048b459fe- Size
146031 bytes- Exports
0- Imports
1- Imported by
0- License
- MIT
A demonstration of the origin of a handle and of Handle_Revoke: a process holds only the handles that it was given, and each grant can be revoked with all that came from it
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/origin |
| Boot image | yes: in the boot image, 146031 bytes in this build |
| Build settings |
|
| Imports | |
| Imported by | none |
Neighbours
What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.
Exports
| Export | What it does |
|---|---|
entry() | The entry of origin: it runs the cases of the origin of a handle once, measures a lent handle, then shows the result until the principal closes the window |
entry
entry()
The entry of origin: it runs the cases of the origin of a handle once, measures a lent handle, then shows the result until the principal closes the window.
With no window it stops with Failed. It creates one memory object and one process "held" from its own budget, runs the cases (each one compares the answer of the kernel with the expected answer), writes the result on the log, and measures 20000 cycles of "lend and take back" and 20000 of "copy and close". Then it draws the table and waits for events for ever.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/origin/main.odin:103
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 | none | Everything that it uses, it makes. |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| Itself and one process that only receives: 1372 pages. And the glyph memory of the copy of the text rendering of the drawing module, which draws its text: 354 pages (display.TEXT_MEMORY_PAGES). 1372 + 354 = 1726. |
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).
start_grant_sets global variable of the package root
start_grant_sets := [?]Start_Grant_Set_Row {...}
The start grant set of each module of the boot image, with the reason of each.
