[Asterisk-cvs] asterisk acl.c,1.21,1.22 asterisk.c,1.88,1.89 astmm.c,1.9,1.10 autoservice.c,1.4,1.5 cdr.c,1.13,1.14 channel.c,1.117,1.118 cli.c,1.40,1.41 db.c,1.7,1.8 dns.c,1.8,1.9 enum.c,1.17,1.18 file.c,1.41,1.42 frame.c,1.32,1.33 image.c,1.8,1.9 indications.c,1.15,1.16 loader.c,1.21,1.22 logger.c,1.36,1.37 manager.c,1.54,1.55 pbx.c,1.123,1.124 translate.c,1.24,1.25 utils.c,1.5,1.6

markster at lists.digium.com markster at lists.digium.com
Tue Jun 8 20:42:07 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv11896

Modified Files:
	acl.c asterisk.c astmm.c autoservice.c cdr.c channel.c cli.c 
	db.c dns.c enum.c file.c frame.c image.c indications.c 
	loader.c logger.c manager.c pbx.c translate.c utils.c 
Log Message:
Merge FreeBSD locking fixes (bug #1411)


Index: acl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/acl.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- acl.c	27 May 2004 21:31:25 -0000	1.21
+++ acl.c	9 Jun 2004 01:45:07 -0000	1.22
@@ -34,7 +34,7 @@
 #include <fcntl.h>
 #include <net/route.h>
 
-static ast_mutex_t routeseq_lock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(routeseq_lock);
 #endif
 
 

Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- asterisk.c	31 May 2004 16:43:35 -0000	1.88
+++ asterisk.c	9 Jun 2004 01:45:07 -0000	1.89
@@ -83,7 +83,7 @@
 	void (*func)(void);
 	struct ast_atexit *next;
 } *atexits = NULL;
-static ast_mutex_t atexitslock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(atexitslock);
 
 time_t ast_startuptime;
 time_t ast_lastreloadtime;

Index: astmm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/astmm.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- astmm.c	14 Jan 2004 06:35:00 -0000	1.9
+++ astmm.c	9 Jun 2004 01:45:07 -0000	1.10
@@ -58,8 +58,8 @@
 #define HASH(a) \
 	(((unsigned long)(a)) % SOME_PRIME)
 	
