diff --git a/asterisk.c b/asterisk.c index 761ab09dd6c00dae9274737ab79ad5b7db37cf31..9e551a55c6510c8b54d2c8846c0930bdaa35327d 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; } diff --git a/channels/chan_iax.c b/channels/chan_iax.c index 426bc580bf95a7336477eedecd22cdfcef34d14c..f185ce719ef992acd73ce827eb73ac01d7c5941f 100755 --- a/channels/chan_iax.c +++ b/channels/chan_iax.c @@ -5134,7 +5134,7 @@ int load_module(void) if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", tos); - if (setsockopt(netsocket, SOL_IP, IP_TOS, &tos, sizeof(tos))) + if (setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos); if (!res) { diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 6310f58c9bc67777d288b46a70ddecc55f162830..1aaf2880a5085421063a389923f660523fb063cd 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5479,7 +5479,7 @@ int load_module(void) if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", tos); - if (setsockopt(netsocket, SOL_IP, IP_TOS, &tos, sizeof(tos))) + if (setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos); if (!res) { diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 954768b2d3618534f7ba407163f8e7d93320323f..9758bead24505a83a8e3ce07312f8705959deeaa 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5258,7 +5258,7 @@ static int reload_config(void) if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "Using TOS bits %d\n", tos); - if (setsockopt(sipsock, SOL_IP, IP_TOS, &tos, sizeof(tos))) + if (setsockopt(sipsock, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos); } diff --git a/rtp.c b/rtp.c index a1188ce1b08c7d0c6ffa87d3114f6c784fe5b701..6f628fee879a032086a96c4e30ffac59cc051a41 100755 --- a/rtp.c +++ b/rtp.c @@ -575,7 +575,7 @@ struct ast_rtp *ast_rtp_new(struct sched_context *sched, struct io_context *io) int ast_rtp_settos(struct ast_rtp *rtp, int tos) { int res; - if ((res = setsockopt(rtp->s, SOL_IP, IP_TOS, &tos, sizeof(tos)))) + if ((res = setsockopt(rtp->s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)))) ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos); return res; }