summaryrefslogtreecommitdiffstats
path: root/include/dlfcn.h
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1999-12-27 04:44:04 +0000
committerjdp <jdp@FreeBSD.org>1999-12-27 04:44:04 +0000
commit52ec4df9e85a6ae74cd9f5cf905ae35c0c1a6670 (patch)
treee4e05bba4c3de19150902d099920062a8bdb21ab /include/dlfcn.h
parentefacb21bbc4c5e4ae5ef661233ee6249ee8a0e7f (diff)
downloadFreeBSD-src-52ec4df9e85a6ae74cd9f5cf905ae35c0c1a6670.zip
FreeBSD-src-52ec4df9e85a6ae74cd9f5cf905ae35c0c1a6670.tar.gz
Add a new function dllockinit() for registering thread locking
functions to be used by the dynamic linker. This can be called by threads packages at start-up time. I will add the call to libc_r soon. Also add a default locking method that is used up until dllockinit() is called. The default method works by blocking SIGVTALRM, SIGPROF, and SIGALRM in critical sections. It is based on the observation that most user-space threads packages implement thread preemption with one of these signals (usually SIGVTALRM). The dynamic linker has never been reentrant, but it became less reentrant in revision 1.34 of "src/libexec/rtld-elf/rtld.c". Starting with that revision, multiple threads each doing lazy binding could interfere with each other. The usual symptom was that a symbol was falsely reported as undefined at start-up time. It was rare but not unseen. This commit fixes it.
Diffstat (limited to 'include/dlfcn.h')
-rw-r--r--include/dlfcn.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 9990e6e..09edf2d 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -66,6 +66,13 @@ __BEGIN_DECLS
int dladdr __P((const void *, Dl_info *));
int dlclose __P((void *));
const char *dlerror __P((void));
+void dllockinit __P((void *_context,
+ void *(*_lock_create)(void *_context),
+ void (*_rlock_acquire)(void *_lock),
+ void (*_wlock_acquire)(void *_lock),
+ void (*_lock_release)(void *_lock),
+ void (*_lock_destroy)(void *_lock),
+ void (*_context_destroy)(void *_context)));
void *dlopen __P((const char *, int));
void *dlsym __P((void *, const char *));
__END_DECLS
OpenPOWER on IntegriCloud