[asterisk-commits] branch jcollie/bug6082 r27187 - in /team/jcollie/bug6082: ./ apps/ build_tool...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon May 15 09:32:27 MST 2006


Author: jcollie
Date: Mon May 15 08:24:10 2006
New Revision: 27187

URL: http://svn.digium.com/view/asterisk?rev=27187&view=rev
Log:
Merged revisions 27094,27128-27130,27153 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r27094 | tilghman | 2006-05-12 23:18:25 -0500 (Fri, 12 May 2006) | 10 lines

Merged revisions 27093 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r27093 | tilghman | 2006-05-12 23:08:29 -0500 (Fri, 12 May 2006) | 2 lines

Bug 7134 - File descriptor leak with ODBC storage of voicemail

........

................
r27128 | russell | 2006-05-13 05:37:26 -0500 (Sat, 13 May 2006) | 4 lines

remove unnecessary INCLUDE variable which was currently added to ASTCFLAGS
before it was ever set.  This removes another stray space in the gcc
commands  :)

................
r27129 | russell | 2006-05-13 05:43:11 -0500 (Sat, 13 May 2006) | 2 lines

remove some stuff handled by configure and menuselect

................
r27130 | russell | 2006-05-13 05:54:40 -0500 (Sat, 13 May 2006) | 3 lines

Move WITH_SMDI from the Makefiles to be handled by menuselect. It will now be
defined in buildopts.h. Also, remove a few more stray spaces in the gcc commands. 

................
r27153 | russell | 2006-05-13 06:06:34 -0500 (Sat, 13 May 2006) | 2 lines

simplify conference user list handling

................

Modified:
    team/jcollie/bug6082/   (props changed)
    team/jcollie/bug6082/Makefile
    team/jcollie/bug6082/apps/Makefile
    team/jcollie/bug6082/apps/app_meetme.c
    team/jcollie/bug6082/apps/app_voicemail.c
    team/jcollie/bug6082/build_tools/cflags.xml
    team/jcollie/bug6082/channels/Makefile
    team/jcollie/bug6082/include/asterisk/linkedlists.h

Propchange: team/jcollie/bug6082/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/jcollie/bug6082/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/jcollie/bug6082/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/jcollie/bug6082/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May 15 08:24:10 2006
@@ -1,1 +1,1 @@
-/trunk:1-27087
+/trunk:1-27186

Modified: team/jcollie/bug6082/Makefile
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/Makefile?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/Makefile (original)
+++ team/jcollie/bug6082/Makefile Mon May 15 08:24:10 2006
@@ -24,18 +24,6 @@
 #CROSS_PROC=arm
 #SUB_PROC=xscale # or maverick
 
-# Pentium Pro Optimize
-#PROC=i686
-
-# Pentium & VIA processors optimize
-#PROC=i586
-
-#PROC=k6
-#PROC=ppc
-
-CC=$(CROSS_COMPILE)gcc
-HOST_CC=gcc
-
 ifeq ($(CROSS_COMPILE),)
   OSARCH=$(shell uname -s)
   PROC?=$(shell uname -m)
@@ -70,26 +58,6 @@
 
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g3
-
-# Set NOCRYPTO to yes if you do not want to have crypto support or dependencies
-#NOCRYPTO=yes
-
-# If you are running a radio application, define RADIO_RELAX so that the DTMF
-# will be received more reliably
-#OPTIONS += -DRADIO_RELAX
-
-# If you don't have a lot of memory (e.g. embedded Asterisk), define LOW_MEMORY
-# to reduce the size of certain static buffers
-#ifneq ($(CROSS_COMPILE),)
-#OPTIONS += -DLOW_MEMORY
-#endif
-
-# Asterisk SMDI integration
-WITH_SMDI=1
-
-# Where to install asterisk after compiling
-# Default -> leave empty
-INSTALL_PREFIX?=
 
 # Staging directory
 # Files are copied here temporarily during the install process
@@ -241,7 +209,7 @@
   ID=/usr/xpg4/bin/id
 endif
 
-ASTCFLAGS+=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE)
+ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 ASTCFLAGS+=$(OPTIMIZE)
 
 ifeq ($(AST_DEVMODE),yes)
@@ -276,8 +244,7 @@
 endif # FreeBSD
 
 ifeq ($(OSARCH),NetBSD)
-  ASTCFLAGS+=-pthread
-  INCLUDE+=-I$(CROSS_COMPILE_TARGET)/usr/pkg/include
+  AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
   MPG123TARG=netbsd
 endif
 
@@ -286,8 +253,7 @@
 endif
 
 ifeq ($(OSARCH),SunOS)
-  ASTCFLAGS+=-Wcast-align -DSOLARIS
-  INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
+  ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
 endif
 
 LIBEDIT=editline/libedit.a
