diff options
Diffstat (limited to 'sysdeps/generic/pt-getspecific.c')
-rw-r--r-- | sysdeps/generic/pt-getspecific.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sysdeps/generic/pt-getspecific.c b/sysdeps/generic/pt-getspecific.c index 2a7c4a9..1f49c03 100644 --- a/sysdeps/generic/pt-getspecific.c +++ b/sysdeps/generic/pt-getspecific.c @@ -1,4 +1,4 @@ -/* pthread_getspecific. Generic version. +/* pthread_getspecific. Hurd version. Copyright (C) 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -18,10 +18,22 @@ Boston, MA 02111-1307, USA. */ #include <pthread.h> + #include <pt-internal.h> -int -pthread_getspecific (pthread_key_t key) +void * +__pthread_getspecific (pthread_key_t key) { - return EINVAL; + struct __pthread *self; + + if (key < 0 || key >= __pthread_key_count + || __pthread_key_destructors[key] == PTHREAD_KEY_INVALID) + return NULL; + + self = _pthread_self (); + if (key >= self->thread_specifics_size) + return 0; + + return self->thread_specifics[key]; } +strong_alias (__pthread_getspecific, pthread_getspecific); |