]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal/mmap-cache.h
journald: process SIGBUS for the memory maps we set up
[thirdparty/systemd.git] / src / journal / mmap-cache.h
CommitLineData
16e9f408
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright 2012 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>
f8019684
LP
25#include <stdbool.h>
26#include <sys/stat.h>
16e9f408 27
fa6ac760
LP
28/* One context per object type, plus one of the header, plus one "additional" one */
29#define MMAP_CACHE_MAX_CONTEXTS 9
69adae51 30
16e9f408
LP
31typedef struct MMapCache MMapCache;
32
84168d80 33MMapCache* mmap_cache_new(void);
16e9f408
LP
34MMapCache* mmap_cache_ref(MMapCache *m);
35MMapCache* mmap_cache_unref(MMapCache *m);
36
ae97089d
ZJS
37int mmap_cache_get(
38 MMapCache *m,
39 int fd,
40 int prot,
41 unsigned context,
42 bool keep_always,
43 uint64_t offset,
44 size_t size,
45 struct stat *st,
1b8951e5 46 void **ret);
16e9f408 47void mmap_cache_close_fd(MMapCache *m, int fd);
bf807d4d
LP
48
49unsigned mmap_cache_get_hit(MMapCache *m);
50unsigned mmap_cache_get_missed(MMapCache *m);
fa6ac760
LP
51
52bool mmap_cache_got_sigbus(MMapCache *m, int fd);