2018-08-30 10:15:26 -04:00
.. Permission is granted to copy, distribute and/or modify this
.. document under the terms of the GNU Free Documentation License,
.. Version 1.1 or any later version published by the Free Software
.. Foundation, with no Invariant Sections, no Front-Cover Texts
.. and no Back-Cover Texts. A copy of the license is included at
2020-03-04 10:21:39 +01:00
.. Documentation/userspace-api/media/fdl-appendix.rst.
2018-08-30 10:15:26 -04:00
..
.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
2016-06-30 15:18:56 +02:00
.. _media-func-open:
***** ***** **
media open()
***** ***** **
2016-07-05 15:14:35 -03:00
Name
2016-07-05 07:58:48 -03:00
====
2016-06-30 15:18:56 +02:00
2016-07-05 07:58:48 -03:00
media-open - Open a media device
2016-06-30 15:18:56 +02:00
2016-07-05 15:14:35 -03:00
Synopsis
2016-06-30 15:18:56 +02:00
========
.. code-block :: c
#include <fcntl.h>
2016-08-19 12:00:43 -03:00
.. c:function :: int open( const char *device_name, int flags )
2016-08-19 16:59:55 -03:00
:name: mc-open
2016-07-05 07:58:48 -03:00
2016-07-05 15:14:35 -03:00
Arguments
2016-06-30 15:18:56 +02:00
=========
`` device_name ``
Device to be opened.
`` flags ``
Open flags. Access mode must be either `` O_RDONLY `` or `` O_RDWR `` .
Other flags have no effect.
2016-07-05 15:14:35 -03:00
Description
2016-06-30 15:18:56 +02:00
===========
2016-07-05 17:12:37 -03:00
To open a media device applications call :ref: `open() <media-func-open>` with the
2016-06-30 15:18:56 +02:00
desired device name. The function has no side effects; the device
configuration remain unchanged.
When the device is opened in read-only mode, attempts to modify its
configuration will result in an error, and `` errno `` will be set to
EBADF.
2016-07-05 15:14:35 -03:00
Return Value
2016-06-30 15:18:56 +02:00
============
2016-07-04 12:56:17 -03:00
:ref: `open() <func-open>` returns the new file descriptor on success. On error,
2016-06-30 15:18:56 +02:00
-1 is returned, and `` errno `` is set appropriately. Possible error codes
are:
EACCES
The requested access to the file is not allowed.
EMFILE
The process already has the maximum number of files open.
ENFILE
The system limit on the total number of open files has been reached.
ENOMEM
Insufficient kernel memory was available.
ENXIO
No device corresponding to this device special file exists.