1 #ifndef foopulsecorememtraphfoo
2 #define foopulsecorememtraphfoo
5 This file is part of PulseAudio.
7 Copyright 2009 Lennart Poettering
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.
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.
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
25 #include <sys/types.h>
27 #include <pulsecore/macro.h>
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.
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. */
40 typedef struct pa_memtrap pa_memtrap
;
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
);
45 void pa_memtrap_remove(pa_memtrap
*m
);
47 pa_bool_t
pa_memtrap_is_good(pa_memtrap
*m
);
49 void pa_memtrap_install(void);