BREADSYSTEM 1.0.0 INTERFACES
(Rough Draft)
This document describes the system interfaces which may be included with BreadSystem distributions.
INITABLE 1.0.0
The initable interface is used by applications which require initialization after launch. The functions in this interface are invoked automatically by the application system. Access to functions in this interface is restricted by permission to adminProtab. The initable interface is mandatory for all distributions, and is located in :system/ifaces/initable.
initable.init()
Triggered by the application system immediately after the application launches.
ARBITER 1.0.0
The arbiter interface is used by arbiter agents to establish permission logic. The functions in this interface are invoked automatically by the permission system. The arbiter interface is mandatory for all distributions, and is located in :system/ifaces/arbiter.
arbiter.hasImplicitPerm( u8 dest, p vessel, p protab )
Determines whether the given vessel holds implicit permission for the given protab.
arbiter.implicitPerm( p dest, p vessel, p protab )
Retrieves implicit permission for the given protab held by the given vessel. The result will be null if the given vessel does not hold implicit permission for the given protab.
LIFECONTROL 1.0.0
The lifeControl interface is used to throttle memory usage and terminate agents in a minimally-disruptive fashion. The functions in this interface are invoked automatically by the resource system. Access to functions in this interface is restricted by permission to lifeControlProtab. The lifeControl interface is mandatory for all distributions, and is located in :system/ifaces/lifeControl.
lifeControl.throttle()
Requests for the receiving agent to reduce memory usage. The agent should cause memSizeUsed to be below memSizeLeft. If this is not possible, the agent should terminate cleanly.
lifeControl.kill()
Requests for the receiving agent to terminate. The agent should clean up any volatile resources.
TERMDRIVER 1.0.0
The termDriver interface is used to expose a terminal device consisting of a keyboard and alphanumeric display. A terminal driver may be associated with a terminal producer which implements the termProducer interface. The terminal driver notifies the terminal producer when particular events occur, such as keystrokes and display size changes. Access to functions in this interface is restricted by permission to termDriverProtab provided by termArbiter. The termDriver interface is optional for distributions, and is located in :system/ifaces/termDriver.
termDriver.producer( p dest )
Retrieves terminal producer associated with the receiving agent. The result will be null if the receiving agent does not have a corresponding terminal producer.
termDriver.setProducer( p producer )
Modifies terminal producer associated with the receiving agent. If producer is null, then the receiving agent will not have any terminal producer. This function will be invoked by implementations of termProducer.setDriver.
termDriver.size( u32 widthDest, u32 heightDest )
Retrieves the width and height of the terminal display. Each dimenion specifies a number of characters.
termDriver.setCursorPos( u32 x, u32 y )
Modifies the position of the cursor on the terminal display. Each position coordinate specifies a number of characters.
termDriver.setCursorIsVisible( u8 isVisible )
Modifies whether the terminal cursor is visible.
termDriver.setTextIsInverted( u8 isInverted )
Modifies whether to swap foreground and background colors for new characters on the terminal.
termDriver.wrtText( p text )
Adds the given text to the terminal starting at the cursor position. The cursor will move as each character is added.
termDriver.showMainBuffer()
Displays the main terminal buffer. The main buffer stores some extent of scrollback which may be controlled by the user.
termDriver.showAltBuffer()
Displays the alternate terminal buffer. The alternate buffer contents are stored independently from the main buffer. The alternate buffer cannot be scrolled by the user.
TERMPRODUCER 1.0.0
The termProducer interface is used for applications which use a terminal as a means of input and output. A terminal producer may be associated with a terminal driver which implements the termDriver interface. The terminal producer commands the terminal driver to perform actions such as displaying text and switching buffers. Access to functions in this interface is restricted by permission to termProducerProtab provided by termArbiter. The termProducer interface is optional for distributions, and is located in :system/ifaces/termProducer.
termProducer.driver( p dest )
Retrieves terminal driver associated with the receiving agent. The result will be null if the receiving agent does not have a corresponding terminal driver.
termProducer.setDriver( p driver )
Modifies terminal driver associated with the receiving agent. If driver is null, then the receiving agent will not have any terminal driver. An implementation of this function is expected to invoke setProducer on driver when driver is not null.
termProducer.sizeChanged()
Triggered by the terminal driver whenever the display changes size.
termProducer.keyTyped( u32 key, u8 modifiers )
Triggered by the terminal driver whenever the user presses a key.
TERMARBITER 1.0.0
The termArbiter interface is used to generate protabs for the termDriver and termProducer interfaces. The termArbiter interface is optional for distributions, and is located in :system/ifaces/termArbiter. The standard system implementation is located in :system/apps/termArbiter.
termArbiter.termDriverProtab( p dest, p termDriver )
Retrieves the protab to invoke functions of the given terminal driver. Every terminal driver holds implicit permission for this protab on itself.
termArbiter.termProducerProtab( p dest, p termProducer )
Retrieves the protab to invoke functions of the given terminal producer. Every terminal producer holds implicit permission for this protab on itself.
VOLDRIVER 1.0.0
The volDriver interface is used to expose a storage device as a volume. The functions in this interface are invoked automatically by the file system. Access to functions in this interface is restricted by permission to adminProtab. The volDriver interface is mandatory for all distributions, and is located in :system/ifaces/volDriver.
volDriver.size( u64 dest )
Retrieves the storage capacity of the volume. The size is measured in number of bytes.
volDriver.pageSize( u32 dest )
Retrieves the page size of the volume. The size is measured in number of bytes. Modifying a page requires erasing the entire page, then writing the new contents.
volDriver.read( p dest, u64 offset, u64 size )
Reads a sequence of bytes from the volume.
volDriver.wrt( u64 offset, p buff )
Writes a sequence of bytes to the volume.
volDriver.flush( u64 offset )
Persists the given volume page to storage.
VOLCLIENT 1.0.0
The volClient interface is used by applications which wish to be notified of significant volume events, such as when a volume is being ejected. The functions in this interface are invoked automatically by the file system. Access to functions in this interface is restricted by permission to adminProtab. The volDriver interface is mandatory for all distributions, and is located in :system/ifaces/volClient.
volClient.volEjected( p vol )
Triggered by the file system when the given volume is being ejected.