aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-23 20:22:14 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-23 20:22:14 +0000
commit51be9a03a601f4b64b883d5c97966041095517b0 (patch)
treeeb00eb0ded541a3c05827d08dbfe8a90db0e702f /asterisk.c
parentc8ceb9c9c5712a970aa70192c7800fc9e1e39aed (diff)
More OpenBSD changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@891 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rwxr-xr-xasterisk.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index 761ab09dd..9e551a55c 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -313,6 +313,7 @@ static int set_priority(int pri)
memset(&sched, 0, sizeof(sched));
/* We set ourselves to a high priority, that we might pre-empt everything
else. If your PBX has heavy activity on it, this is a good thing. */
+#ifdef __linux__
if (pri) {
sched.sched_priority = 10;
if (sched_setscheduler(0, SCHED_RR, &sched)) {
@@ -328,6 +329,21 @@ static int set_priority(int pri)
return -1;
}
}
+#else
+ if (pri) {
+ if (setpriority(PRIO_PROCESS, 0, -10) == -1) {
+ ast_log(LOG_WARNING, "Unable to set high priority\n");
+ return -1;
+ } else
+ 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;
+ }
+ }
+#endif
return 0;
}