]>
Commit | Line | Data |
---|---|---|
16e9f408 LP |
1 | #pragma once |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2012 Lennart Poettering | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
f8019684 LP |
22 | #include <stdbool.h> |
23 | #include <sys/stat.h> | |
16e9f408 | 24 | |
fa6ac760 LP |
25 | /* One context per object type, plus one of the header, plus one "additional" one */ |
26 | #define MMAP_CACHE_MAX_CONTEXTS 9 | |
69adae51 | 27 | |
16e9f408 | 28 | typedef struct MMapCache MMapCache; |
be7cdd8e | 29 | typedef struct MMapFileDescriptor MMapFileDescriptor; |
16e9f408 | 30 | |
84168d80 | 31 | MMapCache* mmap_cache_new(void); |
16e9f408 LP |
32 | MMapCache* mmap_cache_ref(MMapCache *m); |
33 | MMapCache* mmap_cache_unref(MMapCache *m); | |
34 | ||
ae97089d ZJS |
35 | int mmap_cache_get( |
36 | MMapCache *m, | |
be7cdd8e | 37 | MMapFileDescriptor *f, |
ae97089d ZJS |
38 | int prot, |
39 | unsigned context, | |
40 | bool keep_always, | |
41 | uint64_t offset, | |
42 | size_t size, | |
43 | struct stat *st, | |
b42549ad VC |
44 | void **ret, |
45 | size_t *ret_size); | |
be7cdd8e VC |
46 | MMapFileDescriptor * mmap_cache_add_fd(MMapCache *m, int fd); |
47 | void mmap_cache_free_fd(MMapCache *m, MMapFileDescriptor *f); | |
bf807d4d LP |
48 | |
49 | unsigned mmap_cache_get_hit(MMapCache *m); | |
50 | unsigned mmap_cache_get_missed(MMapCache *m); | |
fa6ac760 | 51 | |
be7cdd8e | 52 | bool mmap_cache_got_sigbus(MMapCache *m, MMapFileDescriptor *f); |