summaryrefslogtreecommitdiffstats
path: root/lib/libc/iconv/citrus_lock.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2013-07-01 08:06:26 +0000
committerpeter <peter@FreeBSD.org>2013-07-01 08:06:26 +0000
commitc77016ccdaf40ab136d3fd9db47a6aad98135ae6 (patch)
tree6ccd193339a06c80e18d73d20490bedc798e225c /lib/libc/iconv/citrus_lock.h
parent75dee8bb5ae9162b5536e80ab4be44936ed4b65a (diff)
downloadFreeBSD-src-c77016ccdaf40ab136d3fd9db47a6aad98135ae6.zip
FreeBSD-src-c77016ccdaf40ab136d3fd9db47a6aad98135ae6.tar.gz
__weak_alias() doesn't exist on FreeBSD. Use __weak_reference();
Expose iconv functions as weak symbols as well as their internal remapped #define names. This is necessary for autoconf compatability - on Linux it appears that #include <iconv.h> isn't a link time prerequisite for their version that's built into glibc. Initialize the pthread rwlock. Note that upstream has three separate locks. The file-local static lock appears intentional. I'm using this as a ports-compatible compile-time substitute for converters/libiconv on one of my personal machines.
Diffstat (limited to 'lib/libc/iconv/citrus_lock.h')
-rw-r--r--lib/libc/iconv/citrus_lock.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/iconv/citrus_lock.h b/lib/libc/iconv/citrus_lock.h
index ad9443a..d275d55 100644
--- a/lib/libc/iconv/citrus_lock.h
+++ b/lib/libc/iconv/citrus_lock.h
@@ -27,7 +27,8 @@
#include <pthread.h>
-static pthread_rwlock_t lock;
+/* XXX Yes, the original code has three separate file-local lock instances */
+static pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
#define WLOCK if (__isthreaded) \
pthread_rwlock_wrlock(&lock);
OpenPOWER on IntegriCloud