doc-rst: linux_tv DocBook to reST migration (docs-next)
[deliverable/linux.git] / Documentation / linux_tv / media / v4l / media-func-open.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _media-func-open:
4
5 ************
6 media open()
7 ************
8
9 *man media-open(2)*
10
11 Open a media device
12
13
14 Synopsis
15 ========
16
17 .. code-block:: c
18
19 #include <fcntl.h>
20
21
22 .. c:function:: int open( const char *device_name, int flags )
23
24 Arguments
25 =========
26
27 ``device_name``
28 Device to be opened.
29
30 ``flags``
31 Open flags. Access mode must be either ``O_RDONLY`` or ``O_RDWR``.
32 Other flags have no effect.
33
34
35 Description
36 ===========
37
38 To open a media device applications call :c:func:`open()` with the
39 desired device name. The function has no side effects; the device
40 configuration remain unchanged.
41
42 When the device is opened in read-only mode, attempts to modify its
43 configuration will result in an error, and ``errno`` will be set to
44 EBADF.
45
46
47 Return Value
48 ============
49
50 :c:func:`open()` returns the new file descriptor on success. On error,
51 -1 is returned, and ``errno`` is set appropriately. Possible error codes
52 are:
53
54 EACCES
55 The requested access to the file is not allowed.
56
57 EMFILE
58 The process already has the maximum number of files open.
59
60 ENFILE
61 The system limit on the total number of open files has been reached.
62
63 ENOMEM
64 Insufficient kernel memory was available.
65
66 ENXIO
67 No device corresponding to this device special file exists.
68
69
70 .. ------------------------------------------------------------------------------
71 .. This file was automatically converted from DocBook-XML with the dbxml
72 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
73 .. from the linux kernel, refer to:
74 ..
75 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
76 .. ------------------------------------------------------------------------------
This page took 0.032323 seconds and 5 git commands to generate.