]>
Commit | Line | Data |
---|---|---|
ddeb4241 LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
7e2ce386 | 3 | #pragma once |
ddeb4241 LP |
4 | |
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2013 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | ***/ | |
23 | ||
24 | #include <inttypes.h> | |
25 | #include <sys/types.h> | |
26 | #include <stdio.h> | |
7e2ce386 DH |
27 | #include "macro.h" |
28 | #include "util.h" | |
ddeb4241 LP |
29 | |
30 | typedef struct sd_memfd sd_memfd; | |
31 | ||
151b9b96 LP |
32 | int sd_memfd_new(sd_memfd **m, const char *name); |
33 | int sd_memfd_new_from_fd(sd_memfd **m, int fd); | |
34 | int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p); | |
ddeb4241 LP |
35 | |
36 | void sd_memfd_free(sd_memfd *m); | |
37 | ||
7e2ce386 DH |
38 | DEFINE_TRIVIAL_CLEANUP_FUNC(sd_memfd*, sd_memfd_free); |
39 | ||
ddeb4241 | 40 | int sd_memfd_get_fd(sd_memfd *m); |
ddeb4241 | 41 | int sd_memfd_dup_fd(sd_memfd *n); |
7f96b1d8 | 42 | int sd_memfd_get_file(sd_memfd *m, FILE **f); |
ddeb4241 LP |
43 | |
44 | int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p); | |
45 | ||
a6082d77 | 46 | int sd_memfd_set_sealed(sd_memfd *m); |
ddeb4241 LP |
47 | int sd_memfd_get_sealed(sd_memfd *m); |
48 | ||
49 | int sd_memfd_get_size(sd_memfd *m, uint64_t *sz); | |
50 | int sd_memfd_set_size(sd_memfd *m, uint64_t sz); | |
51 | ||
7f96b1d8 | 52 | int sd_memfd_get_name(sd_memfd *m, char **name); |