| 1 | = Services and Devices = |
| 2 | == About services == |
| 3 | |
| 4 | As a multi-server system, the bulk of functionality in HelenOS is provided by a set of ''servers'' (tasks, a.k.a. processes) in terms of ''services''. A service is an IPC endpoint that client tasks can talk to using the correct IPC protocol. To make it possible for tasks to locate a service, the respective server needs to register it with a ''name service''. |
| 5 | |
| 6 | The prominent, generic name service in the system is the ''Location Service''. |
| 7 | |
| 8 | == Location Service == |
| 9 | |
| 10 | The ''Location Service'' is a registry where any server can sign up services identified by unique names in the form {{{<group>/<name>}}}. (Internally a unique numerical ID is assigned to each service, but this is hidden from the user.) |
| 11 | |
| 12 | A service can be added to one or more ''categories''. (The list of categories is defined statically at present.) Categories are used to group services sharing some commonality, such as the type of service provided. For example, there is a category for all services providing a network link. |
| 13 | |
| 14 | {{{locfs}}} is a special file system that maps the Location Service namespace to the filesystem namespace. We can make use of that to list all services registered in the Location Service. The {{{locfs}}} filesystem is mounted on {{{/loc}}}: |
| 15 | |
| 16 | {{{ |
| 17 | # ls /loc/* |
| 18 | }}} |
| 19 | |
| 20 | To see which categories are defined and which services are present in which categories we can use the administrative command |
| 21 | |
| 22 | {{{ |
| 23 | # loc |
| 24 | }}} |
| 25 | |
| 26 | or |
| 27 | |
| 28 | {{{ |
| 29 | # loc show-cat <category> |
| 30 | }}} |
| 31 | |
| 32 | to list just the contents of a single category. |
| 33 | |
| 34 | == Devices == |
| 35 | |
| 36 | Peripheral devices connected to buses such as PCI or USB are enumerated in cooperation of special servers acting as device drivers (called DDF-compliant device drivers), and the Device Manager. Device drivers provide device-specific knowledge and the Device Manager orchestrates the enumeration process. The enumeration process is dynamic as devices can be added to or removed from the system at any time. |
| 37 | |
| 38 | The devices are organized in a device tree. Each device has a unique path corresponding to the system topology such as {{{/hw/pci@0/...}}}. To see the list of all devices in the system we can use the {{{devctl}}} command: |
| 39 | |
| 40 | {{{ |
| 41 | # devctl |
| 42 | }}} |
| 43 | |
| 44 | The drivers present functionality to the rest of the system again in terms of services. The name of the services is {{{devices/<mangled-device-name>}}}. The mangled device name is the device name where slashes ({{{/}}}) are replaced with backslashes ({{{\}}}). This is due to a current limitation in the Location Service which can only support one level of grouping. |
| 45 | |
| 46 | Since device drivers export services and services are visible under {{{/loc}}} via locfs, we can list all the device-services in the system as |
| 47 | |
| 48 | {{{ |
| 49 | # ls /loc/devices |
| 50 | }}} |