|
|
bb9b5b |
diff --git a/util/log.c b/util/log.c
|
|
|
bb9b5b |
index 75a58f9..43dd572 100644
|
|
|
bb9b5b |
--- a/util/log.c
|
|
|
bb9b5b |
+++ b/util/log.c
|
|
|
bb9b5b |
@@ -70,7 +70,7 @@ static int key_created = 0;
|
|
|
bb9b5b |
static ub_thread_key_type logkey;
|
|
|
bb9b5b |
#ifndef THREADS_DISABLED
|
|
|
bb9b5b |
/** pthread mutex to protect FILE* */
|
|
|
bb9b5b |
-static lock_quick_type log_lock;
|
|
|
bb9b5b |
+static lock_basic_type log_lock;
|
|
|
bb9b5b |
#endif
|
|
|
bb9b5b |
/** the identity of this executable/process */
|
|
|
bb9b5b |
static const char* ident="unbound";
|
|
|
bb9b5b |
@@ -90,18 +90,18 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
|
|
|
bb9b5b |
if(!key_created) {
|
|
|
bb9b5b |
key_created = 1;
|
|
|
bb9b5b |
ub_thread_key_create(&logkey, NULL);
|
|
|
bb9b5b |
- lock_quick_init(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_init(&log_lock);
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
- lock_quick_lock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_lock(&log_lock);
|
|
|
bb9b5b |
if(logfile
|
|
|
bb9b5b |
#if defined(HAVE_SYSLOG_H) || defined(UB_ON_WINDOWS)
|
|
|
bb9b5b |
|| logging_to_syslog
|
|
|
bb9b5b |
#endif
|
|
|
bb9b5b |
) {
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock); /* verbose() needs the lock */
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock); /* verbose() needs the lock */
|
|
|
bb9b5b |
verbose(VERB_QUERY, "switching log to %s",
|
|
|
bb9b5b |
use_syslog?"syslog":(filename&&filename[0]?filename:"stderr"));
|
|
|
bb9b5b |
- lock_quick_lock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_lock(&log_lock);
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
if(logfile && logfile != stderr) {
|
|
|
bb9b5b |
FILE* cl = logfile;
|
|
|
bb9b5b |
@@ -119,7 +119,7 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
|
|
|
bb9b5b |
* chroot and no longer be able to access dev/log and so on */
|
|
|
bb9b5b |
openlog(ident, LOG_NDELAY, LOG_DAEMON);
|
|
|
bb9b5b |
logging_to_syslog = 1;
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
return;
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
#elif defined(UB_ON_WINDOWS)
|
|
|
bb9b5b |
@@ -128,13 +128,13 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
if(use_syslog) {
|
|
|
bb9b5b |
logging_to_syslog = 1;
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
return;
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
#endif /* HAVE_SYSLOG_H */
|
|
|
bb9b5b |
if(!filename || !filename[0]) {
|
|
|
bb9b5b |
logfile = stderr;
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
return;
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
/* open the file for logging */
|
|
|
bb9b5b |
@@ -143,7 +143,7 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
|
|
|
bb9b5b |
filename += strlen(chrootdir);
|
|
|
bb9b5b |
f = fopen(filename, "a");
|
|
|
bb9b5b |
if(!f) {
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
log_err("Could not open logfile %s: %s", filename,
|
|
|
bb9b5b |
strerror(errno));
|
|
|
bb9b5b |
return;
|
|
|
bb9b5b |
@@ -153,14 +153,14 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
|
|
|
bb9b5b |
setvbuf(f, NULL, (int)_IOLBF, 0);
|
|
|
bb9b5b |
#endif
|
|
|
bb9b5b |
logfile = f;
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
|
|
|
bb9b5b |
void log_file(FILE *f)
|
|
|
bb9b5b |
{
|
|
|
bb9b5b |
- lock_quick_lock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_lock(&log_lock);
|
|
|
bb9b5b |
logfile = f;
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
|
|
|
bb9b5b |
void log_thread_set(int* num)
|
|
|
bb9b5b |
@@ -250,9 +250,9 @@ log_vmsg(int pri, const char* type,
|
|
|
bb9b5b |
return;
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
#endif /* HAVE_SYSLOG_H */
|
|
|
bb9b5b |
- lock_quick_lock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_lock(&log_lock);
|
|
|
bb9b5b |
if(!logfile) {
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
return;
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
if(log_now)
|
|
|
bb9b5b |
@@ -279,7 +279,7 @@ log_vmsg(int pri, const char* type,
|
|
|
bb9b5b |
/* line buffering does not work on windows */
|
|
|
bb9b5b |
fflush(logfile);
|
|
|
bb9b5b |
#endif
|
|
|
bb9b5b |
- lock_quick_unlock(&log_lock);
|
|
|
bb9b5b |
+ lock_basic_unlock(&log_lock);
|
|
|
bb9b5b |
}
|
|
|
bb9b5b |
|
|
|
bb9b5b |
/**
|