chiark / gitweb /
rtnl: simplify link_new()
[elogind.git] / src / systemd / sd-memfd.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #ifndef foosdmemfdhfoo
4 #define foosdmemfdhfoo
5
6 /***
7   This file is part of systemd.
8
9   Copyright 2013 Lennart Poettering
10
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.
15
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.
20
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/>.
23 ***/
24
25 #include <inttypes.h>
26 #include <sys/types.h>
27 #include <stdio.h>
28
29 #include "_sd-common.h"
30
31 _SD_BEGIN_DECLARATIONS;
32
33 typedef struct sd_memfd sd_memfd;
34
35 int sd_memfd_new(sd_memfd **m);
36 int sd_memfd_make(int fd, sd_memfd **m);
37
38 int sd_memfd_new_and_map(sd_memfd **m, size_t sz, void **p);
39
40 void sd_memfd_free(sd_memfd *m);
41
42 int sd_memfd_get_fd(sd_memfd *m);
43 int sd_memfd_get_file(sd_memfd *m, FILE **f);
44 int sd_memfd_dup_fd(sd_memfd *n);
45
46 int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p);
47
48 int sd_memfd_set_sealed(sd_memfd *m, int b);
49 int sd_memfd_get_sealed(sd_memfd *m);
50
51 int sd_memfd_get_size(sd_memfd *m, uint64_t *sz);
52 int sd_memfd_set_size(sd_memfd *m, uint64_t sz);
53
54 _SD_END_DECLARATIONS;
55
56 #endif