diff options
author | jdp <jdp@FreeBSD.org> | 2000-01-09 21:13:48 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 2000-01-09 21:13:48 +0000 |
commit | 4baa442de26d9c9926ae2dca6af2e8aedbf1ce3f (patch) | |
tree | f3343da02a9a1e06ca8a7d9cd66683be2ce32b80 /libexec/rtld-elf/amd64 | |
parent | fe42017b7b8d828d2873029e711cac80e5026145 (diff) | |
download | FreeBSD-src-4baa442de26d9c9926ae2dca6af2e8aedbf1ce3f.zip FreeBSD-src-4baa442de26d9c9926ae2dca6af2e8aedbf1ce3f.tar.gz |
Revamp the mechanism for enumerating and calling shared objects'
init and fini functions. Now the code is very careful to hold no
locks when calling these functions. Thus the dynamic linker cannot
be re-entered with a lock already held.
Remove the tolerance for recursive locking that I added in revision
1.2 of dllockinit.c. Recursive locking shouldn't happen any more.
Mozilla and JDK users: I'd appreciate confirmation that things still
work right (or at least the same) with these changes.
Diffstat (limited to 'libexec/rtld-elf/amd64')
-rw-r--r-- | libexec/rtld-elf/amd64/lockdflt.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/libexec/rtld-elf/amd64/lockdflt.c b/libexec/rtld-elf/amd64/lockdflt.c index c926950..f9dbc5d 100644 --- a/libexec/rtld-elf/amd64/lockdflt.c +++ b/libexec/rtld-elf/amd64/lockdflt.c @@ -1,5 +1,5 @@ /*- - * Copyright 1999 John D. Polstra. + * Copyright 1999, 2000 John D. Polstra. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,11 +51,8 @@ void lockdflt_acquire(void *lock) { LockDflt *l = (LockDflt *)lock; - sigset_t old_mask; - - sigprocmask(SIG_BLOCK, &l->lock_mask, &old_mask); - if (l->depth == 0) - l->old_mask = old_mask; + sigprocmask(SIG_BLOCK, &l->lock_mask, &l->old_mask); + assert(l->depth == 0); l->depth++; } @@ -84,15 +81,7 @@ void lockdflt_release(void *lock) { LockDflt *l = (LockDflt *)lock; + assert(l->depth == 1); l->depth--; - assert(l->depth >= 0); - if (l->depth == 0) - sigprocmask(SIG_SETMASK, &l->old_mask, NULL); -} - -void -lockdflt_init(void) -{ - dllockinit(NULL, lockdflt_create, lockdflt_acquire, lockdflt_acquire, - lockdflt_release, lockdflt_destroy, NULL); + sigprocmask(SIG_SETMASK, &l->old_mask, NULL); } |