Merge remote-tracking branch 'block/for-next'
[deliverable/linux.git] / Documentation / media / uapi / mediactl / media-func-open.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
3.. _media-func-open:
4
5************
6media open()
7************
8
15e7d615 9Name
586027ce 10====
5377d91f 11
586027ce 12media-open - Open a media device
5377d91f 13
15e7d615
MCC
14
15Synopsis
5377d91f
MH
16========
17
18.. code-block:: c
19
20 #include <fcntl.h>
21
22
1b81f010 23.. c:function:: int open( const char *device_name, int flags )
5ccbb182 24 :name: mc-open
586027ce 25
15e7d615 26Arguments
5377d91f
MH
27=========
28
29``device_name``
30 Device to be opened.
31
32``flags``
33 Open flags. Access mode must be either ``O_RDONLY`` or ``O_RDWR``.
34 Other flags have no effect.
35
36
15e7d615 37Description
5377d91f
MH
38===========
39
8c1cc62a 40To open a media device applications call :ref:`open() <media-func-open>` with the
5377d91f
MH
41desired device name. The function has no side effects; the device
42configuration remain unchanged.
43
44When the device is opened in read-only mode, attempts to modify its
45configuration will result in an error, and ``errno`` will be set to
46EBADF.
47
48
15e7d615 49Return Value
5377d91f
MH
50============
51
760c7010 52:ref:`open() <func-open>` returns the new file descriptor on success. On error,
5377d91f
MH
53-1 is returned, and ``errno`` is set appropriately. Possible error codes
54are:
55
56EACCES
57 The requested access to the file is not allowed.
58
59EMFILE
60 The process already has the maximum number of files open.
61
62ENFILE
63 The system limit on the total number of open files has been reached.
64
65ENOMEM
66 Insufficient kernel memory was available.
67
68ENXIO
69 No device corresponding to this device special file exists.
This page took 0.04965 seconds and 5 git commands to generate.