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