]> code.delx.au - pulseaudio/blob - src/pulsecore/memtrap.h
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / memtrap.h
1 #ifndef foopulsecorememtraphfoo
2 #define foopulsecorememtraphfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2009 Lennart Poettering
8
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
13
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <sys/types.h>
26
27 #include <pulsecore/macro.h>
28
29 /* This subsystem will trap SIGBUS on specific memory regions. The
30 * regions will be remapped to anonymous memory (i.e. writable NUL
31 * bytes) on SIGBUS, so that execution of the main program can
32 * continue though with memory having changed beneath its hands. With
33 * pa_memtrap_is_good() it is possible to query if a memory region is
34 * still 'good' i.e. no SIGBUS has happened yet for it.
35 *
36 * Intended usage is to handle memory mapped in which is controlled by
37 * other processes that might execute ftruncate() or when mapping inb
38 * hardware resources that might get invalidated when unplugged. */
39
40 typedef struct pa_memtrap pa_memtrap;
41
42 pa_memtrap* pa_memtrap_add(const void *start, size_t size);
43 pa_memtrap *pa_memtrap_update(pa_memtrap *m, const void *start, size_t size);
44
45 void pa_memtrap_remove(pa_memtrap *m);
46
47 bool pa_memtrap_is_good(pa_memtrap *m);
48
49 void pa_memtrap_install(void);
50
51 #endif