1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _func-munmap:
4
5*************
6V4L2 munmap()
7*************
8
9Name
10====
11
12v4l2-munmap - Unmap device memory
13
14
15Synopsis
16========
17
18.. code-block:: c
19
20    #include <unistd.h>
21    #include <sys/mman.h>
22
23
24.. c:function:: int munmap( void *start, size_t length )
25    :name: v4l2-munmap
26
27Arguments
28=========
29
30``start``
31    Address of the mapped buffer as returned by the
32    :ref:`mmap() <func-mmap>` function.
33
34``length``
35    Length of the mapped buffer. This must be the same value as given to
36    :ref:`mmap() <func-mmap>` and returned by the driver in the struct
37    :c:type:`v4l2_buffer` ``length`` field for the
38    single-planar API and in the struct
39    :c:type:`v4l2_plane` ``length`` field for the
40    multi-planar API.
41
42
43Description
44===========
45
46Unmaps a previously with the :ref:`mmap() <func-mmap>` function mapped
47buffer and frees it, if possible.
48
49
50Return Value
51============
52
53On success :ref:`munmap() <func-munmap>` returns 0, on failure -1 and the
54``errno`` variable is set appropriately:
55
56EINVAL
57    The ``start`` or ``length`` is incorrect, or no buffers have been
58    mapped yet.
59