zephyr/doc/contribute/error_code_conventions.rst
Anas Nashif d57af675d1 doc: merge coding conventions into one document
Change-Id: I85d11d9ba2f2029833caa0a0190eac013a219f92
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-15 22:07:09 +00:00

37 lines
2.0 KiB
ReStructuredText

.. _error_code_conventions:
Return Codes
************
Zephyr uses the standard codes in :file:`errno.h` for all APIs.
As a general rule, ``0`` indicates success; a negative errno.h code indicates
an error condition. The table below shows the error code conventions based on
device driver use cases, but they can also be applied to other kernel
components.
+-----------------+------------------------------------------------+
| Code | Meaning |
+=================+================================================+
| 0 | Success. |
+-----------------+------------------------------------------------+
| -EIO | General failure. |
+-----------------+------------------------------------------------+
| -ENOTSUP | Operation is not supported or operation is |
| | invalid. |
+-----------------+------------------------------------------------+
| -EINVAL | Device configuration is not valid or function |
| | argument is not valid. |
+-----------------+------------------------------------------------+
| -EBUSY | Device controller is busy. |
+-----------------+------------------------------------------------+
| -EACCES | Device controller is not accessible. |
+-----------------+------------------------------------------------+
| -ENODEV | Device type is not supported. |
+-----------------+------------------------------------------------+
| -EPERM | Device is not configured or operation is not |
| | permitted. |
+-----------------+------------------------------------------------+
| -ENOSYS | Function is not implemented. |
+-----------------+------------------------------------------------+