]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/memfd-util.h
befe41ac436e642c8c50c3386abd7b9134436c08
[thirdparty/systemd.git] / src / basic / memfd-util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <sys/mman.h> /* IWYU pragma: export */
5
6 #include "forward.h"
7
8 int memfd_create_wrapper(const char *name, unsigned mode);
9
10 int memfd_new_full(const char *name, unsigned extra_flags);
11 static inline int memfd_new(const char *name) {
12 return memfd_new_full(name, 0);
13 }
14
15 int memfd_new_and_seal(const char *name, const void *data, size_t sz) _nonnull_if_nonzero_(2, 3);
16 static inline int memfd_new_and_seal_string(const char *name, const char *s) {
17 return memfd_new_and_seal(name, s, SIZE_MAX);
18 }
19
20 int memfd_set_sealed(int fd);
21 int memfd_get_sealed(int fd);
22
23 int memfd_get_size(int fd, uint64_t *ret);
24 int memfd_set_size(int fd, uint64_t sz);