summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorhsu <hsu@FreeBSD.org>1996-11-11 09:05:29 +0000
committerhsu <hsu@FreeBSD.org>1996-11-11 09:05:29 +0000
commitd1d957f50c1408ea2fee4485be9a8aeab671794c (patch)
treeff19f8c4b29a0209a553ba6af1c7e0faeeecae41 /lib
parent26976c4aeef49bec6f7209edbdc489614ba70a12 (diff)
downloadFreeBSD-src-d1d957f50c1408ea2fee4485be9a8aeab671794c.zip
FreeBSD-src-d1d957f50c1408ea2fee4485be9a8aeab671794c.tar.gz
Make pthread_getspecific() compliant with the final IEEE pthreads
specification: return parameter passing changed.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/uthread_spec.c18
-rw-r--r--lib/libkse/thread/thr_spec.c18
-rw-r--r--lib/libpthread/thread/thr_spec.c18
3 files changed, 27 insertions, 27 deletions
diff --git a/lib/libc_r/uthread/uthread_spec.c b/lib/libc_r/uthread/uthread_spec.c
index cc83c60..4447a75 100644
--- a/lib/libc_r/uthread/uthread_spec.c
+++ b/lib/libc_r/uthread/uthread_spec.c
@@ -184,12 +184,12 @@ pthread_setspecific(pthread_key_t key, const void *value)
return (ret);
}
-int
-pthread_getspecific(pthread_key_t key, void **p_data)
+void *
+pthread_getspecific(pthread_key_t key)
{
pthread_t pthread;
- int rval = 0;
int status;
+ void *data;
/* Block signals: */
_thread_kern_sig_block(&status);
@@ -207,31 +207,31 @@ pthread_getspecific(pthread_key_t key, void **p_data)
}
/* Check for errors: */
- if (pthread == NULL || p_data == NULL) {
+ if (pthread == NULL) {
/* Return an invalid argument error: */
_thread_seterrno(_thread_run, EINVAL);
- rval = -1;
+ data = NULL;
}
/* Check if there is specific data: */
else if (pthread->specific_data != NULL && (key < PTHREAD_KEYS_MAX) && (key_table)) {
/* Check if this key has been used before: */
if (key_table[key].count) {
/* Return the value: */
- *p_data = (void *) pthread->specific_data[key];
+ data = (void *) pthread->specific_data[key];
} else {
/*
* This key has not been used before, so return NULL
* instead:
*/
- *p_data = NULL;
+ data = NULL;
}
} else {
/* No specific data has been created, so just return NULL: */
- *p_data = NULL;
+ data = NULL;
}
/* Unblock signals: */
_thread_kern_sig_unblock(status);
- return (rval);
+ return (data);
}
#endif
diff --git a/lib/libkse/thread/thr_spec.c b/lib/libkse/thread/thr_spec.c
index cc83c60..4447a75 100644
--- a/lib/libkse/thread/thr_spec.c
+++ b/lib/libkse/thread/thr_spec.c
@@ -184,12 +184,12 @@ pthread_setspecific(pthread_key_t key, const void *value)
return (ret);
}
-int
-pthread_getspecific(pthread_key_t key, void **p_data)
+void *
+pthread_getspecific(pthread_key_t key)
{
pthread_t pthread;
- int rval = 0;
int status;
+ void *data;
/* Block signals: */
_thread_kern_sig_block(&status);
@@ -207,31 +207,31 @@ pthread_getspecific(pthread_key_t key, void **p_data)
}
/* Check for errors: */
- if (pthread == NULL || p_data == NULL) {
+ if (pthread == NULL) {
/* Return an invalid argument error: */
_thread_seterrno(_thread_run, EINVAL);
- rval = -1;
+ data = NULL;
}
/* Check if there is specific data: */
else if (pthread->specific_data != NULL && (key < PTHREAD_KEYS_MAX) && (key_table)) {
/* Check if this key has been used before: */
if (key_table[key].count) {
/* Return the value: */
- *p_data = (void *) pthread->specific_data[key];
+ data = (void *) pthread->specific_data[key];
} else {
/*
* This key has not been used before, so return NULL
* instead:
*/
- *p_data = NULL;
+ data = NULL;
}
} else {
/* No specific data has been created, so just return NULL: */
- *p_data = NULL;
+ data = NULL;
}
/* Unblock signals: */
_thread_kern_sig_unblock(status);
- return (rval);
+ return (data);
}
#endif
diff --git a/lib/libpthread/thread/thr_spec.c b/lib/libpthread/thread/thr_spec.c
index cc83c60..4447a75 100644
--- a/lib/libpthread/thread/thr_spec.c
+++ b/lib/libpthread/thread/thr_spec.c
@@ -184,12 +184,12 @@ pthread_setspecific(pthread_key_t key, const void *value)
return (ret);
}
-int
-pthread_getspecific(pthread_key_t key, void **p_data)
+void *
+pthread_getspecific(pthread_key_t key)
{
pthread_t pthread;
- int rval = 0;
int status;
+ void *data;
/* Block signals: */
_thread_kern_sig_block(&status);
@@ -207,31 +207,31 @@ pthread_getspecific(pthread_key_t key, void **p_data)
}
/* Check for errors: */
- if (pthread == NULL || p_data == NULL) {
+ if (pthread == NULL) {
/* Return an invalid argument error: */
_thread_seterrno(_thread_run, EINVAL);
- rval = -1;
+ data = NULL;
}
/* Check if there is specific data: */
else if (pthread->specific_data != NULL && (key < PTHREAD_KEYS_MAX) && (key_table)) {
/* Check if this key has been used before: */
if (key_table[key].count) {
/* Return the value: */
- *p_data = (void *) pthread->specific_data[key];
+ data = (void *) pthread->specific_data[key];
} else {
/*
* This key has not been used before, so return NULL
* instead:
*/
- *p_data = NULL;
+ data = NULL;
}
} else {
/* No specific data has been created, so just return NULL: */
- *p_data = NULL;
+ data = NULL;
}
/* Unblock signals: */
_thread_kern_sig_unblock(status);
- return (rval);
+ return (data);
}
#endif
OpenPOWER on IntegriCloud