aboutsummaryrefslogtreecommitdiff
path: root/src/util/et
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/et')
-rw-r--r--src/util/et/ChangeLog15
-rw-r--r--src/util/et/error_message.c9
-rw-r--r--src/util/et/et_h.awk2
-rw-r--r--src/util/et/et_h.pl2
4 files changed, 24 insertions, 4 deletions
diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog
index 9349834..bec7407 100644
--- a/src/util/et/ChangeLog
+++ b/src/util/et/ChangeLog
@@ -1,3 +1,18 @@
+2005-01-17 Jeffrey Altman <jaltman@mit.edu>
+
+ * error_message.c: implement library unload cleanup of mutexes
+
+2005-01-13 Ken Raeburn <raeburn@mit.edu>
+
+ * error_message.c (com_err_terminate): Lock the list mutex before
+ walking through it; unlock and destroy it afterwards.
+
+2004-11-05 Ken Raeburn <raeburn@mit.edu>
+
+ * et_h.awk: Declare initialize_*_error_table as taking no
+ arguments.
+ * et_h.pl: Regenerated.
+
2004-10-07 Tom Yu <tlyu@mit.edu>
* et_c.awk, et_h.awk: Fix off-by-one error.
diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c
index 42c2300..cb76b2a 100644
--- a/src/util/et/error_message.c
+++ b/src/util/et/error_message.c
@@ -37,6 +37,7 @@ extern const int sys_nerr;
/*@null@*/ static struct et_list * _et_list = (struct et_list *) NULL;
/*@null@*//*@only@*/static struct dynamic_et_list * et_list_dynamic;
static k5_mutex_t et_list_lock = K5_MUTEX_PARTIAL_INITIALIZER;
+static int terminated = 0; /* for debugging shlib fini sequence errors */
MAKE_INIT_FUNCTION(com_err_initialize);
MAKE_FINI_FUNCTION(com_err_terminate);
@@ -44,6 +45,7 @@ MAKE_FINI_FUNCTION(com_err_terminate);
int com_err_initialize(void)
{
int err;
+ terminated = 0;
err = k5_mutex_finish_init(&et_list_lock);
if (err)
return err;
@@ -56,17 +58,20 @@ int com_err_initialize(void)
return 0;
}
-static int terminated = 0; /* for debugging shlib fini sequence errors */
void com_err_terminate(void)
{
struct dynamic_et_list *e, *enext;
if (! INITIALIZER_RAN(com_err_initialize) || PROGRAM_EXITING())
return;
- k5_mutex_destroy(&et_list_lock);
+ k5_key_delete(K5_KEY_COM_ERR);
+ k5_mutex_destroy(&com_err_hook_lock);
+ k5_mutex_lock(&et_list_lock);
for (e = et_list_dynamic; e; e = enext) {
enext = e->next;
free(e);
}
+ k5_mutex_unlock(&et_list_lock);
+ k5_mutex_destroy(&et_list_lock);
terminated = 1;
}
diff --git a/src/util/et/et_h.awk b/src/util/et/et_h.awk
index e3d9fa4..65c6c45 100644
--- a/src/util/et/et_h.awk
+++ b/src/util/et/et_h.awk
@@ -155,7 +155,7 @@ END {
print "" > outfile
print "#if !defined(_WIN32)" > outfile
print "/* for compatibility with older versions... */" > outfile
- print "extern void initialize_" table_name "_error_table () /*@modifies internalState@*/;" > outfile
+ print "extern void initialize_" table_name "_error_table (void) /*@modifies internalState@*/;" > outfile
print "#else" > outfile
print "#define initialize_" table_name "_error_table()" > outfile
print "#endif" > outfile
diff --git a/src/util/et/et_h.pl b/src/util/et/et_h.pl
index e0965de..5ab8e8b 100644
--- a/src/util/et/et_h.pl
+++ b/src/util/et/et_h.pl
@@ -203,7 +203,7 @@ else {
&Pick('>', $outfile) &&
(print $fh 'extern void initialize_' . $table_name .
- '_error_table () /*@modifies internalState@*/;');
+ '_error_table (void) /*@modifies internalState@*/;');
&Pick('>', $outfile) &&
(print $fh '#else');
&Pick('>', $outfile) &&