Merged revisions 24019 via svnmerge from

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
This commit is contained in:
Tilghman Lesher
2006-05-01 21:48:30 +00:00
parent e635b463fc
commit aeed5ca05d
8 changed files with 28 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/linkedlists.h" #include "asterisk/linkedlists.h"
#include "asterisk/app.h" #include "asterisk/app.h"
#include "asterisk/utils.h" #include "asterisk/utils.h"
#include "asterisk/options.h"
static const char *app = "ExternalIVR"; static const char *app = "ExternalIVR";
@@ -316,6 +317,9 @@ static int app_exec(struct ast_channel *chan, void *data)
/* child process */ /* child process */
int i; int i;
if (ast_opt_high_priority)
ast_set_priority(0);
dup2(child_stdin[0], STDIN_FILENO); dup2(child_stdin[0], STDIN_FILENO);
dup2(child_stdout[1], STDOUT_FILENO); dup2(child_stdout[1], STDOUT_FILENO);
dup2(child_stderr[1], STDERR_FILENO); dup2(child_stderr[1], STDERR_FILENO);

View File

@@ -55,6 +55,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/config.h" #include "asterisk/config.h"
#include "asterisk/utils.h" #include "asterisk/utils.h"
#include "asterisk/lock.h" #include "asterisk/lock.h"
#include "asterisk/options.h"
#define FESTIVAL_CONFIG "festival.conf" #define FESTIVAL_CONFIG "festival.conf"
@@ -140,6 +141,9 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
if (x != fd) if (x != fd)
close(x); close(x);
} }
if (ast_opt_high_priority)
ast_set_priority(0);
/*IAS */ /*IAS */
#ifdef __PPC__ #ifdef __PPC__
for( x=0; x<length; x+=2) for( x=0; x<length; x+=2)

View File

@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h" #include "asterisk/pbx.h"
#include "asterisk/module.h" #include "asterisk/module.h"
#include "asterisk/translate.h" #include "asterisk/translate.h"
#include "asterisk/options.h"
#define ICES "/usr/bin/ices" #define ICES "/usr/bin/ices"
#define LOCAL_ICES "/usr/local/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"); ast_log(LOG_WARNING, "Fork failed\n");
if (res) if (res)
return res; return res;
if (ast_opt_high_priority)
ast_set_priority(0);
dup2(fd, STDIN_FILENO); dup2(fd, STDIN_FILENO);
for (x=STDERR_FILENO + 1;x<256;x++) { for (x=STDERR_FILENO + 1;x<256;x++) {
if ((x != STDIN_FILENO) && (x != STDOUT_FILENO)) if ((x != STDIN_FILENO) && (x != STDOUT_FILENO))

View File

@@ -45,6 +45,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h" #include "asterisk/pbx.h"
#include "asterisk/module.h" #include "asterisk/module.h"
#include "asterisk/translate.h" #include "asterisk/translate.h"
#include "asterisk/options.h"
#define LOCAL_MPG_123 "/usr/local/bin/mpg123" #define LOCAL_MPG_123 "/usr/local/bin/mpg123"
#define MPG_123 "/usr/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"); ast_log(LOG_WARNING, "Fork failed\n");
if (res) if (res)
return res; return res;
if (ast_opt_high_priority)
ast_set_priority(0);
dup2(fd, STDOUT_FILENO); dup2(fd, STDOUT_FILENO);
for (x=0;x<256;x++) { for (x=0;x<256;x++) {
if (x != STDOUT_FILENO) if (x != STDOUT_FILENO)

View File

@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h" #include "asterisk/pbx.h"
#include "asterisk/module.h" #include "asterisk/module.h"
#include "asterisk/translate.h" #include "asterisk/translate.h"
#include "asterisk/options.h"
#define LOCAL_NBSCAT "/usr/local/bin/nbscat8k" #define LOCAL_NBSCAT "/usr/local/bin/nbscat8k"
#define NBSCAT "/usr/bin/nbscat8k" #define NBSCAT "/usr/bin/nbscat8k"
@@ -75,6 +76,9 @@ static int NBScatplay(int fd)
ast_log(LOG_WARNING, "Fork failed\n"); ast_log(LOG_WARNING, "Fork failed\n");
if (res) if (res)
return res; return res;
if (ast_opt_high_priority)
ast_set_priority(0);
dup2(fd, STDOUT_FILENO); dup2(fd, STDOUT_FILENO);
for (x=0;x<256;x++) { for (x=0;x<256;x++) {
if (x != STDOUT_FILENO) if (x != STDOUT_FILENO)

View File

@@ -100,6 +100,10 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
/* Execute RAS on File handles */ /* Execute RAS on File handles */
dup2(chan->fds[0], STDIN_FILENO); dup2(chan->fds[0], STDIN_FILENO);
/* Drop high priority */
if (ast_opt_high_priority)
ast_set_priority(0);
/* Close other file descriptors */ /* Close other file descriptors */
for (x=STDERR_FILENO + 1;x<1024;x++) for (x=STDERR_FILENO + 1;x<1024;x++)
close(x); close(x);

View File

@@ -635,6 +635,8 @@ int ast_safe_system(const char *s)
pid = fork(); pid = fork();
if (pid == 0) { if (pid == 0) {
if (ast_opt_high_priority)
ast_set_priority(0);
/* Close file descriptors and launch system command */ /* Close file descriptors and launch system command */
for (x = STDERR_FILENO + 1; x < 4096; x++) for (x = STDERR_FILENO + 1; x < 4096; x++)
close(x); close(x);

View File

@@ -436,6 +436,10 @@ static int spawn_mp3(struct mohclass *class)
} }
if (!class->pid) { if (!class->pid) {
int x; int x;
if (ast_opt_high_priority)
ast_set_priority(0);
close(fds[0]); close(fds[0]);
/* Stdout goes to pipe */ /* Stdout goes to pipe */
dup2(fds[1], STDOUT_FILENO); dup2(fds[1], STDOUT_FILENO);