About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / DocBook / v4l / media-func-ioctl.xml


Based on kernel version 3.0.4. Page generated on 2011-10-03 22:07 EST.

1	<refentry id="media-func-ioctl">
2	  <refmeta>
3	    <refentrytitle>media ioctl()</refentrytitle>
4	    &manvol;
5	  </refmeta>
6	
7	  <refnamediv>
8	    <refname>media-ioctl</refname>
9	    <refpurpose>Control a media device</refpurpose>
10	  </refnamediv>
11	
12	  <refsynopsisdiv>
13	    <funcsynopsis>
14	      <funcsynopsisinfo>#include &lt;sys/ioctl.h&gt;</funcsynopsisinfo>
15	      <funcprototype>
16		<funcdef>int <function>ioctl</function></funcdef>
17		<paramdef>int <parameter>fd</parameter></paramdef>
18		<paramdef>int <parameter>request</parameter></paramdef>
19		<paramdef>void *<parameter>argp</parameter></paramdef>
20	      </funcprototype>
21	    </funcsynopsis>
22	  </refsynopsisdiv>
23	
24	  <refsect1>
25	    <title>Arguments</title>
26	
27	    <variablelist>
28	      <varlistentry>
29		<term><parameter>fd</parameter></term>
30		<listitem>
31		  <para>&fd;</para>
32		</listitem>
33	      </varlistentry>
34	      <varlistentry>
35		<term><parameter>request</parameter></term>
36		<listitem>
37		  <para>Media ioctl request code as defined in the media.h header file,
38		  for example MEDIA_IOC_SETUP_LINK.</para>
39		</listitem>
40	      </varlistentry>
41	      <varlistentry>
42		<term><parameter>argp</parameter></term>
43		<listitem>
44		  <para>Pointer to a request-specific structure.</para>
45		</listitem>
46	      </varlistentry>
47	    </variablelist>
48	  </refsect1>
49	
50	  <refsect1>
51	    <title>Description</title>
52	    <para>The <function>ioctl()</function> function manipulates media device
53	    parameters. The argument <parameter>fd</parameter> must be an open file
54	    descriptor.</para>
55	    <para>The ioctl <parameter>request</parameter> code specifies the media
56	    function to be called. It has encoded in it whether the argument is an
57	    input, output or read/write parameter, and the size of the argument
58	    <parameter>argp</parameter> in bytes.</para>
59	    <para>Macros and structures definitions specifying media ioctl requests and
60	    their parameters are located in the media.h header file. All media ioctl
61	    requests, their respective function and parameters are specified in
62	    <xref linkend="media-user-func" />.</para>
63	  </refsect1>
64	
65	  <refsect1>
66	    <title>Return Value</title>
67	
68	    <para><function>ioctl()</function> returns <returnvalue>0</returnvalue> on
69	    success. On failure, <returnvalue>-1</returnvalue> is returned, and the
70	    <varname>errno</varname> variable is set appropriately. Generic error codes
71	    are listed below, and request-specific error codes are listed in the
72	    individual requests descriptions.</para>
73	    <para>When an ioctl that takes an output or read/write parameter fails,
74	    the parameter remains unmodified.</para>
75	
76	    <variablelist>
77	      <varlistentry>
78		<term><errorcode>EBADF</errorcode></term>
79		<listitem>
80		  <para><parameter>fd</parameter> is not a valid open file descriptor.
81		  </para>
82		</listitem>
83	      </varlistentry>
84	      <varlistentry>
85		<term><errorcode>EFAULT</errorcode></term>
86		<listitem>
87		  <para><parameter>argp</parameter> references an inaccessible memory
88		  area.</para>
89		</listitem>
90	      </varlistentry>
91	      <varlistentry>
92		<term><errorcode>EINVAL</errorcode></term>
93		<listitem>
94		  <para>The <parameter>request</parameter> or the data pointed to by
95		  <parameter>argp</parameter> is not valid. This is a very common error
96		  code, see the individual ioctl requests listed in
97		  <xref linkend="media-user-func" /> for actual causes.</para>
98		</listitem>
99	      </varlistentry>
100	      <varlistentry>
101		<term><errorcode>ENOMEM</errorcode></term>
102		<listitem>
103		  <para>Insufficient kernel memory was available to complete the
104		  request.</para>
105		</listitem>
106	      </varlistentry>
107	      <varlistentry>
108		<term><errorcode>ENOTTY</errorcode></term>
109		<listitem>
110		  <para><parameter>fd</parameter> is  not  associated  with  a character
111		  special device.</para>
112		</listitem>
113	      </varlistentry>
114	    </variablelist>
115	  </refsect1>
116	</refentry>
Hide Line Numbers


About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog