libcamera  v0.3.1+12-19bbca3c
Supporting cameras in Linux since 2019
memfd.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*
3  * Copyright (C) 2024, Ideas on Board Oy
4  *
5  * Anonymous file creation
6  */
7 
8 #pragma once
9 
10 #include <stddef.h>
11 
12 #include <libcamera/base/flags.h>
14 
15 namespace libcamera {
16 
17 class MemFd
18 {
19 public:
20  enum class Seal {
21  None = 0,
22  Shrink = (1 << 0),
23  Grow = (1 << 1),
24  };
25 
26  using Seals = Flags<Seal>;
27 
28  static UniqueFD create(const char *name, std::size_t size,
29  Seals seals = Seal::None);
30 };
31 
33 
34 } /* namespace libcamera */
Seal
Seals for the MemFd::create() function.
Definition: memfd.h:20
File descriptor wrapper that owns a file descriptor.
Top-level libcamera namespace.
Definition: backtrace.h:17
static UniqueFD create(const char *name, std::size_t size, Seals seals=Seal::None)
Create an anonymous file.
Definition: memfd.cpp:84
unique_ptr-like wrapper for a file descriptor
Definition: unique_fd.h:17
#define LIBCAMERA_FLAGS_ENABLE_OPERATORS(_enum)
Enable bitwise operations on the enum enumeration.
Enum-based bit fields.
Type-safe container for enum-based bitfields.
Definition: flags.h:15
Helper class to create anonymous files.
Definition: memfd.h:17