The program tally
A count that its callers add to. This module shows that one file has each role: the system has no difference between a command line program, a library and a dynamic library.
The same file, with the same hash, is used in four ways:
start("tally") a program, with a window that shows the count
connect("tally") a service: the calls go to the program that runs
load("tally") a library: the calls are direct, in the memory of the caller
isolate("tally") a sandboxed program: the calls go through a ring
The data of a module belongs to the program that runs it. The four uses give three counts: the program and the service have one count, the caller that loads the module has its own, and the sandboxed program has its own.
An export needs nothing from the entry: it reads and writes the data of the module only. That is the one rule for a module that has each role.
| Fact | Value |
|---|---|
| Source | programs/tally |
| Boot image | in the boot image; the image is not built, so its size is not known |
| Imports | none |
| Imported by | none |
Exports
| Export | What it does |
|---|---|
| add(amount: Integer, note: Text) -> Integer | adds an amount to the count, with a note that says why |
| total() -> Integer | gives the count |
| adds() -> Integer | gives the number of calls of add after the start, or after the last reset |
| last() -> Text | gives the note of the last add |
| reset() -> Integer | puts the count at 0 and removes the notes |
| entry() |
Read from the source of the module, as the build reads it to describe the exports (tools/kerneltool/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | {.Serve} | sample: the module of the tables, started as a program when a caller connects. |
| Budget: pages, programs, threads | {pages = 2048, programs = 1, threads = 1} | Not named in things_of: the budget of each other program. |
Read from grants_of and things_of in programs/root/main.odin; budget_of in the same file adds the limits of processor time and of log records.
