1<title>Generic Error Codes</title>
2
3<table frame="none" pgwide="1" id="gen-errors">
4  <title>Generic error codes</title>
5  <tgroup cols="2">
6    &cs-str;
7    <tbody valign="top">
8	<!-- Keep it ordered alphabetically -->
9      <row>
10	<entry>EAGAIN (aka EWOULDBLOCK)</entry>
11	<entry>The ioctl can't be handled because the device is in state where
12	       it can't perform it. This could happen for example in case where
13	       device is sleeping and ioctl is performed to query statistics.
14	       It is also returned when the ioctl would need to wait
15	       for an event, but the device was opened in non-blocking mode.
16	</entry>
17      </row>
18      <row>
19	<entry>EBADF</entry>
20	<entry>The file descriptor is not a valid.</entry>
21      </row>
22      <row>
23	<entry>EBUSY</entry>
24	<entry>The ioctl can't be handled because the device is busy. This is
25	       typically return while device is streaming, and an ioctl tried to
26	       change something that would affect the stream, or would require the
27	       usage of a hardware resource that was already allocated. The ioctl
28	       must not be retried without performing another action to fix the
29	       problem first (typically: stop the stream before retrying).</entry>
30      </row>
31      <row>
32	<entry>EFAULT</entry>
33	<entry>There was a failure while copying data from/to userspace,
34	       probably caused by an invalid pointer reference.</entry>
35      </row>
36      <row>
37	<entry>EINVAL</entry>
38	<entry>One or more of the ioctl parameters are invalid or out of the
39	       allowed range. This is a widely used error code. See the individual
40	       ioctl requests for specific causes.</entry>
41      </row>
42      <row>
43        <entry>ENODEV</entry>
44	<entry>Device not found or was removed.</entry>
45      </row>
46      <row>
47	<entry>ENOMEM</entry>
48	<entry>There's not enough memory to handle the desired operation.</entry>
49      </row>
50      <row>
51	<entry>ENOTTY</entry>
52	<entry>The ioctl is not supported by the driver, actually meaning that
53	       the required functionality is not available, or the file
54	       descriptor is not for a media device.</entry>
55      </row>
56      <row>
57	<entry>ENOSPC</entry>
58	<entry>On USB devices, the stream ioctl's can return this error, meaning
59	       that this request would overcommit the usb bandwidth reserved
60	       for periodic transfers (up to 80% of the USB bandwidth).</entry>
61      </row>
62      <row>
63	<entry>EPERM</entry>
64	<entry>Permission denied. Can be returned if the device needs write
65		permission, or some special capabilities is needed
66		(e. g. root)</entry>
67      </row>
68    </tbody>
69  </tgroup>
70</table>
71
72<para>Note 1: ioctls may return other error codes. Since errors may have side
73effects such as a driver reset, applications should abort on unexpected errors.
74</para>
75
76<para>Note 2: Request-specific error codes are listed in the individual
77requests descriptions.</para>
78