1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
7 This file is part of systemd.
9 Copyright 2013 Lennart Poettering
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 #include <sys/types.h>
29 #include "_sd-common.h"
31 _SD_BEGIN_DECLARATIONS;
33 typedef struct sd_memfd sd_memfd;
35 int sd_memfd_new(sd_memfd **m, const char *name);
36 int sd_memfd_new_from_fd(sd_memfd **m, int fd);
37 int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p);
39 void sd_memfd_free(sd_memfd *m);
41 int sd_memfd_get_fd(sd_memfd *m);
42 int sd_memfd_dup_fd(sd_memfd *n);
43 int sd_memfd_get_file(sd_memfd *m, FILE **f);
45 int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p);
47 int sd_memfd_set_sealed(sd_memfd *m, int b);
48 int sd_memfd_get_sealed(sd_memfd *m);
50 int sd_memfd_get_size(sd_memfd *m, uint64_t *sz);
51 int sd_memfd_set_size(sd_memfd *m, uint64_t sz);
53 int sd_memfd_get_name(sd_memfd *m, char **name);