mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	More OpenBSD changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@891 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										16
									
								
								asterisk.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								rtp.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user