From d9e331795d943442bafe16e25cd75d907dc4c397 Mon Sep 17 00:00:00 2001 From: tilghman Date: Mon, 1 May 2006 20:44:24 +0000 Subject: Bug 6864 - drop realtime priority on ALL external processes git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@24019 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_externalivr.c | 4 ++++ apps/app_festival.c | 4 ++++ apps/app_ices.c | 3 +++ apps/app_mp3.c | 3 +++ apps/app_nbscat.c | 4 ++++ apps/app_zapras.c | 4 ++++ asterisk.c | 2 ++ include/asterisk/options.h | 1 + res/res_musiconhold.c | 4 ++++ 9 files changed, 29 insertions(+) diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index a53a59532..b61ddd99a 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/linkedlists.h" #include "asterisk/app.h" +#include "asterisk/options.h" static const char *tdesc = "External IVR Interface Application"; @@ -313,6 +314,9 @@ static int app_exec(struct ast_channel *chan, void *data) /* child process */ int i; + if (option_highpriority) + ast_set_priority(0); + dup2(child_stdin[0], STDIN_FILENO); dup2(child_stdout[1], STDOUT_FILENO); dup2(child_stderr[1], STDERR_FILENO); diff --git a/apps/app_festival.c b/apps/app_festival.c index d3bd1e9b9..de1830fd2 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -53,6 +53,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/config.h" #include "asterisk/utils.h" #include "asterisk/lock.h" +#include "asterisk/options.h" #define FESTIVAL_CONFIG "festival.conf" @@ -136,6 +137,9 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) { if (x != fd) close(x); } + if (option_highpriority) + ast_set_priority(0); + /*IAS */ #ifdef __PPC__ for( x=0; xfds[0], STDIN_FILENO); + /* Drop high priority */ + if (option_highpriority) + ast_set_priority(0); + /* Close other file descriptors */ for (x=STDERR_FILENO + 1;x<1024;x++) close(x); diff --git a/asterisk.c b/asterisk.c index 5e1423e86..c62442d09 100644 --- a/asterisk.c +++ b/asterisk.c @@ -443,6 +443,8 @@ int ast_safe_system(const char *s) pid = fork(); if (pid == 0) { + if (option_highpriority) + ast_set_priority(0); /* Close file descriptors and launch system command */ for (x = STDERR_FILENO + 1; x < 4096; x++) close(x); diff --git a/include/asterisk/options.h b/include/asterisk/options.h index fd8f3aadb..7a71cdcb0 100644 --- a/include/asterisk/options.h +++ b/include/asterisk/options.h @@ -44,6 +44,7 @@ extern int option_timestamp; extern int option_transcode_slin; extern int option_transmit_silence_during_record; extern int option_maxcalls; +extern int option_highpriority; extern double option_maxload; extern int option_dontwarn; extern int option_priority_jumping; diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index d31bf08ac..a90585b21 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -440,6 +440,10 @@ static int spawn_mp3(struct mohclass *class) } if (!class->pid) { int x; + + if (option_highpriority) + ast_set_priority(0); + close(fds[0]); /* Stdout goes to pipe */ dup2(fds[1], STDOUT_FILENO); -- cgit v1.2.3