Support APIs
The Genode API includes "utility" classes, described below. For those coming from a Haiku background, some sidebars are provided to facilitate the creation of a mental "map".
App backbone
RPC/IPC
(from release-notes 13.11): In Genode, inter-process communication can be implemented synchronously via RPC calls or asynchronously via signals. Most services use a combination of both mechanisms. For example, a block driver provides an RPC interface for querying the size of the block device. However, the actual transactions are communicated via shared memory and asynchronous notifications to maximize throughput. For this reason, most servers need to handle both, incoming RPCs and signals.
Haiku side-bar: an "RPC entrypoint" thread could be somewhat thought of as the equivalent of a BLooper thread, RPC calls as synchronous BMessage sending, and signals as a-synchronous BMessage sending.
Support staples
Time of day / wall clock
Genode provides time-of-day with the RTC service, which may be configured like thus:
- build the component:
make driver/rtc
- edit your run file to copy the rtc_drv component
- edit the init config to launch the component:
<start name="rtc_drv"> <resource name="RAM" quantum="1M"/> <provides> <service name="Rtc"/> </provides> </start>
- configure your app to access Rtc from e.g. libc:
<config> <libc rtc="/dev/rtc" /> <vfs> <dir name="dev"> <rtc/> </dir> </vfs> </config>
String
#include <util/string.h>
Not a full featured string class, but very efficient (and does not allocate on the heap) for safe storage of bounded-size strings.