@@ -314,7 +280,7 @@
 
 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
 ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),)
-ASTCFLAGS+=-fomit-frame-pointer 
+ASTCFLAGS+=-fomit-frame-pointer
 endif
 
 MOD_SUBDIRS=res channels pbx apps codecs formats cdr funcs
@@ -396,7 +362,7 @@
 endif
 
 ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
-  CFLAGS+=$(TOPDIR_CFLAGS) $(ASTCFLAGS)
+  CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
 endif
 
 # This is used when generating the doxygen documentation
@@ -518,7 +484,7 @@
 	@rm -f $@.tmp
 
 stdtime/libtime.a:
-	CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
+	CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C stdtime libtime.a
 
 asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
 	build_tools/make_build_h > include/asterisk/build.h.tmp
@@ -533,9 +499,9 @@
 	$(CC) $(AUDIO_LIBS) -o muted muted.o
 
 subdirs: 
-	@for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C $$x || exit 1 ; done
-	@CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C utils
-	@CFLAGS="$(OTHER_SUBDIR_CFLAGS) $(ASTCFLAGS)" $(MAKE) -C agi
+	@for x in $(MOD_SUBDIRS); do CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $$x || exit 1 ; done
+	@CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C utils
+	@CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C agi
 
 clean-depend:
 	@for x in $(SUBDIRS); do $(MAKE) -C $$x clean-depend || exit 1 ; done

Modified: team/jcollie/bug6082/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/apps/Makefile?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/apps/Makefile (original)
+++ team/jcollie/bug6082/apps/Makefile Mon May 15 08:24:10 2006
@@ -12,10 +12,6 @@
 #
 
 MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%.so,$(wildcard app_*.c)))
-
-ifneq ($(WITH_SMDI),)
-  CFLAGS+=-DWITH_SMDI
-endif
 
 # If you have UnixODBC you can use ODBC voicemail
 # storage

Modified: team/jcollie/bug6082/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/apps/app_meetme.c?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/apps/app_meetme.c (original)
+++ team/jcollie/bug6082/apps/app_meetme.c Mon May 15 08:24:10 2006
@@ -152,8 +152,6 @@
 	int zapconf;				/* Zaptel Conf # */
 	int users;				/* Number of active users */
 	int markedusers;			/* Number of marked users */
-	struct ast_conf_user *firstuser;	/* Pointer to the first user struct */
-	struct ast_conf_user *lastuser;		/* Pointer to the last user struct */
 	time_t start;				/* Start time (s) */
 	int refcount;				/* reference count of usage */
 	unsigned int recording:2;				/* recording status */
@@ -168,6 +166,7 @@
 	struct ast_frame *transframe[32];
 	struct ast_frame *origframe;
 	struct ast_trans_pvt *transpath[32];
+	AST_LIST_HEAD_NOLOCK(, ast_conf_user) userlist;
 	AST_LIST_ENTRY(ast_conference) list;
 };
 
@@ -180,8 +179,6 @@
 
 struct ast_conf_user {
 	int user_no;				/* User Number */
-	struct ast_conf_user *prevuser;		/* Pointer to the previous user */
-	struct ast_conf_user *nextuser;		/* Pointer to the next user */
 	int userflags;				/* Flags as set in the conference */
 	int adminflags;				/* Flags set by the Admin */
 	struct ast_channel *chan;		/* Connected channel */
@@ -192,6 +189,7 @@
 	time_t jointime;			/* Time the user joined the conference */
 	struct volume talk;
 	struct volume listen;
+	AST_LIST_ENTRY(ast_conf_user) list;
 };
 
 static int audio_buffers;			/* The number of audio buffers to be allocated on pseudo channels
@@ -532,9 +530,6 @@
 			cnf->start = time(NULL);
 			cnf->zapconf = ztc.confno;
 			cnf->isdynamic = dynamic ? 1 : 0;
-			cnf->firstuser = NULL;
-			cnf->lastuser = NULL;
-			cnf->locked = 0;
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
 			AST_LIST_INSERT_HEAD(&confs, cnf, list);
@@ -665,7 +660,7 @@
 			return RESULT_SUCCESS;
 		}
 		/* Show all the users */
