aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-27 18:13:11 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-27 18:13:11 +0000
commit0aca2c116cc8e7639edb3df385aa713c19b9b881 (patch)
tree1afbb7a2845b98a6b6a9ef4f8582529671e6cb10
parent1eabb1cfb5a737476c178de880bd6e0b27c78ab4 (diff)
More BSD enhancements
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@916 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xMakefile16
-rwxr-xr-xapps/Makefile2
-rwxr-xr-xapps/app_mp3.c2
-rwxr-xr-xasterisk.c6
-rwxr-xr-xcdr/Makefile2
-rwxr-xr-xchannel.c12
-rwxr-xr-xchannels/Makefile7
-rwxr-xr-xchannels/chan_alsa.c2
-rwxr-xr-xchannels/chan_modem.c2
-rwxr-xr-xchannels/chan_oss.c2
-rwxr-xr-xchannels/chan_phone.c4
-rwxr-xr-xchannels/chan_vofr.c4
-rwxr-xr-xchannels/chan_zap.c8
-rwxr-xr-xchannels/chan_zap_old.c8
-rwxr-xr-xcodecs/Makefile2
-rwxr-xr-xcodecs/gsm/Makefile10
-rwxr-xr-xcodecs/ilbc/Makefile1
-rwxr-xr-xcodecs/lpc10/Makefile2
-rwxr-xr-xcodecs/mp3/Makefile2
-rwxr-xr-xdb1-ast/include/db.h20
-rwxr-xr-xdb1-ast/include/mpool.h4
-rwxr-xr-xeditline/configure190
-rwxr-xr-xeditline/configure.in14
-rwxr-xr-xformats/Makefile2
-rwxr-xr-xinclude/asterisk/channel.h39
-rwxr-xr-xmanager.c2
-rwxr-xr-xpbx/Makefile2
-rwxr-xr-xres/Makefile2
-rwxr-xr-xres/res_parking.c2
29 files changed, 216 insertions, 155 deletions
diff --git a/Makefile b/Makefile
index 6b8c4a686..9b90917c4 100755
--- a/Makefile
+++ b/Makefile
@@ -13,13 +13,17 @@
.EXPORT_ALL_VARIABLES:
+OSARCH=$(shell uname -s)
+
# Pentium Pro Optimize
-#PROC=i686
+PROC=i686
# Pentium Optimize
#PROC=i586
#PROC=k6
#PROC=ppc
+ifeq (${OSARCH},Linux)
PROC=$(shell uname -m)
+endif
######### More GSM codec optimization
######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
@@ -63,6 +67,9 @@ CFLAGS=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarati
CFLAGS+=$(OPTIMIZE)
CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
+ifeq (${OSARCH},OpenBSD)
+CFLAGS+=-pthread
+endif
LIBEDIT=editline/libedit.a
@@ -85,7 +92,10 @@ CFLAGS+= $(DEBUG_THREADS)
CFLAGS+= $(TRACE_FRAMES)
CFLAGS+=# -fomit-frame-pointer
SUBDIRS=res channels pbx apps codecs formats agi cdr astman
-LIBS=-ldl -lpthread -lncurses -lm #-lnjamd
+ifeq (${OSARCH},Linux)
+LIBS=-ldl
+endif
+LIBS+=-lpthread -lncurses -lm #-lnjamd
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
translate.o file.o say.o pbx.o cli.o md5.o term.o \
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
@@ -147,7 +157,7 @@ build.h:
endif
asterisk: .version build.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
- gcc -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a
+ gcc $(DEBUG) -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a
subdirs:
for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
diff --git a/apps/Makefile b/apps/Makefile
index 30e1a9f27..ba74bebe6 100755
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -27,7 +27,7 @@ APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_intercom.
APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so" ; fi)
#APPS+=$(shell if [ -f /usr/include/zap.h ]; then echo "app_rpt.so" ; fi)
-CFLAGS+=
+CFLAGS+=-fPIC
all: $(APPS)
diff --git a/apps/app_mp3.c b/apps/app_mp3.c
index 791840106..52f1225c6 100755
--- a/apps/app_mp3.c
+++ b/apps/app_mp3.c
@@ -75,7 +75,7 @@ static int timed_read(int fd, void *data, int datalen)
struct timeval tv = { 2, 0 }; /* Wait no more than 2 seconds */
FD_ZERO(&fds);
FD_SET(fd, &fds);
- res = select(fd + 1, &fds, NULL, NULL, &tv);
+ res = ast_select(fd + 1, &fds, NULL, NULL, &tv);
if (res < 1) {
ast_log(LOG_NOTICE, "Selected timed out/errored out with %d\n", res);
return -1;
diff --git a/asterisk.c b/asterisk.c
index 9e551a55c..5ee2a4f67 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -130,7 +130,7 @@ static void *netconsole(void *vconsole)
max = con->fd;
if (con->p[0] > max)
max = con->p[0];
- res = select(max + 1, &rfds, NULL, NULL, NULL);
+ res = ast_select(max + 1, &rfds, NULL, NULL, NULL);
if (res < 0) {
ast_log(LOG_WARNING, "select returned < 0: %s\n", strerror(errno));
continue;
@@ -672,7 +672,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
max = ast_consock;
if (STDIN_FILENO > max)
max = STDIN_FILENO;
- res = select(max+1, &rfds, NULL, NULL, NULL);
+ res = ast_select(max+1, &rfds, NULL, NULL, NULL);
if (res < 0) {
if (errno == EINTR)
continue;
@@ -1369,7 +1369,7 @@ int main(int argc, char *argv[])
} else {
/* Do nothing */
- select(0,NULL,NULL,NULL,NULL);
+ ast_select(0,NULL,NULL,NULL,NULL);
}
return 0;
}
diff --git a/cdr/Makefile b/cdr/Makefile
index a1aad8cf7..8f05678dd 100755
--- a/cdr/Makefile
+++ b/cdr/Makefile
@@ -13,7 +13,7 @@
MODS=cdr_csv.so
-CFLAGS+=
+CFLAGS+=-fPIC
#
# MySQL stuff... Autoconf anyone??
diff --git a/channel.c b/channel.c
index 52130a879..40f73b843 100755
--- a/channel.c
+++ b/channel.c
@@ -756,10 +756,10 @@ int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)
max = fds[x];
}
}
- if (*ms >= 0)
- res = select(max + 1, &rfds, NULL, &efds, &tv);
+ if (*ms >= 0)
+ res = ast_select(max + 1, &rfds, NULL, &efds, &tv);
else
- res = select(max + 1, &rfds, NULL, &efds, NULL);
+ res = ast_select(max + 1, &rfds, NULL, &efds, NULL);
if (res < 0) {
/* Simulate a timeout if we were interrupted */
@@ -828,10 +828,10 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (fds[x] > max)
max = fds[x];
}
- if (*ms >= 0)
- res = select(max + 1, &rfds, NULL, &efds, &tv);
+ if (*ms >= 0)
+ res = ast_select(max + 1, &rfds, NULL, &efds, &tv);
else
- res = select(max + 1, &rfds, NULL, &efds, NULL);
+ res = ast_select(max + 1, &rfds, NULL, &efds, NULL);
if (res < 0) {
for (x=0;x<n;x++)
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;
diff --git a/codecs/Makefile b/codecs/Makefile
index 1ce2d333f..6341395d3 100755
--- a/codecs/Makefile
+++ b/codecs/Makefile
@@ -21,7 +21,7 @@ MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so")
MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so")
MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
-CFLAGS+=
+CFLAGS+=-fPIC
LIBG723=g723.1/libg723.a
LIBG723B=g723.1b/libg723b.a
diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile
index 01ce9c921..2304169ca 100755
--- a/codecs/gsm/Makefile
+++ b/codecs/gsm/Makefile
@@ -55,7 +55,7 @@ PG =
# CCFLAGS = -c -O
CC = gcc -ansi -pedantic $(OPTIMIZE) -march=$(PROC) -fschedule-insns2 -fomit-frame-pointer
-CCFLAGS += -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops
+CCFLAGS += -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops -fPIC
LD = $(CC)
@@ -175,7 +175,6 @@ GSM_SOURCES = $(SRC)/add.c \
$(SRC)/code.c \
$(SRC)/debug.c \
$(SRC)/decode.c \
- $(SRC)/k6opt.s \
$(SRC)/long_term.c \
$(SRC)/lpc.c \
$(SRC)/preprocess.c \
@@ -190,6 +189,9 @@ GSM_SOURCES = $(SRC)/add.c \
$(SRC)/gsm_option.c \
$(SRC)/short_term.c \
$(SRC)/table.c
+ifneq (${OSARCH},OpenBSD)
+GSM_SOURCES+= $(SRC)/k6opt.s
+endif
TOAST_SOURCES = $(SRC)/toast.c \
$(SRC)/toast_lin.c \
@@ -220,7 +222,6 @@ GSM_OBJECTS = $(SRC)/add.o \
$(SRC)/code.o \
$(SRC)/debug.o \
$(SRC)/decode.o \
- $(SRC)/k6opt.o \
$(SRC)/long_term.o \
$(SRC)/lpc.o \
$(SRC)/preprocess.o \
@@ -235,6 +236,9 @@ GSM_OBJECTS = $(SRC)/add.o \
$(SRC)/gsm_option.o \
$(SRC)/short_term.o \
$(SRC)/table.o
+ifneq (${OSARCH},OpenBSD)
+GSM_OBJECTS+= $(SRC)/k6opt.o
+endif
TOAST_OBJECTS = $(SRC)/toast.o \
$(SRC)/toast_lin.o \
diff --git a/codecs/ilbc/Makefile b/codecs/ilbc/Makefile
index 58d357988..16379771e 100755
--- a/codecs/ilbc/Makefile
+++ b/codecs/ilbc/Makefile
@@ -1,3 +1,4 @@
+CFLAGS+= -fPIC -O3
LIB=libilbc.a
OBJS= anaFilter.o iCBSearch.o packing.o \
diff --git a/codecs/lpc10/Makefile b/codecs/lpc10/Makefile
index bf7f11b3f..83ffc225b 100755
--- a/codecs/lpc10/Makefile
+++ b/codecs/lpc10/Makefile
@@ -22,7 +22,7 @@ LIB_TARGET_DIR = .
#
WARNINGS = -Wall -Wno-comment -Wno-error
-CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS)
+CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS) -fPIC
#CFLAGS+= $(shell if uname -m | grep -q 86; then echo "-mpentium" ; fi)
#fix for PPC processors
diff --git a/codecs/mp3/Makefile b/codecs/mp3/Makefile
index 44ebc39d1..e8a771fca 100755
--- a/codecs/mp3/Makefile
+++ b/codecs/mp3/Makefile
@@ -1,7 +1,7 @@
#
# LMC section
-CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g
+CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC
RANLIB=ranlib
# the XING decoder objs and dependencies:
diff --git a/db1-ast/include/db.h b/db1-ast/include/db.h
index 8b7921f97..f00c4df9f 100755
--- a/db1-ast/include/db.h
+++ b/db1-ast/include/db.h
@@ -117,14 +117,14 @@ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
/* Access method description structure. */
typedef struct __db {
DBTYPE type; /* Underlying db type. */
- int (*close) __PMT((struct __db *));
- int (*del) __PMT((const struct __db *, const DBT *, u_int));
- int (*get) __PMT((const struct __db *, const DBT *, DBT *, u_int));
- int (*put) __PMT((const struct __db *, DBT *, const DBT *, u_int));
- int (*seq) __PMT((const struct __db *, DBT *, DBT *, u_int));
- int (*sync) __PMT((const struct __db *, u_int));
+ int (*close) __P((struct __db *));
+ int (*del) __P((const struct __db *, const DBT *, u_int));
+ int (*get) __P((const struct __db *, const DBT *, DBT *, u_int));
+ int (*put) __P((const struct __db *, DBT *, const DBT *, u_int));
+ int (*seq) __P((const struct __db *, DBT *, DBT *, u_int));
+ int (*sync) __P((const struct __db *, u_int));
void *internal; /* Access method private. */
- int (*fd) __PMT((const struct __db *));
+ int (*fd) __P((const struct __db *));
} DB;
#define BTREEMAGIC 0x053162
@@ -139,9 +139,9 @@ typedef struct {
int minkeypage; /* minimum keys per page */
u_int psize; /* page size */
int (*compare) /* comparison function */
- __PMT((const DBT *, const DBT *));
+ __P((const DBT *, const DBT *));
size_t (*prefix) /* prefix function */
- __PMT((const DBT *, const DBT *));
+ __P((const DBT *, const DBT *));
int lorder; /* byte order */
} BTREEINFO;
@@ -155,7 +155,7 @@ typedef struct {
u_int nelem; /* number of elements */
u_int cachesize; /* bytes to cache */
u_int32_t /* hash function */
- (*hash) __PMT((const void *, size_t));
+ (*hash) __P((const void *, size_t));
int lorder; /* byte order */
} HASHINFO;
diff --git a/db1-ast/include/mpool.h b/db1-ast/include/mpool.h
index 22c9feabd..56f17f90d 100755
--- a/db1-ast/include/mpool.h
+++ b/db1-ast/include/mpool.h
@@ -70,9 +70,9 @@ typedef struct MPOOL {
u_long pagesize; /* file page size */
int fd; /* file descriptor */
/* page in conversion routine */
- void (*pgin) __PMT((void *, pgno_t, void *));
+ void (*pgin) __P((void *, pgno_t, void *));
/* page out conversion routine */
- void (*pgout) __PMT((void *, pgno_t, void *));
+ void (*pgout) __P((void *, pgno_t, void *));
void *pgcookie; /* cookie for page in/out routines */
#ifdef STATISTICS
u_long cachehit;
diff --git a/editline/configure b/editline/configure
index f6a1c4285..ce38a97a5 100755
--- a/editline/configure
+++ b/editline/configure
@@ -841,7 +841,7 @@ echo "$ac_t""$CPP" 1>&6
ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+for ac_dir in ${GNUSYSTEM_AUX_DIR} $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
@@ -1465,91 +1465,15 @@ fi
done
-cat > conftest.$ac_ext <<EOF
-#line 1470 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef __RCSID
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D__RCSID(x)='"
-fi
-rm -f conftest*
-
-
-cat > conftest.$ac_ext <<EOF
-#line 1489 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef __COPYRIGHT
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D__COPYRIGHT(x)='"
-fi
-rm -f conftest*
-
-
-cat > conftest.$ac_ext <<EOF
-#line 1508 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef __RENAME
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D__RENAME(x)='"
-fi
-rm -f conftest*
-
-
-cat > conftest.$ac_ext <<EOF
-#line 1527 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef _DIAGASSERT
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"
-fi
-rm -f conftest*
-
-
for ac_func in issetugid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1548: checking for $ac_func" >&5
+echo "configure:1472: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1553 "configure"
+#line 1477 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1572,7 +1496,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1599,12 +1523,12 @@ done
for ac_func in strlcat
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1603: checking for $ac_func" >&5
+echo "configure:1527: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1608 "configure"
+#line 1532 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1627,7 +1551,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1655,12 +1579,12 @@ done
for ac_func in strlcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1659: checking for $ac_func" >&5
+echo "configure:1583: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1664 "configure"
+#line 1588 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1683,7 +1607,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1711,12 +1635,12 @@ done
for ac_func in fgetln
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1715: checking for $ac_func" >&5
+echo "configure:1639: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1720 "configure"
+#line 1644 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1739,7 +1663,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1767,12 +1691,12 @@ done
for ac_func in strvis
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1771: checking for $ac_func" >&5
+echo "configure:1695: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1776 "configure"
+#line 1700 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1795,7 +1719,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1823,12 +1747,12 @@ done
for ac_func in strunvis
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1827: checking for $ac_func" >&5
+echo "configure:1751: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1832 "configure"
+#line 1756 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1851,7 +1775,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1877,6 +1801,82 @@ fi
done
+cat > conftest.$ac_ext <<EOF
+#line 1806 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef __RCSID
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D__RCSID(x)='"
+fi
+rm -f conftest*
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1825 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef __COPYRIGHT
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D__COPYRIGHT(x)='"
+fi
+rm -f conftest*
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1844 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef __RENAME
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D__RENAME(x)='"
+fi
+rm -f conftest*
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1863 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef _DIAGASSERT
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"
+fi
+rm -f conftest*
+
+
# Check whether --enable-readline or --disable-readline was given.
if test "${enable_readline+set}" = set; then
enableval="$enable_readline"
diff --git a/editline/configure.in b/editline/configure.in
index efa5e23e0..72ae9180b 100755
--- a/editline/configure.in
+++ b/editline/configure.in
@@ -76,6 +76,13 @@ AC_CHECK_HEADERS(termcap.h, , \
AC_CHECK_HEADERS(sys/cdefs.h vis.h)
+AC_CHECK_FUNCS(issetugid)
+AC_CHECK_FUNCS(strlcat, , CCSRCS="$CCSRCS np/strlcat.c")
+AC_CHECK_FUNCS(strlcpy, , CCSRCS="$CCSRCS np/strlcpy.c")
+AC_CHECK_FUNCS(fgetln, , CCSRCS="$CCSRCS np/fgetln.c")
+AC_CHECK_FUNCS(strvis, , CCSRCS="$CCSRCS np/vis.c")
+AC_CHECK_FUNCS(strunvis, , CCSRCS="$CCSRCS np/unvis.c")
+
AC_EGREP_CPP(yes,
[#include <sys/cdefs.h>
#ifdef __RCSID
@@ -104,13 +111,6 @@ AC_EGREP_CPP(yes,
#endif
], , [CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"])
-AC_CHECK_FUNCS(issetugid)
-AC_CHECK_FUNCS(strlcat, , CCSRCS="$CCSRCS np/strlcat.c")
-AC_CHECK_FUNCS(strlcpy, , CCSRCS="$CCSRCS np/strlcpy.c")
-AC_CHECK_FUNCS(fgetln, , CCSRCS="$CCSRCS np/fgetln.c")
-AC_CHECK_FUNCS(strvis, , CCSRCS="$CCSRCS np/vis.c")
-AC_CHECK_FUNCS(strunvis, , CCSRCS="$CCSRCS np/unvis.c")
-
dnl Enable readline compatibility by default.
AC_ARG_ENABLE(readline, [ --disable-readline Disable readline compatibility],
if test "x$enable_readline" != "xyes" ; then
diff --git a/formats/Makefile b/formats/Makefile
index 17a919542..0cc2cb41f 100755
--- a/formats/Makefile
+++ b/formats/Makefile
@@ -17,7 +17,7 @@ FORMAT_LIBS+=format_jpeg.so
GSMLIB=../codecs/gsm/lib/libgsm.a
-CFLAGS+=
+CFLAGS+=-fPIC
all: $(FORMAT_LIBS)
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index da849c899..16bb8bb5e 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -669,6 +669,45 @@ int ast_autoservice_start(struct ast_channel *chan);
/*! Stop servicing a channel for us... Returns -1 on error or if channel has been hungup */
int ast_autoservice_stop(struct ast_channel *chan);
+/* Misc. functions below */
+
+//! Waits for activity on a group of channels
+/*!
+ * \param nfds the maximum number of file descriptors in the sets
+ * \param rfds file descriptors to check for read availability
+ * \param wfds file descriptors to check for write availability
+ * \param efds file descriptors to check for exceptions (OOB data)
+ * \param tvp timeout while waiting for events
+ * This is the same as a standard select(), except it guarantees the
+ * behaviour where the passed struct timeval is updated with how much
+ * time was not slept while waiting for the specified events
+ */
+static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tvp)
+{
+#ifdef __linux__
+ return select(nfds, rfds, wfds, efds, tvp);
+#else
+ if (tvp) {
+ struct timeval tv, tvstart, tvend, tvlen;
+ int res;
+
+ tv = *tvp;
+ gettimeofday(&tvstart, NULL);
+ res = select(nfds, rfds, wfds, efds, tvp);
+ gettimeofday(&tvend, NULL);
+ timersub(&tvend, &tvstart, &tvlen);
+ timersub(&tv, &tvlen, tvp);
+ if (tvp->tv_sec < 0 || (tvp->tv_sec == 0 && tvp->tv_usec < 0)) {
+ tvp->tv_sec = 0;
+ tvp->tv_usec = 0;
+ }
+ return res;
+ }
+ else
+ return(nfds, rfds, wfds, efds, NULL);
+#endif
+}
+
#ifdef DO_CRASH
#define CRASH do { fprintf(stderr, "!! Forcing immediate crash a-la abort !!\n"); *((int *)0) = 0; } while(0)
#else
diff --git a/manager.c b/manager.c
index 5195beeb3..3a2754d38 100755
--- a/manager.c
+++ b/manager.c
@@ -539,7 +539,7 @@ static int get_input(struct mansession *s, char *output)
}
FD_ZERO(&fds);
FD_SET(s->fd, &fds);
- res = select(s->fd + 1, &fds, NULL, NULL, NULL);
+ res = ast_select(s->fd + 1, &fds, NULL, NULL, NULL);
if (res < 0) {
ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
} else if (res > 0) {
diff --git a/pbx/Makefile b/pbx/Makefile
index ee9cc01df..27d355419 100755
--- a/pbx/Makefile
+++ b/pbx/Makefile
@@ -27,7 +27,7 @@ GTK_LIBS=`gtk-config --libs gthread`
MOC=$(QTDIR)/bin/moc
KDE_FLAGS=-I$(KDEDIR)/include -I$(KDEDIR)/include/kde -I$(QTDIR)/include
KDE_LIBS=-L$(KDEDIR)/lib -L$(QTDIR)/lib -lqt -lkdecore -lkdeui
-CFLAGS+=
+CFLAGS+=-fPIC
KDE_CONSOLE_OBJS=pbx_kdeconsole_main.o pbx_kdeconsole.o
diff --git a/res/Makefile b/res/Makefile
index b0967f828..e5f6d7c37 100755
--- a/res/Makefile
+++ b/res/Makefile
@@ -20,7 +20,7 @@ CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo " -DZAPATA_MOH")
#
# Work around buggy RedHat 9.0
#
-CFLAGS+=-DOPENSSL_NO_KRB5
+CFLAGS+=-DOPENSSL_NO_KRB5 -fPIC
all: $(MODS)
diff --git a/res/res_parking.c b/res/res_parking.c
index dc13af024..4ffbc5166 100755
--- a/res/res_parking.c
+++ b/res/res_parking.c
@@ -443,7 +443,7 @@ std: for (x=0;x<AST_MAX_FDS;x++) {
tv.tv_sec = ms / 1000;
tv.tv_usec = (ms % 1000) * 1000;
/* Wait for something to happen */
- select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
+ ast_select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
pthread_testcancel();
}
return NULL; /* Never reached */