mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-06 13:07:21 +00:00
Bug 6864 - drop realtime priority on ALL external processes
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@24019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
static const char *tdesc = "External IVR Interface Application";
|
static const char *tdesc = "External IVR Interface Application";
|
||||||
|
|
||||||
@@ -313,6 +314,9 @@ static int app_exec(struct ast_channel *chan, void *data)
|
|||||||
/* child process */
|
/* child process */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (option_highpriority)
|
||||||
|
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);
|
||||||
|
@@ -53,6 +53,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"
|
||||||
|
|
||||||
@@ -136,6 +137,9 @@ static int send_waveform_to_fd(char *waveform, int length, int fd) {
|
|||||||
if (x != fd)
|
if (x != fd)
|
||||||
close(x);
|
close(x);
|
||||||
}
|
}
|
||||||
|
if (option_highpriority)
|
||||||
|
ast_set_priority(0);
|
||||||
|
|
||||||
/*IAS */
|
/*IAS */
|
||||||
#ifdef __PPC__
|
#ifdef __PPC__
|
||||||
for( x=0; x<length; x+=2)
|
for( x=0; x<length; x+=2)
|
||||||
|
@@ -44,6 +44,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"
|
||||||
@@ -72,6 +73,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 (option_highpriority)
|
||||||
|
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))
|
||||||
|
@@ -43,6 +43,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 (option_highpriority)
|
||||||
|
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)
|
||||||
|
@@ -44,6 +44,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 (option_highpriority)
|
||||||
|
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)
|
||||||
|
@@ -96,6 +96,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 (option_highpriority)
|
||||||
|
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);
|
||||||
|
@@ -443,6 +443,8 @@ int ast_safe_system(const char *s)
|
|||||||
pid = fork();
|
pid = fork();
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
|
if (option_highpriority)
|
||||||
|
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);
|
||||||
|
@@ -44,6 +44,7 @@ extern int option_timestamp;
|
|||||||
extern int option_transcode_slin;
|
extern int option_transcode_slin;
|
||||||
extern int option_transmit_silence_during_record;
|
extern int option_transmit_silence_during_record;
|
||||||
extern int option_maxcalls;
|
extern int option_maxcalls;
|
||||||
|
extern int option_highpriority;
|
||||||
extern double option_maxload;
|
extern double option_maxload;
|
||||||
extern int option_dontwarn;
|
extern int option_dontwarn;
|
||||||
extern int option_priority_jumping;
|
extern int option_priority_jumping;
|
||||||
|
@@ -440,6 +440,10 @@ static int spawn_mp3(struct mohclass *class)
|
|||||||
}
|
}
|
||||||
if (!class->pid) {
|
if (!class->pid) {
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
if (option_highpriority)
|
||||||
|
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);
|
||||||
|
Reference in New Issue
Block a user