1 <refentry id=
"media-func-open">
3 <refentrytitle>media open()
</refentrytitle>
8 <refname>media-open
</refname>
9 <refpurpose>Open a media 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 either
<constant>O_RDONLY
</constant>
37 or
<constant>O_RDWR
</constant>. Other flags have no effect.
</para>
43 <title>Description
</title>
44 <para>To open a media device applications call
<function>open()
</function>
45 with the desired device name. The function has no side effects; the device
46 configuration remain unchanged.
</para>
47 <para>When the device is opened in read-only mode, attemps to modify its
48 configuration will result in an error, and
<varname>errno
</varname> will be
49 set to
<errorcode>EBADF
</errorcode>.
</para>
52 <title>Return Value
</title>
54 <para><function>open
</function> returns the new file descriptor on success.
55 On error, -
1 is returned, and
<varname>errno
</varname> is set appropriately.
56 Possible error codes are:
</para>
60 <term><errorcode>EACCES
</errorcode></term>
62 <para>The requested access to the file is not allowed.
</para>
66 <term><errorcode>EMFILE
</errorcode></term>
68 <para>The process already has the maximum number of files open.
73 <term><errorcode>ENFILE
</errorcode></term>
75 <para>The system limit on the total number of open files has been
80 <term><errorcode>ENOMEM
</errorcode></term>
82 <para>Insufficient kernel memory was available.
</para>
86 <term><errorcode>ENXIO
</errorcode></term>
88 <para>No device corresponding to this device special file exists.