-static ast_mutex_t reglock = AST_MUTEX_INITIALIZER;
-static ast_mutex_t showmemorylock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(reglock);
+AST_MUTEX_DEFINE_STATIC(showmemorylock);
 
 static inline void *__ast_alloc_region(size_t size, int which, const char *file, int lineno, const char *func)
 {

Index: autoservice.c
===================================================================
RCS file: /usr/cvsroot/asterisk/autoservice.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- autoservice.c	15 Mar 2004 07:51:22 -0000	1.4
+++ autoservice.c	9 Jun 2004 01:45:07 -0000	1.5
@@ -36,7 +36,7 @@
 
 #define MAX_AUTOMONS 256
 
-static ast_mutex_t autolock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(autolock);
 
 struct asent {
 	struct ast_channel *chan;

Index: cdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cdr.c	6 May 2004 20:21:06 -0000	1.13
+++ cdr.c	9 Jun 2004 01:45:07 -0000	1.14
@@ -30,7 +30,7 @@
 int ast_default_amaflags = AST_CDR_DOCUMENTATION;
 char ast_default_accountcode[20] = "";
 
-static ast_mutex_t cdrlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(cdrlock);
 
 static struct ast_cdr_beitem {
 	char name[20];

Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- channel.c	4 Jun 2004 15:44:14 -0000	1.117
+++ channel.c	9 Jun 2004 01:45:07 -0000	1.118
@@ -74,7 +74,7 @@
 /* Protect the channel list (highly unlikely that two things would change
    it at the same time, but still! */
    
-static ast_mutex_t chlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(chlock);
 
 int ast_check_hangup(struct ast_channel *chan)
 {

Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cli.c	28 May 2004 19:23:30 -0000	1.40
+++ cli.c	9 Jun 2004 01:45:07 -0000	1.41
@@ -46,8 +46,7 @@
 	free(stuff);
 }
 
-ast_mutex_t clilock = AST_MUTEX_INITIALIZER;
-
+AST_MUTEX_DEFINE_STATIC(clilock);
 
 struct ast_cli_entry *helpers = NULL;
 
@@ -157,7 +156,7 @@
 #define MODLIST_FORMAT  "%-25s %-40.40s %-10d\n"
 #define MODLIST_FORMAT2 "%-25s %-40.40s %-10s\n"
 
-static ast_mutex_t climodentrylock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(climodentrylock);
 static int climodentryfd = -1;
 
 static int modlist_modentry(char *module, char *description, int usecnt)

Index: db.c
===================================================================
RCS file: /usr/cvsroot/asterisk/db.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- db.c	28 May 2004 18:56:23 -0000	1.7
+++ db.c	9 Jun 2004 01:45:07 -0000	1.8
@@ -38,7 +38,7 @@
 #include "astconf.h"
 
 static DB *astdb;
-static ast_mutex_t dblock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(dblock);
 
 static int dbinit(void) 
 {

Index: dns.c
===================================================================
RCS file: /usr/cvsroot/asterisk/dns.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dns.c	31 May 2004 19:40:22 -0000	1.8
+++ dns.c	9 Jun 2004 01:45:07 -0000	1.9
@@ -154,7 +154,7 @@
 #if defined(res_ninit)
 #define HAS_RES_NINIT
 #else
-static ast_mutex_t res_lock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(res_lock);
 #if 0
 #warning "Warning, res_ninit is missing...  Could have reentrancy issues"
 #endif

Index: enum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/enum.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- enum.c	16 May 2004 18:12:15 -0000	1.17
+++ enum.c	9 Jun 2004 01:45:07 -0000	1.18
@@ -53,7 +53,7 @@
 
 static int enumver = 0;
 
-static ast_mutex_t enumlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(enumlock);
 
 struct naptr {
 	unsigned short order;

Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- file.c	6 May 2004 21:17:06 -0000	1.41
+++ file.c	9 Jun 2004 01:45:07 -0000	1.42
@@ -79,7 +79,7 @@
 	struct ast_channel *owner;
 };
 
-static ast_mutex_t formatlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(formatlock);
 
 static struct ast_format *formats = NULL;
 

Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- frame.c	19 May 2004 03:39:44 -0000	1.32
+++ frame.c	9 Jun 2004 01:45:07 -0000	1.33
@@ -29,7 +29,7 @@
 #ifdef TRACE_FRAMES
 static int headers = 0;
 static struct ast_frame *headerlist = NULL;
-static ast_mutex_t framelock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(framelock);
 #endif
 
 #define SMOOTHER_SIZE 8000

Index: image.c
===================================================================
RCS file: /usr/cvsroot/asterisk/image.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- image.c	21 Apr 2004 03:54:25 -0000	1.8
+++ image.c	9 Jun 2004 01:45:07 -0000	1.9
@@ -33,7 +33,7 @@
 #include "astconf.h"
 
 static struct ast_imager *list;
-static ast_mutex_t listlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(listlock);
 
 int ast_image_register(struct ast_imager *img)
 {

Index: indications.c
===================================================================
RCS file: /usr/cvsroot/asterisk/indications.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- indications.c	3 Jun 2004 17:06:33 -0000	1.15
+++ indications.c	9 Jun 2004 01:45:07 -0000	1.16
@@ -229,7 +229,7 @@
 
 /* Protect the tone_zones list (highly unlikely that two things would change
  * it at the same time, but still! */
-ast_mutex_t tzlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_EXPORTED(tzlock);
 
 /* Set global indication country */
 int ast_set_indication_country(const char *country)

Index: loader.c
===================================================================
RCS file: /usr/cvsroot/asterisk/loader.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- loader.c	29 Apr 2004 04:13:06 -0000	1.21
+++ loader.c	9 Jun 2004 01:45:07 -0000	1.22
@@ -98,8 +98,8 @@
 	struct loadupdate *next;
 } *updaters = NULL;
 
-static ast_mutex_t modlock = AST_MUTEX_INITIALIZER;
-static ast_mutex_t reloadlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(modlock);
+AST_MUTEX_DEFINE_STATIC(reloadlock);
 
 static struct module *module_list=NULL;
 

Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- logger.c	18 May 2004 05:47:27 -0000	1.36
+++ logger.c	9 Jun 2004 01:45:07 -0000	1.37
@@ -49,8 +49,8 @@
 #define MAX_MSG_QUEUE 200
 
 static char dateformat[256] = "%b %e %T";		/* Original Asterisk Format */
-static ast_mutex_t msglist_lock = AST_MUTEX_INITIALIZER;
-static ast_mutex_t loglock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(msglist_lock);
+AST_MUTEX_DEFINE_STATIC(loglock);
 static int pending_logger_reload = 0;
 
 static struct msglist {
@@ -228,7 +228,7 @@
 }
 
 static FILE *qlog = NULL;
-static ast_mutex_t qloglock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(qloglock);
 
 void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
 {

Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- manager.c	3 Jun 2004 15:42:36 -0000	1.54
+++ manager.c	9 Jun 2004 01:45:07 -0000	1.55
@@ -59,7 +59,7 @@
 static int portno = DEFAULT_MANAGER_PORT;
 static int asock = -1;
 static pthread_t t;
-static ast_mutex_t sessionlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(sessionlock);
 static int block_sockets = 0;
 
 static struct permalias {
@@ -78,7 +78,7 @@
 
 static struct mansession *sessions = NULL;
 static struct manager_action *first_action = NULL;
-static ast_mutex_t actionlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(actionlock);
 
 int ast_carefulwrite(int fd, char *s, int len, int timeoutms) 
 {

Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- pbx.c	26 May 2004 19:24:47 -0000	1.123
+++ pbx.c	9 Jun 2004 01:45:07 -0000	1.124
@@ -176,7 +176,7 @@
 void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value);
 char *pbx_builtin_getvar_helper(struct ast_channel *chan, char *name);
 
-static struct varshead globals = AST_LIST_HEAD_INITIALIZER(varshead);
+static struct varshead globals;
 
 static struct pbx_builtin {
 	char name[AST_MAX_APP];
@@ -362,18 +362,18 @@
 };
 
 /* Lock for the application list */
-static ast_mutex_t applock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(applock);
 static struct ast_context *contexts = NULL;
 /* Lock for the ast_context list */
-static ast_mutex_t conlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(conlock);
 static struct ast_app *apps = NULL;
 
 /* Lock for switches */
-static ast_mutex_t switchlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(switchlock);
 struct ast_switch *switches = NULL;
 
 /* Lock for extension state notifys */
-static ast_mutex_t hintlock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(hintlock);
 static int stateid = 1;
 struct ast_hint *hints = NULL;
 struct ast_state_cb *statecbs = NULL;
@@ -4654,6 +4654,7 @@
 		ast_verbose( "Asterisk PBX Core Initializing\n");
 		ast_verbose( "Registering builtin applications:\n");
 	}
+        AST_LIST_HEAD_INIT(&globals);
 	ast_cli_register(&show_applications_cli);
 	ast_cli_register(&show_application_cli);
 	ast_cli_register(&show_dialplan_cli);

Index: translate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/translate.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- translate.c	17 May 2004 22:59:27 -0000	1.24
+++ translate.c	9 Jun 2004 01:45:07 -0000	1.25
@@ -34,7 +34,7 @@
 /* This could all be done more efficiently *IF* we chained packets together
    by default, but it would also complicate virtually every application. */
    
-static ast_mutex_t list_lock = AST_MUTEX_INITIALIZER;
+AST_MUTEX_DEFINE_STATIC(list_lock);
 static struct ast_translator *list = NULL;
 
 struct ast_translator_dir {

Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- utils.c	31 May 2004 16:51:28 -0000	1.5
+++ utils.c	9 Jun 2004 01:45:07 -0000	1.6
@@ -20,13 +20,14 @@
 #define ERANGE 34
 #undef gethostbyname
 
+AST_MUTEX_DEFINE_STATIC(__mutex);
+
 int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
 			size_t buflen, struct hostent **result, 
 			int *h_errnop) 
 {
 	int hsave;
 	struct hostent *ph;
-	static ast_mutex_t __mutex = AST_MUTEX_INITIALIZER;
 	ast_mutex_lock(&__mutex); /* begin critical area */
 	hsave = h_errno;
 




More information about the svn-commits mailing list