]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fixup compile on cygwin, more portable openssl thread id.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 16 Mar 2015 10:51:32 +0000 (10:51 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 16 Mar 2015 10:51:32 +0000 (10:51 +0000)
git-svn-id: file:///svn/unbound/trunk@3362 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/log.c
util/log.h
util/net_help.c

index 733affe92330e7ab3240164e844c75422f0f3f97..14f0d9f40f600f0a2f58ef222bebaeaa3d60aa60 100644 (file)
@@ -1,3 +1,6 @@
+16 March 2015: Wouter
+       - Fixup compile on cygwin, more portable openssl thread id.
+
 12 March 2015: Wouter
        - Updated default keylength in unbound-control-setup to 3k.
 
index f90efa71c75f2a922e6cdcbd3b5bedd3889b4aa8..3bf31ef3a695a060a43f6c3c194c5eefb393389e 100644 (file)
@@ -164,6 +164,14 @@ void log_thread_set(int* num)
        ub_thread_key_set(logkey, num);
 }
 
+int log_thread_get(void)
+{
+       unsigned int* tid;
+       if(!key_created) return 0;
+       tid = (unsigned int*)ub_thread_key_get(logkey);
+       return (int)(tid?*tid:0);
+}
+
 void log_ident_set(const char* id)
 {
        ident = id;
index ea283da7b2626facb634d3705965a20a3746e1a5..8e85ee620b18c1d413aa9bb244d90d8834d8b49f 100644 (file)
@@ -97,6 +97,15 @@ void log_file(FILE *f);
  */
 void log_thread_set(int* num);
 
+/**
+ * Get the thread id from logging system.  Set after log_init is
+ * initialised, or log_thread_set for newly created threads.
+ * This initialisation happens in unbound as a daemon, in daemon
+ * startup code, when that spawns threads.
+ * @return thread number, from 0 and up.  Before initialised, returns 0.
+ */
+int log_thread_get(void);
+
 /**
  * Set identity to print, default is 'unbound'. 
  * @param id: string to print. Name of executable.
index e2b7c38783ab7faed4381b78aa6e6236f7300587..af70b160956004f1e05d953897c9072c5e5a51af 100644 (file)
@@ -770,7 +770,7 @@ static lock_basic_t *ub_openssl_locks = NULL;
 static unsigned long
 ub_crypto_id_cb(void)
 {
-       return (unsigned long)ub_thread_self();
+       return log_thread_get();
 }
 
 static void