diff options
Diffstat (limited to 'src/daemon/main.c')
-rw-r--r-- | src/daemon/main.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c index a2324516..58f8d660 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -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 @@ -946,9 +950,7 @@ int main(int argc, char *argv[]) { valid_pid_file = TRUE; } -#ifdef SIGPIPE - signal(SIGPIPE, SIG_IGN); -#endif + pa_disable_sigpipe(); if (pa_rtclock_hrtimer()) pa_log_info(_("Fresh high-resolution timers available! Bon appetit!")); @@ -962,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()); |