summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2010-08-06 05:25:02 +0000
committerchristos <christos@NetBSD.org>2010-08-06 05:25:02 +0000
commit32d8a48951308cc2ab49837199d256ef2b696987 (patch)
treeb22bfef787efdcba384f5f721150962cb4894f51 /lib/libpthread
parentde3d24d6c6f83487435c250a27c5ec74225bba88 (diff)
Add pthread_getattr_np()
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/pthread.h3
-rw-r--r--lib/libpthread/pthread_attr.c17
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/libpthread/pthread.h b/lib/libpthread/pthread.h
index 248825b7689..166f1ed89f3 100644
--- a/lib/libpthread/pthread.h
+++ b/lib/libpthread/pthread.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread.h,v 1.33 2009/01/11 02:46:48 christos Exp $ */
+/* $NetBSD: pthread.h,v 1.34 2010/08/06 05:25:02 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -191,6 +191,7 @@ int *pthread__errno(void);
#if defined(_NETBSD_SOURCE)
int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
int pthread_setaffinity_np(pthread_t, size_t, cpuset_t *);
+int pthread_getattr_np(pthread_t, pthread_attr_t *);
int pthread_mutex_held_np(pthread_mutex_t *);
pthread_t pthread_mutex_owner_np(pthread_mutex_t *);
diff --git a/lib/libpthread/pthread_attr.c b/lib/libpthread/pthread_attr.c
index ad52f34c376..377941dddf6 100644
--- a/lib/libpthread/pthread_attr.c
+++ b/lib/libpthread/pthread_attr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_attr.c,v 1.12 2009/01/18 12:14:16 lukem Exp $ */
+/* $NetBSD: pthread_attr.c,v 1.13 2010/08/06 05:25:02 christos Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_attr.c,v 1.12 2009/01/18 12:14:16 lukem Exp $");
+__RCSID("$NetBSD: pthread_attr.c,v 1.13 2010/08/06 05:25:02 christos Exp $");
#include <errno.h>
#include <stdio.h>
@@ -443,3 +443,16 @@ pthread_attr_setcreatesuspend_np(pthread_attr_t *attr)
attr->pta_flags |= PT_FLAG_SUSPENDED;
return 0;
}
+
+int
+pthread_getattr_np(pthread_t thread, pthread_attr_t *attr)
+{
+ int error;
+ if ((error = pthread_attr_init(attr)) != 0)
+ return error;
+ if ((error = pthread_attr_get_np(thread, attr)) != 0) {
+ (void)pthread_attr_destroy(attr);
+ return error;
+ }
+ return 0;
+}