-		for (user = cnf->firstuser; user; user = user->nextuser){
+		AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
 			now = time(NULL);
 			hr = (now - user->jointime) / 3600;
 			min = ((now - user->jointime) % 3600) / 60;
@@ -751,7 +746,7 @@
 
 			if (cnf) {
 				/* Search for the user */
-				for (usr = cnf->firstuser; usr; usr = usr->nextuser) {
+				AST_LIST_TRAVERSE(&cnf->userlist, usr, list) {
 					snprintf(usrno, sizeof(usrno), "%d", usr->user_no);
 					if (!strncasecmp(word, usrno, len) && ++which > state)
 						break;
@@ -928,24 +923,13 @@
 		conf->markedusers++;
       
    	ast_mutex_lock(&conf->playlock);
-	if (!conf->firstuser) {
-		/* Fill the first new User struct */
+
+	if (AST_LIST_EMPTY(&conf->userlist))
 		user->user_no = 1;
-		conf->firstuser = user;
-		conf->lastuser = user;
-	} else {
-		/* Fill the new user struct */	
-		user->user_no = conf->lastuser->user_no + 1; 
-		user->prevuser = conf->lastuser;
-		if (conf->lastuser->nextuser) {
-			ast_log(LOG_WARNING, "Error in User Management!\n");
-			ast_mutex_unlock(&conf->playlock);
-			goto outrun;
-		} else {
-			conf->lastuser->nextuser = user;
-			conf->lastuser = user;
-		}
-	}
+	else
+		user->user_no = AST_LIST_LAST(&conf->userlist)->user_no + 1;
+
+	AST_LIST_INSERT_TAIL(&conf->userlist, user, list);
 
 	user->chan = chan;
 	user->userflags = confflags;
@@ -1480,7 +1464,7 @@
 								break;
 							case '3': /* Eject last user */
 								menu_active = 0;
-								usr = conf->lastuser;
+								usr = AST_LIST_LAST(&conf->userlist);
 								if ((usr->chan->name == chan->name)||(usr->userflags & CONFFLAG_ADMIN)) {
 									if(!ast_streamfile(chan, "conf-errormenu", chan->language))
 										ast_waitstream(chan, "");
@@ -1711,39 +1695,12 @@
 		ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
 		if (confflags & CONFFLAG_MARKEDUSER) 
 			conf->markedusers--;
-		if (!conf->users) {
+		if (AST_LIST_EMPTY(&conf->userlist)) {
 			/* close this one when no more users and no references*/
-			if (!conf->refcount){
+			if (!conf->refcount)
 				conf_free(conf);
-			}
 		} else {
-			/* Remove the user struct */ 
-			if (user == conf->firstuser) {
-				if (user->nextuser) {
-					/* There is another entry */
-					user->nextuser->prevuser = NULL;
-				} else {
-					/* We are the only entry */
-					conf->lastuser = NULL;
-				}
-				/* In either case */
-				conf->firstuser = user->nextuser;
-			} else if (user == conf->lastuser){
-				if (user->prevuser)
-					user->prevuser->nextuser = NULL;
-				else
-					ast_log(LOG_ERROR, "Bad bad bad!  We're the last, not the first, but nobody before us??\n");
-				conf->lastuser = user->prevuser;
-			} else {
-				if (user->nextuser)
-					user->nextuser->prevuser = user->prevuser;
-				else
-					ast_log(LOG_ERROR, "Bad! Bad! Bad! user->nextuser is NULL but we're not the end!\n");
-				if (user->prevuser)
-					user->prevuser->nextuser = user->nextuser;
-				else
-					ast_log(LOG_ERROR, "Bad! Bad! Bad! user->prevuser is NULL but we're not the beginning!\n");
-			}
+			AST_LIST_REMOVE(&conf->userlist, user, list);
 		}
 		/* Return the number of seconds the user was in the conf */
 		snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));
@@ -2221,18 +2178,16 @@
 	return res;
 }
 
-static struct ast_conf_user* find_user(struct ast_conference *conf, char *callerident) 
+static struct ast_conf_user *find_user(struct ast_conference *conf, char *callerident) 
 {
 	struct ast_conf_user *user = NULL;
 	int cid;
 	
 	sscanf(callerident, "%i", &cid);
 	if (conf && callerident) {
-		user = conf->firstuser;
-		while (user) {
+		AST_LIST_TRAVERSE(&conf->userlist, user, list) {
 			if (cid == user->user_no)
 				return user;
-			user = user->nextuser;
 		}
 	}
 	return NULL;
@@ -2282,23 +2237,15 @@
 			case 108: /* l: Unlock */ 
 				cnf->locked = 0;
 				break;
-			case 75: /* K: kick all users*/
-				user = cnf->firstuser;
-				while(user) {
+			case 75: /* K: kick all users */
+				AST_LIST_TRAVERSE(&cnf->userlist, user, list)
 					user->adminflags |= ADMINFLAG_KICKME;
-					if (user->nextuser) {
-						user = user->nextuser;
-					} else {
-						break;
-					}
-				}
 				break;
 			case 101: /* e: Eject last user*/
-				user = cnf->lastuser;
-				if (!(user->userflags & CONFFLAG_ADMIN)) {
+				user = AST_LIST_LAST(&cnf->userlist);
+				if (!(user->userflags & CONFFLAG_ADMIN))
 					user->adminflags |= ADMINFLAG_KICKME;
-					break;
-				} else
+				else
 					ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n");
 				break;
 			case 77: /* M: Mute */ 
@@ -2314,15 +2261,9 @@
 				}
 				break;
 			case 78: /* N: Mute all users */
-				user = cnf->firstuser;
-				while(user) {
-					if (user && !(user->userflags & CONFFLAG_ADMIN))
+				AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
+					if (!(user->userflags & CONFFLAG_ADMIN))
 						user->adminflags |= ADMINFLAG_MUTED;
-					if (user->nextuser) {
-						user = user->nextuser;
-					} else {
-						break;
-					}
 				}
 				break;					
 			case 109: /* m: Unmute */ 
@@ -2337,25 +2278,15 @@
 					ast_log(LOG_NOTICE, "Specified User not found or he muted himself!\n");
 				}
 				break;
-			case  110: /* n: Unmute all users */
-				user = cnf->firstuser;
-				while(user) {
-					if (user && (user-> adminflags & ADMINFLAG_MUTED)) {
-						user->adminflags ^= ADMINFLAG_MUTED;
-					}
-					if (user->nextuser) {
-						user = user->nextuser;
-					} else {
-						break;
-					}
-				}
+			case 110: /* n: Unmute all users */
+				AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+					user->adminflags &= ~ADMINFLAG_MUTED;
 				break;
 			case 107: /* k: Kick user */ 
-				if (user) {
+				if (user)
 					user->adminflags |= ADMINFLAG_KICKME;
-				} else {
+				else
 					ast_log(LOG_NOTICE, "Specified User not found!");
-				}
 				break;
 			}
 		} else {

Modified: team/jcollie/bug6082/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/apps/app_voicemail.c?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/apps/app_voicemail.c (original)
+++ team/jcollie/bug6082/apps/app_voicemail.c Mon May 15 08:24:10 2006
@@ -919,7 +919,7 @@
 			odbc_release_obj(obj);
 			goto yuck;
 		}
-		fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC);
+		fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, 0770);
 		if (fd < 0) {
 			ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
 			SQLFreeHandle (SQL_HANDLE_STMT, stmt);
@@ -949,13 +949,13 @@
 			if (!strcasecmp(coltitle, "recording")) {
 				res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize);
 				fdlen = colsize;
-				fd = open(full_fn, O_RDWR | O_TRUNC | O_CREAT, 0770);
 				if (fd > -1) {
 					char tmp[1]="";
 					lseek(fd, fdlen - 1, SEEK_SET);
 					if (write(fd, tmp, 1) != 1) {
 						close(fd);
 						fd = -1;
+						continue;
 					}
 					if (fd > -1)
 						fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);

Modified: team/jcollie/bug6082/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/build_tools/cflags.xml?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/build_tools/cflags.xml (original)
+++ team/jcollie/bug6082/build_tools/cflags.xml Mon May 15 08:24:10 2006
@@ -11,10 +11,13 @@
 		</member>
 		<member name="MALLOC_DEBUG" displayname="Keep Track of Memory Allocations">
 		</member>
+		<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
+		</member>
 		<member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications">
 		</member>
 		<member name="TRACE_FRAMES" displayname="Trace Frame Allocations">
 		</member>
-		<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
+		<member name="WITH_SMDI" displayname="Include SMDI Support">
+			<defaultenabled>yes</defaultenabled>
 		</member>
 	</category>

Modified: team/jcollie/bug6082/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/channels/Makefile?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/channels/Makefile (original)
+++ team/jcollie/bug6082/channels/Makefile Mon May 15 08:24:10 2006
@@ -42,10 +42,6 @@
 
 ifeq ($(OSARCH),SunOS)
   SOLINK+=-lrt
-endif
-
-ifeq ($(WITH_SMDI),1)
-  CFLAGS+=-DWITH_SMDI
 endif
 
 ifeq ($(wildcard h323/libchanh323.a),)

Modified: team/jcollie/bug6082/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/jcollie/bug6082/include/asterisk/linkedlists.h?rev=27187&r1=27186&r2=27187&view=diff
==============================================================================
--- team/jcollie/bug6082/include/asterisk/linkedlists.h (original)
+++ team/jcollie/bug6082/include/asterisk/linkedlists.h Mon May 15 08:24:10 2006
@@ -208,6 +208,12 @@
 #define	AST_LIST_FIRST(head)	((head)->first)
 
 /*!
+  \brief Returns the last entry contained in a list.
+  \param head This is a pointer to the list tail structure
+ */
+#define	AST_LIST_LAST(head)	((head)->last)
+
+/*!
   \brief Returns the next entry in the list after the given entry.
   \param elm This is a pointer to the current entry.
   \param field This is the name of the field (declared using AST_LIST_ENTRY())



More information about the asterisk-commits mailing list