Merged revisions 24019 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 1 May 2006 21:48:30 +0000 (21:48 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 1 May 2006 21:48:30 +0000 (21:48 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r24019 | tilghman | 2006-05-01 15:44:24 -0500 (Mon, 01 May 2006) | 2 lines

Bug 6864 - drop realtime priority on ALL external processes

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@24053 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_externalivr.c
apps/app_festival.c
apps/app_ices.c
apps/app_mp3.c
apps/app_nbscat.c
apps/app_zapras.c
asterisk.c
res/res_musiconhold.c

index ef35637..7a9757e 100644 (file)
@@ -50,6 +50,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/linkedlists.h"
 #include "asterisk/app.h"
 #include "asterisk/utils.h"
+#include "asterisk/options.h"
 
 
 static const char *app = "ExternalIVR";
@@ -316,6 +317,9 @@ static int app_exec(struct ast_channel *chan, void *data)
                /* child process */
                int i;
 
+               if (ast_opt_high_priority)
+                       ast_set_priority(0);
+
                dup2(child_stdin[0], STDIN_FILENO);
                dup2(child_stdout[1], STDOUT_FILENO);
                dup2(child_stderr[1], STDERR_FILENO);
index f06cbae..223aca5 100644 (file)
@@ -55,6 +55,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"
 
@@ -140,6 +141,9 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
                 if (x != fd)
                         close(x);
         }
+       if (ast_opt_high_priority)
+               ast_set_priority(0);
+
 /*IAS */
 #ifdef __PPC__  
        for( x=0; x<length; x+=2)
index 3a8130a..9558f02 100644 (file)
@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/translate.h"
+#include "asterisk/options.h"
 
 #define ICES "/usr/bin/ices"
 #define LOCAL_ICES "/usr/local/bin/ices"
@@ -70,6 +71,8 @@ static int icesencode(char *filename, int fd)
                ast_log(LOG_WARNING, "Fork failed\n");
        if (res)
                return res;
+       if (ast_opt_high_priority)
+               ast_set_priority(0);
        dup2(fd, STDIN_FILENO);
        for (x=STDERR_FILENO + 1;x<256;x++) {
                if ((x != STDIN_FILENO) && (x != STDOUT_FILENO))
index bfb0eb9..b5a3138 100644 (file)
@@ -45,6 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/translate.h"
+#include "asterisk/options.h"
 
 #define LOCAL_MPG_123 "/usr/local/bin/mpg123"
 #define MPG_123 "/usr/bin/mpg123"
@@ -71,6 +72,8 @@ static int mp3play(char *filename, int fd)
                ast_log(LOG_WARNING, "Fork failed\n");
        if (res)
                return res;
+       if (ast_opt_high_priority)
+               ast_set_priority(0);
        dup2(fd, STDOUT_FILENO);
        for (x=0;x<256;x++) {
                if (x != STDOUT_FILENO)
index a557f2d..05fb4e4 100644 (file)
@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/translate.h"
+#include "asterisk/options.h"
 
 #define LOCAL_NBSCAT "/usr/local/bin/nbscat8k"
 #define NBSCAT "/usr/bin/nbscat8k"
@@ -75,6 +76,9 @@ static int NBScatplay(int fd)
                ast_log(LOG_WARNING, "Fork failed\n");
        if (res)
                return res;
+       if (ast_opt_high_priority)
+               ast_set_priority(0);
+
        dup2(fd, STDOUT_FILENO);
        for (x=0;x<256;x++) {
                if (x != STDOUT_FILENO)
index c95f752..d75d2ee 100644 (file)
@@ -100,6 +100,10 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
        /* Execute RAS on File handles */
        dup2(chan->fds[0], STDIN_FILENO);
 
+       /* Drop high priority */
+       if (ast_opt_high_priority)
+               ast_set_priority(0);
+
        /* Close other file descriptors */
        for (x=STDERR_FILENO + 1;x<1024;x++) 
                close(x);
index db5bf12..e256d3f 100644 (file)
@@ -635,6 +635,8 @@ int ast_safe_system(const char *s)
        pid = fork();
 
        if (pid == 0) {
+               if (ast_opt_high_priority)
+                       ast_set_priority(0);
                /* Close file descriptors and launch system command */
                for (x = STDERR_FILENO + 1; x < 4096; x++)
                        close(x);
index 260a08c..33d7e59 100644 (file)
@@ -436,6 +436,10 @@ static int spawn_mp3(struct mohclass *class)
        }
        if (!class->pid) {
                int x;
+
+               if (ast_opt_high_priority)
+                       ast_set_priority(0);
+
                close(fds[0]);
                /* Stdout goes to pipe */
                dup2(fds[1], STDOUT_FILENO);