18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _gen_errors:
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci*******************
68c2ecf20Sopenharmony_ciGeneric Error Codes
78c2ecf20Sopenharmony_ci*******************
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci.. _gen-errors:
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci.. flat-table:: Generic error codes
158c2ecf20Sopenharmony_ci    :header-rows:  0
168c2ecf20Sopenharmony_ci    :stub-columns: 0
178c2ecf20Sopenharmony_ci    :widths: 1 16
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci    -  -  ``EAGAIN`` (aka ``EWOULDBLOCK``)
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci       -  The ioctl can't be handled because the device is in state where it
238c2ecf20Sopenharmony_ci	  can't perform it. This could happen for example in case where
248c2ecf20Sopenharmony_ci	  device is sleeping and ioctl is performed to query statistics. It
258c2ecf20Sopenharmony_ci	  is also returned when the ioctl would need to wait for an event,
268c2ecf20Sopenharmony_ci	  but the device was opened in non-blocking mode.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci    -  -  ``EBADF``
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci       -  The file descriptor is not a valid.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci    -  -  ``EBUSY``
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci       -  The ioctl can't be handled because the device is busy. This is
358c2ecf20Sopenharmony_ci	  typically return while device is streaming, and an ioctl tried to
368c2ecf20Sopenharmony_ci	  change something that would affect the stream, or would require
378c2ecf20Sopenharmony_ci	  the usage of a hardware resource that was already allocated. The
388c2ecf20Sopenharmony_ci	  ioctl must not be retried without performing another action to fix
398c2ecf20Sopenharmony_ci	  the problem first (typically: stop the stream before retrying).
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci    -  -  ``EFAULT``
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci       -  There was a failure while copying data from/to userspace, probably
448c2ecf20Sopenharmony_ci	  caused by an invalid pointer reference.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci    -  -  ``EINVAL``
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci       -  One or more of the ioctl parameters are invalid or out of the
498c2ecf20Sopenharmony_ci	  allowed range. This is a widely used error code. See the
508c2ecf20Sopenharmony_ci	  individual ioctl requests for specific causes.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci    -  -  ``ENODEV``
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci       -  Device not found or was removed.
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci    -  -  ``ENOMEM``
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci       -  There's not enough memory to handle the desired operation.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci    -  -  ``ENOTTY``
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci       -  The ioctl is not supported by the driver, actually meaning that
638c2ecf20Sopenharmony_ci	  the required functionality is not available, or the file
648c2ecf20Sopenharmony_ci	  descriptor is not for a media device.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci    -  -  ``ENOSPC``
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci       -  On USB devices, the stream ioctl's can return this error, meaning
698c2ecf20Sopenharmony_ci	  that this request would overcommit the usb bandwidth reserved for
708c2ecf20Sopenharmony_ci	  periodic transfers (up to 80% of the USB bandwidth).
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci    -  -  ``EPERM``
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci       -  Permission denied. Can be returned if the device needs write
758c2ecf20Sopenharmony_ci	  permission, or some special capabilities is needed (e. g. root)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci    -  -  ``EIO``
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci       -  I/O error. Typically used when there are problems communicating with
808c2ecf20Sopenharmony_ci          a hardware device. This could indicate broken or flaky hardware.
818c2ecf20Sopenharmony_ci	  It's a 'Something is wrong, I give up!' type of error.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci    -  - ``ENXIO``
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci       -  No device corresponding to this device special file exists.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci.. note::
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci  #. This list is not exhaustive; ioctls may return other error codes.
918c2ecf20Sopenharmony_ci     Since errors may have side effects such as a driver reset,
928c2ecf20Sopenharmony_ci     applications should abort on unexpected errors, or otherwise
938c2ecf20Sopenharmony_ci     assume that the device is in a bad state.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci  #. Request-specific error codes are listed in the individual
968c2ecf20Sopenharmony_ci     requests descriptions.
97