aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-09 03:54:41 +0000
committerautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-09 03:54:41 +0000
commit13bc05ebd4837d41f2ef4766525794e82b2ece65 (patch)
tree7d788cb1a3eab057f99861689a7547d9ea4e12bb /asterisk.c
parentdf1bd2f77b48491abc1619d7a8807da4ec6800fe (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@60897 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/asterisk.c b/asterisk.c
index 228a1acd5..9c484605a 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -795,6 +795,7 @@ int ast_set_priority(int pri)
struct sched_param sched;
memset(&sched, 0, sizeof(sched));
#ifdef __linux__
+#undef sched_setscheduler
if (pri) {
sched.sched_priority = 10;
if (sched_setscheduler(0, SCHED_RR, &sched)) {
@@ -805,12 +806,11 @@ int ast_set_priority(int pri)
ast_verbose("Set to realtime thread\n");
} else {
sched.sched_priority = 0;
- if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
- ast_log(LOG_WARNING, "Unable to set normal priority\n");
- return -1;
- }
+ /* According to the manpage, this can never fail, with these parameters. */
+ sched_setscheduler(0, SCHED_OTHER, &sched);
}
#else
+#undef setpriority
if (pri) {
if (setpriority(PRIO_PROCESS, 0, -10) == -1) {
ast_log(LOG_WARNING, "Unable to set high priority\n");
@@ -819,10 +819,8 @@ int ast_set_priority(int pri)
if (option_verbose)
ast_verbose("Set to high priority\n");
} else {
- if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
- ast_log(LOG_WARNING, "Unable to set normal priority\n");
- return -1;
- }
+ /* According to the manpage, this can never fail, with these parameters. */
+ setpriority(PRIO_PROCESS, 0, 0);
}
#endif
return 0;