sink-input: adjust log level of empty-pop operations
[platform/upstream/pulseaudio.git] / 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, see <http://www.gnu.org/licenses/>.
21 ***/
22
23 #include <sys/types.h>
24
25 #include <pulsecore/macro.h>
26
27 /* This subsystem will trap SIGBUS on specific memory regions. The
28  * regions will be remapped to anonymous memory (i.e. writable NUL
29  * bytes) on SIGBUS, so that execution of the main program can
30  * continue though with memory having changed beneath its hands. With
31  * pa_memtrap_is_good() it is possible to query if a memory region is
32  * still 'good' i.e. no SIGBUS has happened yet for it.
33  *
34  * Intended usage is to handle memory mapped in which is controlled by
35  * other processes that might execute ftruncate() or when mapping inb
36  * hardware resources that might get invalidated when unplugged. */
37
38 typedef struct pa_memtrap pa_memtrap;
39
40 pa_memtrap* pa_memtrap_add(const void *start, size_t size);
41 pa_memtrap *pa_memtrap_update(pa_memtrap *m, const void *start, size_t size);
42
43 void pa_memtrap_remove(pa_memtrap *m);
44
45 bool pa_memtrap_is_good(pa_memtrap *m);
46
47 void pa_memtrap_install(void);
48
49 #endif