From 6eeee2496b58beb4672cbaf572cb937826f7e50f Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Sun, 27 Apr 2003 18:13:11 +0000 Subject: More BSD enhancements git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@916 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/Makefile | 7 +++++++ channels/chan_alsa.c | 2 +- channels/chan_modem.c | 2 +- channels/chan_oss.c | 2 +- channels/chan_phone.c | 4 ++-- channels/chan_vofr.c | 4 ++-- channels/chan_zap.c | 8 ++++---- channels/chan_zap_old.c | 8 ++++---- 8 files changed, 22 insertions(+), 15 deletions(-) (limited to 'channels') diff --git a/channels/Makefile b/channels/Makefile index 179a90072..5b055703b 100755 --- a/channels/Makefile +++ b/channels/Makefile @@ -11,6 +11,8 @@ # the GNU General Public License # +OSARCH=$(shell uname -s) + CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \ chan_modem_aopen.so chan_oss.so \ chan_modem_bestdata.so chan_modem_i4l.so \ @@ -41,6 +43,7 @@ ALSA_SRC=chan_alsa.c ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h") CFLAGS+=-DCRYPTO +CFLAGS+=-fPIC CFLAGS+=#-DVOFRDUMPER @@ -76,7 +79,11 @@ ringtone.h: gentone chan_oss.o: chan_oss.c busy.h ringtone.h chan_iax2.so: chan_iax2.o iax2-parser.o +ifeq (${OSARCH},Linux) $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o +else + $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o -lossaudio +endif chan_zap.o: $(CHANZAP) $(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP) diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 1032811d1..dfbce5722 100755 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -262,7 +262,7 @@ static void *sound_thread(void *unused) max = readdev; } #endif - res = select(max + 1, &rfds, &wfds, NULL, NULL); + res = ast_select(max + 1, &rfds, &wfds, NULL, NULL); if (res < 1) { ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno)); continue; diff --git a/channels/chan_modem.c b/channels/chan_modem.c index caa79dbb6..90ac7c3ae 100755 --- a/channels/chan_modem.c +++ b/channels/chan_modem.c @@ -609,7 +609,7 @@ static void *do_monitor(void *data) #endif /* Wait indefinitely for something to happen */ pthread_testcancel(); - res = select(n + 1, &rfds, NULL, &efds, NULL); + res = ast_select(n + 1, &rfds, NULL, &efds, NULL); pthread_testcancel(); /* Okay, select has finished. Let's see what happened. */ if (res < 1) { diff --git a/channels/chan_oss.c b/channels/chan_oss.c index ffbbbdef8..7199d33b9 100755 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -245,7 +245,7 @@ static void *sound_thread(void *unused) if (sounddev > max) max = sounddev; } - res = select(max + 1, &rfds, &wfds, NULL, NULL); + res = ast_select(max + 1, &rfds, &wfds, NULL, NULL); if (res < 1) { ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno)); continue; diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 83660cdd0..80232c3c8 100755 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -848,9 +848,9 @@ static void *do_monitor(void *data) tv.tv_usec = 30000; tv.tv_sec = 0; } - res = select(n + 1, &rfds, NULL, &efds, &tv); + res = ast_select(n + 1, &rfds, NULL, &efds, &tv); } else { - res = select(n + 1, &rfds, NULL, &efds, NULL); + res = ast_select(n + 1, &rfds, NULL, &efds, NULL); tv.tv_usec = 0; tv.tv_sec = 0; tonepos = 0; diff --git a/channels/chan_vofr.c b/channels/chan_vofr.c index f1bb5e539..4cbc71f2b 100755 --- a/channels/chan_vofr.c +++ b/channels/chan_vofr.c @@ -564,7 +564,7 @@ retry: fd_set fds; FD_ZERO(&fds); FD_SET(p->s, &fds); - select(p->s + 1, &fds, NULL, NULL, NULL); + ast_select(p->s + 1, &fds, NULL, NULL, NULL); goto retry; } ast->blocking = 0; @@ -953,7 +953,7 @@ static void *do_monitor(void *data) ast_pthread_mutex_unlock(&monlock); pthread_testcancel(); /* Wait indefinitely for something to happen */ - res = select(n + 1, &rfds, NULL, NULL, NULL); + res = ast_select(n + 1, &rfds, NULL, NULL, NULL); pthread_testcancel(); /* Okay, select has finished. Let's see what happened. */ if (res < 0) { diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 973a086bf..e15ebe3a9 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1863,7 +1863,7 @@ int x; FD_ZERO(&efds); FD_SET(fd,&wfds); FD_SET(fd,&efds); - res = select(fd + 1,NULL,&wfds,&efds,NULL); + res = ast_select(fd + 1,NULL,&wfds,&efds,NULL); if (!res) { ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel); continue; @@ -4417,7 +4417,7 @@ static void *do_monitor(void *data) /* Wait at least a second for something to happen */ tv.tv_sec = 1; tv.tv_usec = 0; - res = select(n + 1, &rfds, NULL, &efds, &tv); + res = ast_select(n + 1, &rfds, NULL, &efds, &tv); pthread_testcancel(); /* Okay, select has finished. Let's see what happened. */ if (res < 0) { @@ -5447,7 +5447,7 @@ static void *pri_dchannel(void *vpri) pthread_mutex_unlock(&pri->lock); e = NULL; - res = select(pri->fd + 1, &rfds, NULL, &efds, &tv); + res = ast_select(pri->fd + 1, &rfds, NULL, &efds, &tv); ast_pthread_mutex_lock(&pri->lock); if (!res) { @@ -6982,7 +6982,7 @@ static int zt_sendtext(struct ast_channel *c, char *text) FD_ZERO(&efds); FD_SET(fd,&wfds); FD_SET(fd,&efds); - res = select(fd + 1,NULL,&wfds,&efds,NULL); + res = ast_select(fd + 1,NULL,&wfds,&efds,NULL); if (!res) { ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel); continue; diff --git a/channels/chan_zap_old.c b/channels/chan_zap_old.c index 7e9b2df8e..79324cadf 100755 --- a/channels/chan_zap_old.c +++ b/channels/chan_zap_old.c @@ -1673,7 +1673,7 @@ int x; FD_ZERO(&efds); FD_SET(fd,&wfds); FD_SET(fd,&efds); - res = select(fd + 1,NULL,&wfds,&efds,NULL); + res = ast_select(fd + 1,NULL,&wfds,&efds,NULL); if (!res) { ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel); continue; @@ -4055,7 +4055,7 @@ static void *do_monitor(void *data) /* Wait at least a second for something to happen */ tv.tv_sec = 1; tv.tv_usec = 0; - res = select(n + 1, &rfds, NULL, &efds, &tv); + res = ast_select(n + 1, &rfds, NULL, &efds, &tv); pthread_testcancel(); /* Okay, select has finished. Let's see what happened. */ if (res < 0) { @@ -5114,7 +5114,7 @@ static void *pri_dchannel(void *vpri) pthread_mutex_unlock(&pri->lock); e = NULL; - res = select(pri->fd + 1, &rfds, NULL, &efds, &tv); + res = ast_select(pri->fd + 1, &rfds, NULL, &efds, &tv); ast_pthread_mutex_lock(&pri->lock); if (!res) { @@ -6550,7 +6550,7 @@ static int zt_sendtext(struct ast_channel *c, char *text) FD_ZERO(&efds); FD_SET(fd,&wfds); FD_SET(fd,&efds); - res = select(fd + 1,NULL,&wfds,&efds,NULL); + res = ast_select(fd + 1,NULL,&wfds,&efds,NULL); if (!res) { ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel); continue; -- cgit v1.2.3