====== APIs ======
**Stale page** The contents of this page must be revised to reflect the current state of MINIX3.
===== Introduction ===== MINIX 3 is highly modular. The system consists of components, some of which offer services to other components, some of which use services offered by other components, and some of which do both. A component offering services does so through its Application Programming Interface (API), which is a set of parameterized methods that other components can invoke. This invocation is done by having the service user call a library function that constructs a short fixed-length message containing the method number and the parameters which is then sent to the service provider. After the service provider has finished its work, it sends back a reply message. Invocations are normally blocking, but in some cases non-blocking calls are available. To write a component, it is necessary to understand the APIs the component offers and those it uses. The purpose of this document is to provide component writers with links to the various APIs. ===== The Kernel ===== The kernel offers an API that is used by the drivers and servers for obtaining kernel services. Kernel calls fall roughly in the following categories: I/O, copying, time management, ... Not every kernel call may be available to every system component; a bit map in each process table entry tells which kernel calls the process can make. The bit map for a component is created by hand after the driver is finished, based on which calls it needs. In this way, accidental invocations of kernel calls the driver should not be making are caught. The complete set of kernel calls is described in the kernel reference manual, available [[.:kernelapi|here]]. ===== Device Drivers ===== Drivers have three APIs: with the kernel, the file server, and the reincarnation server, respectively. The kernel API allows drivers to obtain kernel services, such as performing I/O and moving data between address spaces. The file server API defines the services drivers provide to the file server, such as reading and writing blocks of data. Finally, the reincarnation server API defines the way the reincarnation checks if drivers are still alive and how drivers must respond to avoid being killed. These three APIs are described in the following documents. ^ API ^ Service provider ^ Service User | | [[.:kernelapi|Kernel calls]] | Kernel | Device drivers | | Driver calls | Driver | File server | | Reincarnation | Driver | Reincarnation server | ===== Servers ===== The servers are called by user programs to obtain POSIX services. In turn, they make kernel calls and calls to drivers to get their work done. Here are the relevant APIs for servers. ^ API ^ Service provider ^ Service User | | [[.:kernelapi|Kernel calls]] | Kernel | Server | | Driver calls | Driver | File server | | Reincarnation | Server | Reincarnation server | | POSIX | Server | User programs |