about summary refs log tree commit diff
path: root/linuxthreads/attr.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-11 19:13:06 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-11 19:13:06 +0000
commitb81c896174dc98cb15cc80844751fb23cd9e02d1 (patch)
tree36e280081ea0808186228cdfb4cfe93649678157 /linuxthreads/attr.c
parent72c65ff44b8130b54162ec3eb85c36146d7f5d70 (diff)
downloadglibc-b81c896174dc98cb15cc80844751fb23cd9e02d1.tar.gz
glibc-b81c896174dc98cb15cc80844751fb23cd9e02d1.tar.xz
glibc-b81c896174dc98cb15cc80844751fb23cd9e02d1.zip
Update.
2000-09-11  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/pthread/pthread.h: Declare pthread_attr_getstack and
	pthread_attr_setstack.
	* Versions [libpthread] (GLIBC_2.2): Export pthread_attr_getstack and
	pthread_attr_setstack.
	* attr.c (pthread_attr_getstack, pthread_attr_setstack): New functions.
Diffstat (limited to 'linuxthreads/attr.c')
-rw-r--r--linuxthreads/attr.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c
index ac3776a010..fc1ab59674 100644
--- a/linuxthreads/attr.c
+++ b/linuxthreads/attr.c
@@ -22,6 +22,7 @@
 #include "pthread.h"
 #include "internals.h"
 #include <shlib-compat.h>
+#include <stackinfo.h>
 
 int __pthread_attr_init_2_1(pthread_attr_t *attr)
 {
@@ -224,3 +225,39 @@ int __pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
   return 0;
 }
 weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize)
+
+int __pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr,
+			     size_t stacksize)
+{
+  int err;
+
+  if ((((uintptr_t) stackaddr)
+       & ~__alignof__ (struct _pthread_descr_struct)) != 0)
+    err = EINVAL;
+  else
+    err = __pthread_attr_setstacksize (attr, stacksize);
+  if (err == 0)
+    {
+#ifdef _STACK_GROWS_UP
+      attr->__stackaddr = (char *) stackaddr + stacksize;
+#else
+      attr->__stackaddr = stackaddr;
+#endif
+      attr->__stackaddr_set = 1;
+    }
+
+  return err;
+}
+weak_alias (__pthread_attr_setstack, pthread_attr_setstack)
+
+int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr,
+			     size_t *stacksize)
+{
+  /* XXX This function has a stupid definition.  The standard specifies
+     no error value but what is if no stack address was set?  We simply
+     return the value we have in the member.  */
+  *stackaddr = attr->__stackaddr;
+  *stacksize = attr->__stacksize;
+  return 0;
+}
+weak_alias (__pthread_attr_getstack, pthread_attr_getstack)