diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-03-15 21:13:12 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-03-15 21:13:12 +0000 |
commit | 3bf927cbce1d0829b587f5f0eee744e907921c58 (patch) | |
tree | e57df20024262c73f67b6171a94757f25e9e1abf /linuxthreads/attr.c | |
parent | 821a6bb4360ae232140ba230724642fed9db613c (diff) | |
download | glibc-3bf927cbce1d0829b587f5f0eee744e907921c58.tar.gz glibc-3bf927cbce1d0829b587f5f0eee744e907921c58.tar.xz glibc-3bf927cbce1d0829b587f5f0eee744e907921c58.zip |
Update.
2001-03-15 Ulrich Drepper <drepper@redhat.com> * Versions [libpthread] (GLIBC_2.2.3): Add pthread_getattr_np. * attr.c: Implement pthread_getattr_np. * sysdeps/pthread/pthread.h: Add prototype for pthread_getattr_np. * internals.h (struct _pthread_descr_struct): Add p_inheritsched. * manager.c (pthread_handle_create): Initialize p_inheritsched. * sysdeps/unix/sysv/linux/s390/pt-initfini.c: Use 0x07 padding for
Diffstat (limited to 'linuxthreads/attr.c')
-rw-r--r-- | linuxthreads/attr.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c index 580da03b40..8cb0f8f7ef 100644 --- a/linuxthreads/attr.c +++ b/linuxthreads/attr.c @@ -267,3 +267,45 @@ int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, return 0; } weak_alias (__pthread_attr_getstack, pthread_attr_getstack) + +int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) +{ + pthread_handle handle = thread_handle (thread); + pthread_descr descr; + char *guardaddr; + + if (handle == NULL) + return ENOENT; + + descr = handle->h_descr; + + attr->__detachstate = (descr->p_detached + ? PTHREAD_CREATE_DETACHED + : PTHREAD_CREATE_JOINABLE); + + attr->__schedpolicy = __sched_getscheduler (descr->p_pid); + if (attr->__schedpolicy == -1) + return errno; + + if (__sched_getparam (descr->p_pid, + (struct sched_param *) &attr->__schedparam) != 0) + return errno; + + guardaddr = descr->p_guardaddr; + attr->__inheritsched = descr->p_inheritsched; + attr->__scope = PTHREAD_SCOPE_SYSTEM; + attr->__stacksize = (char *)(descr + 1) - guardaddr - descr->p_guardsize; + attr->__guardsize = descr->p_guardsize; + attr->__stackaddr_set = descr->p_userstack; +#ifdef NEED_SEPARATE_REGISTER_STACK + guardaddr -= attr->__stacksize; + attr->__stacksize *= 2; + /* XXX This is awkward. The guard pages are in the middle of the + two stacks. We must count the guard size in the stack size since + otherwise the range of the stack area cannot be computed. */ + attr->__stacksize += attr->guardsize; +#endif + attr->__stackaddr = guardaddr; + + return 0; +} |