mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
daemon: optionally call mlockall() on startup
This commit is contained in:
parent
71ce195d3b
commit
a9b38b3530
5 changed files with 37 additions and 12 deletions
|
|
@ -40,6 +40,10 @@
|
|||
|
||||
#include <liboil/liboil.h>
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
|
@ -960,6 +964,17 @@ int main(int argc, char *argv[]) {
|
|||
pa_rtsig_configure(SIGRTMIN, SIGRTMAX-1);
|
||||
#endif
|
||||
|
||||
if (conf->lock_memory) {
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
if (mlockall(MCL_FUTURE) < 0)
|
||||
pa_log_warn("mlockall() failed: %s", pa_cstrerror(errno));
|
||||
else
|
||||
pa_log_info("Sucessfully locked process into memory.");
|
||||
#else
|
||||
pa_log_warn("Memory locking requested but not supported on platform.");
|
||||
#endif
|
||||
}
|
||||
|
||||
pa_memtrap_install();
|
||||
|
||||
pa_assert_se(mainloop = pa_mainloop_new());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue