summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEric van Gyzen <vangyzen@FreeBSD.org>2017-05-20 17:32:01 +0000
committerEric van Gyzen <vangyzen@FreeBSD.org>2017-05-20 17:32:01 +0000
commit07f29d9f76cf7c3879c223ae0a7d7d5fab3bfd2c (patch)
treea086b650930e6fe35c7ef8227d3ebbcbef5f6169 /lib
parent048ad6aedc567bb37c43b069eb38bb9784a800e2 (diff)
downloadsrc-test2-07f29d9f76cf7c3879c223ae0a7d7d5fab3bfd2c.tar.gz
src-test2-07f29d9f76cf7c3879c223ae0a7d7d5fab3bfd2c.zip
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/Symbol.map1
-rw-r--r--lib/libc/gen/_spinlock_stub.c2
-rw-r--r--lib/libc/include/spinlock.h13
-rw-r--r--lib/libthr/thread/thr_init.c1
-rw-r--r--lib/libthr/thread/thr_spinlock.c12
5 files changed, 10 insertions, 19 deletions
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index 0984febf9c70..bada246e0b3c 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -485,7 +485,6 @@ FBSDprivate_1.0 {
_pthread_sigmask;
_pthread_testcancel;
_spinlock;
- _spinlock_debug;
_spinunlock;
_rtld_addr_phdr;
_rtld_atfork_pre;
diff --git a/lib/libc/gen/_spinlock_stub.c b/lib/libc/gen/_spinlock_stub.c
index 3decf8a0a565..e08db88947f0 100644
--- a/lib/libc/gen/_spinlock_stub.c
+++ b/lib/libc/gen/_spinlock_stub.c
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
long _atomic_lock_stub(volatile long *);
void _spinlock_stub(spinlock_t *);
void _spinunlock_stub(spinlock_t *);
-void _spinlock_debug_stub(spinlock_t *, char *, int);
__weak_reference(_atomic_lock_stub, _atomic_lock);
@@ -48,7 +47,6 @@ _atomic_lock_stub(volatile long *lck __unused)
return (0L);
}
-__weak_reference(_spinlock, _spinlock_debug);
#pragma weak _spinlock
void
_spinlock(spinlock_t *lck)
diff --git a/lib/libc/include/spinlock.h b/lib/libc/include/spinlock.h
index c9facc517d52..c29f3f5e15ac 100644
--- a/lib/libc/include/spinlock.h
+++ b/lib/libc/include/spinlock.h
@@ -41,21 +41,17 @@
* Lock structure with room for debugging information.
*/
struct _spinlock {
- volatile long access_lock;
- volatile long lock_owner;
- volatile char *fname;
- volatile int lineno;
+ long spare1;
+ long spare2;
+ void *thr_extra;
+ int spare3;
};
typedef struct _spinlock spinlock_t;
#define _SPINLOCK_INITIALIZER { 0, 0, 0, 0 }
#define _SPINUNLOCK(_lck) _spinunlock(_lck);
-#ifdef _LOCK_DEBUG
-#define _SPINLOCK(_lck) _spinlock_debug(_lck, __FILE__, __LINE__)
-#else
#define _SPINLOCK(_lck) _spinlock(_lck)
-#endif
/*
* Thread function prototype definitions:
@@ -64,7 +60,6 @@ __BEGIN_DECLS
long _atomic_lock(volatile long *);
void _spinlock(spinlock_t *);
void _spinunlock(spinlock_t *);
-void _spinlock_debug(spinlock_t *, char *, int);
__END_DECLS
#endif /* _SPINLOCK_H_ */
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index e5393c05f2c5..909f14236d17 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -173,7 +173,6 @@ STATIC_LIB_REQUIRE(_sigtimedwait);
STATIC_LIB_REQUIRE(_sigwait);
STATIC_LIB_REQUIRE(_sigwaitinfo);
STATIC_LIB_REQUIRE(_spinlock);
-STATIC_LIB_REQUIRE(_spinlock_debug);
STATIC_LIB_REQUIRE(_spinunlock);
STATIC_LIB_REQUIRE(_thread_init_hack);
diff --git a/lib/libthr/thread/thr_spinlock.c b/lib/libthr/thread/thr_spinlock.c
index 66396123d2e9..51903a6948c9 100644
--- a/lib/libthr/thread/thr_spinlock.c
+++ b/lib/libthr/thread/thr_spinlock.c
@@ -65,7 +65,7 @@ __thr_spinunlock(spinlock_t *lck)
{
struct spinlock_extra *_extra;
- _extra = (struct spinlock_extra *)lck->fname;
+ _extra = lck->thr_extra;
THR_UMUTEX_UNLOCK(_get_curthread(), &_extra->lock);
}
@@ -78,9 +78,9 @@ __thr_spinlock(spinlock_t *lck)
PANIC("Spinlock called when not threaded.");
if (!initialized)
PANIC("Spinlocks not initialized.");
- if (lck->fname == NULL)
+ if (lck->thr_extra == NULL)
init_spinlock(lck);
- _extra = (struct spinlock_extra *)lck->fname;
+ _extra = lck->thr_extra;
THR_UMUTEX_LOCK(_get_curthread(), &_extra->lock);
}
@@ -90,14 +90,14 @@ init_spinlock(spinlock_t *lck)
struct pthread *curthread = _get_curthread();
THR_UMUTEX_LOCK(curthread, &spinlock_static_lock);
- if ((lck->fname == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
- lck->fname = (char *)&extra[spinlock_count];
+ if ((lck->thr_extra == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
+ lck->thr_extra = &extra[spinlock_count];
_thr_umutex_init(&extra[spinlock_count].lock);
extra[spinlock_count].owner = lck;
spinlock_count++;
}
THR_UMUTEX_UNLOCK(curthread, &spinlock_static_lock);
- if (lck->fname == NULL)
+ if (lck->thr_extra == NULL)
PANIC("Warning: exceeded max spinlocks");
}