mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
automerge commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@60897 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
14
asterisk.c
14
asterisk.c
@@ -795,6 +795,7 @@ int ast_set_priority(int pri)
|
|||||||
struct sched_param sched;
|
struct sched_param sched;
|
||||||
memset(&sched, 0, sizeof(sched));
|
memset(&sched, 0, sizeof(sched));
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
#undef sched_setscheduler
|
||||||
if (pri) {
|
if (pri) {
|
||||||
sched.sched_priority = 10;
|
sched.sched_priority = 10;
|
||||||
if (sched_setscheduler(0, SCHED_RR, &sched)) {
|
if (sched_setscheduler(0, SCHED_RR, &sched)) {
|
||||||
@@ -805,12 +806,11 @@ int ast_set_priority(int pri)
|
|||||||
ast_verbose("Set to realtime thread\n");
|
ast_verbose("Set to realtime thread\n");
|
||||||
} else {
|
} else {
|
||||||
sched.sched_priority = 0;
|
sched.sched_priority = 0;
|
||||||
if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
|
/* According to the manpage, this can never fail, with these parameters. */
|
||||||
ast_log(LOG_WARNING, "Unable to set normal priority\n");
|
sched_setscheduler(0, SCHED_OTHER, &sched);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#undef setpriority
|
||||||
if (pri) {
|
if (pri) {
|
||||||
if (setpriority(PRIO_PROCESS, 0, -10) == -1) {
|
if (setpriority(PRIO_PROCESS, 0, -10) == -1) {
|
||||||
ast_log(LOG_WARNING, "Unable to set high priority\n");
|
ast_log(LOG_WARNING, "Unable to set high priority\n");
|
||||||
@@ -819,10 +819,8 @@ int ast_set_priority(int pri)
|
|||||||
if (option_verbose)
|
if (option_verbose)
|
||||||
ast_verbose("Set to high priority\n");
|
ast_verbose("Set to high priority\n");
|
||||||
} else {
|
} else {
|
||||||
if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
|
/* According to the manpage, this can never fail, with these parameters. */
|
||||||
ast_log(LOG_WARNING, "Unable to set normal priority\n");
|
setpriority(PRIO_PROCESS, 0, 0);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ static int local_answer(struct ast_channel *ast)
|
|||||||
res = local_queue_frame(p, isoutbound, &answer, ast);
|
res = local_queue_frame(p, isoutbound, &answer, ast);
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Huh? Local is being asked to answer?\n");
|
ast_log(LOG_WARNING, "Huh? Local is being asked to answer?\n");
|
||||||
ast_mutex_unlock(&p->lock);
|
if (!res)
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +263,8 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f)
|
|||||||
ast_log(LOG_DEBUG, "Not posting to queue since already masked on '%s'\n", ast->name);
|
ast_log(LOG_DEBUG, "Not posting to queue since already masked on '%s'\n", ast->name);
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&p->lock);
|
if (!res)
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,8 +304,8 @@ static int local_indicate(struct ast_channel *ast, int condition)
|
|||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
f.subclass = condition;
|
f.subclass = condition;
|
||||||
res = local_queue_frame(p, isoutbound, &f, ast);
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,8 +322,8 @@ static int local_digit(struct ast_channel *ast, char digit)
|
|||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
f.subclass = digit;
|
f.subclass = digit;
|
||||||
res = local_queue_frame(p, isoutbound, &f, ast);
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,8 +342,8 @@ static int local_sendhtml(struct ast_channel *ast, int subclass, const char *dat
|
|||||||
f.subclass = subclass;
|
f.subclass = subclass;
|
||||||
f.data = (char *)data;
|
f.data = (char *)data;
|
||||||
f.datalen = datalen;
|
f.datalen = datalen;
|
||||||
res = local_queue_frame(p, isoutbound, &f, ast);
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +432,7 @@ static int local_hangup(struct ast_channel *ast)
|
|||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
|
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
|
||||||
struct local_pvt *cur, *prev=NULL;
|
struct local_pvt *cur, *prev=NULL;
|
||||||
struct ast_channel *ochan = NULL;
|
struct ast_channel *ochan = NULL;
|
||||||
int glaredetect;
|
int glaredetect, res = 0;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -485,8 +487,9 @@ static int local_hangup(struct ast_channel *ast)
|
|||||||
/* Need to actually hangup since there is no PBX */
|
/* Need to actually hangup since there is no PBX */
|
||||||
ochan = p->chan;
|
ochan = p->chan;
|
||||||
else
|
else
|
||||||
local_queue_frame(p, isoutbound, &f, NULL);
|
res = local_queue_frame(p, isoutbound, &f, NULL);
|
||||||
ast_mutex_unlock(&p->lock);
|
if (!res)
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
if (ochan)
|
if (ochan)
|
||||||
ast_hangup(ochan);
|
ast_hangup(ochan);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#define DEFAULT_LANGUAGE "en"
|
#define DEFAULT_LANGUAGE "en"
|
||||||
|
|
||||||
#define AST_CONFIG_MAX_PATH 255
|
#define AST_CONFIG_MAX_PATH 255
|
||||||
|
#define setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
|
||||||
|
#define sched_setscheduler __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
|
||||||
|
|
||||||
/* provided in asterisk.c */
|
/* provided in asterisk.c */
|
||||||
extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
|
extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
|
||||||
|
|||||||
Reference in New Issue
Block a user