Merge tag 'docs-4.11-fixes' of git://git.lwn.net/linux
[sfrench/cifs-2.6.git] / Documentation / media / uapi / gen-errors.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _gen_errors:
4
5 *******************
6 Generic Error Codes
7 *******************
8
9
10 .. _gen-errors:
11
12 .. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
13
14 .. flat-table:: Generic error codes
15     :header-rows:  0
16     :stub-columns: 0
17     :widths: 1 16
18
19
20     -  .. row 1
21
22        -  ``EAGAIN`` (aka ``EWOULDBLOCK``)
23
24        -  The ioctl can't be handled because the device is in state where it
25           can't perform it. This could happen for example in case where
26           device is sleeping and ioctl is performed to query statistics. It
27           is also returned when the ioctl would need to wait for an event,
28           but the device was opened in non-blocking mode.
29
30     -  .. row 2
31
32        -  ``EBADF``
33
34        -  The file descriptor is not a valid.
35
36     -  .. row 3
37
38        -  ``EBUSY``
39
40        -  The ioctl can't be handled because the device is busy. This is
41           typically return while device is streaming, and an ioctl tried to
42           change something that would affect the stream, or would require
43           the usage of a hardware resource that was already allocated. The
44           ioctl must not be retried without performing another action to fix
45           the problem first (typically: stop the stream before retrying).
46
47     -  .. row 4
48
49        -  ``EFAULT``
50
51        -  There was a failure while copying data from/to userspace, probably
52           caused by an invalid pointer reference.
53
54     -  .. row 5
55
56        -  ``EINVAL``
57
58        -  One or more of the ioctl parameters are invalid or out of the
59           allowed range. This is a widely used error code. See the
60           individual ioctl requests for specific causes.
61
62     -  .. row 6
63
64        -  ``ENODEV``
65
66        -  Device not found or was removed.
67
68     -  .. row 7
69
70        -  ``ENOMEM``
71
72        -  There's not enough memory to handle the desired operation.
73
74     -  .. row 8
75
76        -  ``ENOTTY``
77
78        -  The ioctl is not supported by the driver, actually meaning that
79           the required functionality is not available, or the file
80           descriptor is not for a media device.
81
82     -  .. row 9
83
84        -  ``ENOSPC``
85
86        -  On USB devices, the stream ioctl's can return this error, meaning
87           that this request would overcommit the usb bandwidth reserved for
88           periodic transfers (up to 80% of the USB bandwidth).
89
90     -  .. row 10
91
92        -  ``EPERM``
93
94        -  Permission denied. Can be returned if the device needs write
95           permission, or some special capabilities is needed (e. g. root)
96
97     -  .. row 11
98
99        -  ``EIO``
100
101        -  I/O error. Typically used when there are problems communicating with
102           a hardware device. This could indicate broken or flaky hardware.
103           It's a 'Something is wrong, I give up!' type of error.
104
105 .. note::
106
107   #. This list is not exhaustive; ioctls may return other error codes.
108      Since errors may have side effects such as a driver reset,
109      applications should abort on unexpected errors, or otherwise
110      assume that the device is in a bad state.
111
112   #. Request-specific error codes are listed in the individual
113      requests descriptions.