From 1cba95f7234b4e31eb837fdaf7db962d9fe7a95a Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 5 Apr 2012 00:25:34 -0500 Subject: [PATCH] Lock all memory pages to prevent delays on incoming calls. Internal-Issue-ID: DAHDI-241 Signed-off-by: Shaun Ruffell --- main/asterisk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main/asterisk.c b/main/asterisk.c index f5f176b..d6457f5 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -101,6 +101,7 @@ int daemon(int, int); /* defined in libresolv of all places */ #endif #ifdef linux +#include #include #ifdef HAVE_CAP #include @@ -1581,9 +1582,12 @@ int ast_set_priority(int pri) if (sched_setscheduler(0, SCHED_RR, &sched)) { ast_log(LOG_WARNING, "Unable to set high priority\n"); return -1; - } else - if (option_verbose) + } else { + mlockall(MCL_FUTURE); + if (option_verbose) { ast_verbose("Set to realtime thread\n"); + } + } } else { sched.sched_priority = 0; /* According to the manpage, these parameters can never fail. */ -- 1.7.9.5