mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
memtrap: hook up core to memtrap system
This commit is contained in:
parent
928adf412f
commit
684b4c116c
3 changed files with 11 additions and 1 deletions
|
|
@ -582,6 +582,7 @@ libpulsecommon_@PA_MAJORMINORMICRO@_la_SOURCES = \
|
||||||
pulsecore/pipe.c pulsecore/pipe.h \
|
pulsecore/pipe.c pulsecore/pipe.h \
|
||||||
pulsecore/poll.c pulsecore/poll.h \
|
pulsecore/poll.c pulsecore/poll.h \
|
||||||
pulsecore/prioq.c pulsecore/prioq.h \
|
pulsecore/prioq.c pulsecore/prioq.h \
|
||||||
|
pulsecore/memtrap.c pulsecore/memtrap.h \
|
||||||
pulsecore/proplist-util.c pulsecore/proplist-util.h \
|
pulsecore/proplist-util.c pulsecore/proplist-util.h \
|
||||||
pulsecore/pstream-util.c pulsecore/pstream-util.h \
|
pulsecore/pstream-util.c pulsecore/pstream-util.h \
|
||||||
pulsecore/pstream.c pulsecore/pstream.h \
|
pulsecore/pstream.c pulsecore/pstream.h \
|
||||||
|
|
@ -804,7 +805,6 @@ libpulsecore_@PA_MAJORMINORMICRO@_la_SOURCES = \
|
||||||
pulsecore/sconv-s16le.c pulsecore/sconv-s16le.h \
|
pulsecore/sconv-s16le.c pulsecore/sconv-s16le.h \
|
||||||
pulsecore/sconv.c pulsecore/sconv.h \
|
pulsecore/sconv.c pulsecore/sconv.h \
|
||||||
pulsecore/shared.c pulsecore/shared.h \
|
pulsecore/shared.c pulsecore/shared.h \
|
||||||
pulsecore/memtrap.c pulsecore/memtrap.h \
|
|
||||||
pulsecore/shm.c pulsecore/shm.h \
|
pulsecore/shm.c pulsecore/shm.h \
|
||||||
pulsecore/sink-input.c pulsecore/sink-input.h \
|
pulsecore/sink-input.c pulsecore/sink-input.h \
|
||||||
pulsecore/sink.c pulsecore/sink.h \
|
pulsecore/sink.c pulsecore/sink.h \
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@
|
||||||
#include <pulsecore/thread.h>
|
#include <pulsecore/thread.h>
|
||||||
#include <pulsecore/once.h>
|
#include <pulsecore/once.h>
|
||||||
#include <pulsecore/shm.h>
|
#include <pulsecore/shm.h>
|
||||||
|
#include <pulsecore/memtrap.h>
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
#include <pulsecore/dbus-shared.h>
|
#include <pulsecore/dbus-shared.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -961,6 +962,8 @@ int main(int argc, char *argv[]) {
|
||||||
pa_rtsig_configure(SIGRTMIN, SIGRTMAX-1);
|
pa_rtsig_configure(SIGRTMIN, SIGRTMAX-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
pa_memtrap_install();
|
||||||
|
|
||||||
pa_assert_se(mainloop = pa_mainloop_new());
|
pa_assert_se(mainloop = pa_mainloop_new());
|
||||||
|
|
||||||
if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm, conf->shm_size))) {
|
if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm, conf->shm_size))) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
#include <pulsecore/macro.h>
|
#include <pulsecore/macro.h>
|
||||||
#include <pulsecore/flist.h>
|
#include <pulsecore/flist.h>
|
||||||
#include <pulsecore/core-util.h>
|
#include <pulsecore/core-util.h>
|
||||||
|
#include <pulsecore/memtrap.h>
|
||||||
|
|
||||||
#include "memblock.h"
|
#include "memblock.h"
|
||||||
|
|
||||||
|
|
@ -91,6 +92,7 @@ struct pa_memblock {
|
||||||
struct pa_memimport_segment {
|
struct pa_memimport_segment {
|
||||||
pa_memimport *import;
|
pa_memimport *import;
|
||||||
pa_shm memory;
|
pa_shm memory;
|
||||||
|
pa_memtrap *trap;
|
||||||
unsigned n_blocks;
|
unsigned n_blocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -892,6 +894,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
|
||||||
|
|
||||||
seg->import = i;
|
seg->import = i;
|
||||||
seg->n_blocks = 0;
|
seg->n_blocks = 0;
|
||||||
|
seg->trap = pa_memtrap_add(seg->memory.ptr, seg->memory.size);
|
||||||
|
|
||||||
pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(shm_id), seg);
|
pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(shm_id), seg);
|
||||||
return seg;
|
return seg;
|
||||||
|
|
@ -903,6 +906,10 @@ static void segment_detach(pa_memimport_segment *seg) {
|
||||||
|
|
||||||
pa_hashmap_remove(seg->import->segments, PA_UINT32_TO_PTR(seg->memory.id));
|
pa_hashmap_remove(seg->import->segments, PA_UINT32_TO_PTR(seg->memory.id));
|
||||||
pa_shm_free(&seg->memory);
|
pa_shm_free(&seg->memory);
|
||||||
|
|
||||||
|
if (seg->trap)
|
||||||
|
pa_memtrap_remove(seg->trap);
|
||||||
|
|
||||||
pa_xfree(seg);
|
pa_xfree(seg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue