aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2014-02-19 15:00:55 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2014-02-19 15:00:55 +0000
commit1912efe06723453167cdb44d23e486ddafdbc8fe (patch)
treefe59f6ae0fccc92220fbd2476b26db3e59a2b725 /lib
parent1d2972a1d5050967a1ef75f5a30dee0f0c43aa0b (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_spec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c
index 0740d6bac851..b33edeb0565d 100644
--- a/lib/libthr/thread/thr_spec.c
+++ b/lib/libthr/thread/thr_spec.c
@@ -69,7 +69,7 @@ _pthread_key_create(pthread_key_t *key, void (*destructor) (void *))
/* Unlock the key table: */
THR_LOCK_RELEASE(curthread, &_keytable_lock);
- *key = i;
+ *key = i + 1;
return (0);
}
@@ -80,9 +80,10 @@ _pthread_key_create(pthread_key_t *key, void (*destructor) (void *))
}
int
-_pthread_key_delete(pthread_key_t key)
+_pthread_key_delete(pthread_key_t userkey)
{
struct pthread *curthread = _get_curthread();
+ int key = userkey - 1;
int ret = 0;
if ((unsigned int)key < PTHREAD_KEYS_MAX) {
@@ -177,9 +178,10 @@ pthread_key_allocate_data(void)
}
int
-_pthread_setspecific(pthread_key_t key, const void *value)
+_pthread_setspecific(pthread_key_t userkey, const void *value)
{
struct pthread *pthread;
+ pthread_key_t key = userkey - 1;
int ret = 0;
/* Point to the running thread: */
@@ -208,9 +210,10 @@ _pthread_setspecific(pthread_key_t key, const void *value)
}
void *
-_pthread_getspecific(pthread_key_t key)
+_pthread_getspecific(pthread_key_t userkey)
{
struct pthread *pthread;
+ pthread_key_t key = userkey - 1;
const void *data;
/* Point to the running thread: */