doc-rst: linux_tv: Replace reference names to match ioctls
[deliverable/linux.git] / Documentation / linux_tv / media / v4l / func-open.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
3.. _func-open:
4
5***********
6V4L2 open()
7***********
8
9*man v4l2-open(2)*
10
11Open a V4L2 device
12
13
14Synopsis
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
24Arguments
25=========
26
27``device_name``
28 Device to be opened.
29
30``flags``
31 Open flags. Access mode must be ``O_RDWR``. This is just a
32 technicality, input devices still support only reading and output
33 devices only writing.
34
35 When the ``O_NONBLOCK`` flag is given, the read() function and the
af4a4d0d 36 :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl will return the EAGAIN
5377d91f
MH
37 error code when no data is available or no buffer is in the driver
38 outgoing queue, otherwise these functions block until data becomes
39 available. All V4L2 drivers exchanging data with applications must
40 support the ``O_NONBLOCK`` flag.
41
42 Other flags have no effect.
43
44
45Description
46===========
47
48To open a V4L2 device applications call :c:func:`open()` with the
49desired device name. This function has no side effects; all data format
50parameters, current input or output, control values or other properties
51remain unchanged. At the first :c:func:`open()` call after loading the
52driver they will be reset to default values, drivers are never in an
53undefined state.
54
55
56Return Value
57============
58
59On success :c:func:`open()` returns the new file descriptor. On error
60-1 is returned, and the ``errno`` variable is set appropriately.
61Possible error codes are:
62
63EACCES
64 The caller has no permission to access the device.
65
66EBUSY
67 The driver does not support multiple opens and the device is already
68 in use.
69
70ENXIO
71 No device corresponding to this device special file exists.
72
73ENOMEM
74 Not enough kernel memory was available to complete the request.
75
76EMFILE
77 The process already has the maximum number of files open.
78
79ENFILE
80 The limit on the total number of files open on the system has been
81 reached.
82
83
84.. ------------------------------------------------------------------------------
85.. This file was automatically converted from DocBook-XML with the dbxml
86.. library (https://github.com/return42/sphkerneldoc). The origin XML comes
87.. from the linux kernel, refer to:
88..
89.. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
90.. ------------------------------------------------------------------------------
This page took 0.036796 seconds and 5 git commands to generate.