]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal/mmap-cache.h
tree-wide: make use of new relative time events in sd-event.h
[thirdparty/systemd.git] / src / journal / mmap-cache.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
16e9f408
LP
2#pragma once
3
f8019684
LP
4#include <stdbool.h>
5#include <sys/stat.h>
16e9f408 6
fa6ac760
LP
7/* One context per object type, plus one of the header, plus one "additional" one */
8#define MMAP_CACHE_MAX_CONTEXTS 9
69adae51 9
16e9f408 10typedef struct MMapCache MMapCache;
be7cdd8e 11typedef struct MMapFileDescriptor MMapFileDescriptor;
16e9f408 12
84168d80 13MMapCache* mmap_cache_new(void);
16e9f408
LP
14MMapCache* mmap_cache_ref(MMapCache *m);
15MMapCache* mmap_cache_unref(MMapCache *m);
16
ae97089d
ZJS
17int mmap_cache_get(
18 MMapCache *m,
be7cdd8e 19 MMapFileDescriptor *f,
ae97089d
ZJS
20 int prot,
21 unsigned context,
22 bool keep_always,
23 uint64_t offset,
24 size_t size,
25 struct stat *st,
b42549ad
VC
26 void **ret,
27 size_t *ret_size);
be7cdd8e
VC
28MMapFileDescriptor * mmap_cache_add_fd(MMapCache *m, int fd);
29void mmap_cache_free_fd(MMapCache *m, MMapFileDescriptor *f);
bf807d4d
LP
30
31unsigned mmap_cache_get_hit(MMapCache *m);
32unsigned mmap_cache_get_missed(MMapCache *m);
fa6ac760 33
be7cdd8e 34bool mmap_cache_got_sigbus(MMapCache *m, MMapFileDescriptor *f);