diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-23 01:30:22 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-23 01:30:22 +0000 |
commit | 9413babc1d0e0d3effd70cd7959e0f6b65346959 (patch) | |
tree | 7778a9955beb55d1814262b90d5542e8999b4a23 | |
parent | 1b9fcfe21b87a422831e7a8724aaa865f2d4dcdb (diff) |
make sure realtime/high scheduling priority is relinquished before executing an AGI script (issue #4930)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6368 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | asterisk.c | 4 | ||||
-rwxr-xr-x | include/asterisk.h | 2 | ||||
-rwxr-xr-x | res/res_agi.c | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/asterisk.c b/asterisk.c index dedf23e69..fe2861533 100755 --- a/asterisk.c +++ b/asterisk.c @@ -674,7 +674,7 @@ static void set_icon(char *text) fprintf(stdout, "\033]1;%s\007", text); } -static int set_priority(int pri) +int ast_set_priority(int pri) { struct sched_param sched; memset(&sched, 0, sizeof(sched)); @@ -1940,7 +1940,7 @@ int main(int argc, char *argv[]) ast_verbose("[ Reading Master Configuration ]"); ast_readconfig(); - if (set_priority(option_highpriority)) { + if (ast_set_priority(option_highpriority)) { exit(1); } diff --git a/include/asterisk.h b/include/asterisk.h index 708d503a4..e10200bbd 100755 --- a/include/asterisk.h +++ b/include/asterisk.h @@ -37,6 +37,8 @@ extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH]; extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH]; extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH]; +/* Provided by asterisk.c */ +extern int ast_set_priority(int); /* Provided by module.c */ extern int load_modules(const int preload_only); /* Provided by pbx.c */ diff --git a/res/res_agi.c b/res/res_agi.c index 9dd62fba7..89b25e762 100755 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -279,6 +279,9 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op for (x=STDERR_FILENO + 2;x<1024;x++) close(x); + /* Don't run AGI scripts with realtime priority -- it causes audio stutter */ + ast_set_priority(0); + /* Execute script */ execv(script, argv); /* Can't use ast_log since FD's are closed */ |