1 <refentry id="cec-func-open">
3 <refentrytitle>cec open()</refentrytitle>
8 <refname>cec-open</refname>
9 <refpurpose>Open a cec device</refpurpose>
14 <funcsynopsisinfo>#include <fcntl.h></funcsynopsisinfo>
16 <funcdef>int <function>open</function></funcdef>
17 <paramdef>const char *<parameter>device_name</parameter></paramdef>
18 <paramdef>int <parameter>flags</parameter></paramdef>
24 <title>Arguments</title>
28 <term><parameter>device_name</parameter></term>
30 <para>Device to be opened.</para>
34 <term><parameter>flags</parameter></term>
36 <para>Open flags. Access mode must be <constant>O_RDWR</constant>.
38 <para>When the <constant>O_NONBLOCK</constant> flag is
39 given, the &CEC-RECEIVE; ioctl will return &EAGAIN; when no message is
40 available, and the &CEC-TRANSMIT;, &CEC-ADAP-S-PHYS-ADDR; and
41 &CEC-ADAP-S-LOG-ADDRS; ioctls all act in non-blocking mode.</para>
42 <para>Other flags have no effect.</para>
48 <title>Description</title>
50 Note: this documents the proposed CEC API. This API is not yet finalized and
51 is currently only available as a staging kernel module.
54 <para>To open a cec device applications call <function>open()</function>
55 with the desired device name. The function has no side effects; the device
56 configuration remain unchanged.</para>
57 <para>When the device is opened in read-only mode, attempts to modify its
58 configuration will result in an error, and <varname>errno</varname> will be
59 set to <errorcode>EBADF</errorcode>.</para>
62 <title>Return Value</title>
64 <para><function>open</function> returns the new file descriptor on success.
65 On error, -1 is returned, and <varname>errno</varname> is set appropriately.
66 Possible error codes include:</para>
70 <term><errorcode>EACCES</errorcode></term>
72 <para>The requested access to the file is not allowed.</para>
76 <term><errorcode>EMFILE</errorcode></term>
78 <para>The process already has the maximum number of files open.
83 <term><errorcode>ENFILE</errorcode></term>
85 <para>The system limit on the total number of open files has been
90 <term><errorcode>ENOMEM</errorcode></term>
92 <para>Insufficient kernel memory was available.</para>
96 <term><errorcode>ENXIO</errorcode></term>
98 <para>No device corresponding to this device special file exists.