mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
parent
df3e4edd76
commit
eccfa5e1e7
@ -273,21 +273,40 @@ extern "C" {
|
|||||||
void **stackaddr,
|
void **stackaddr,
|
||||||
::size_t *stacksize)
|
::size_t *stacksize)
|
||||||
{
|
{
|
||||||
/* FIXME */
|
|
||||||
warning("pthread_attr_getstack() called, might not work correctly");
|
|
||||||
|
|
||||||
if (!attr || !*attr || !stackaddr || !stacksize)
|
if (!attr || !*attr || !stackaddr || !stacksize)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
pthread_t pthread = (*attr)->pthread;
|
pthread_t pthread = (*attr)->pthread;
|
||||||
|
|
||||||
*stackaddr = pthread->stack_top();
|
if (pthread != pthread_self()) {
|
||||||
*stacksize = (addr_t)pthread->stack_top() - (addr_t)pthread->stack_base();
|
error("pthread_attr_getstack() called, where pthread != phtread_self");
|
||||||
|
*stackaddr = nullptr;
|
||||||
|
*stacksize = 0;
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread::Stack_info info = Thread::mystack();
|
||||||
|
*stackaddr = (void *)info.base;
|
||||||
|
*stacksize = info.top - info.base;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
|
||||||
|
{
|
||||||
|
size_t stacksize;
|
||||||
|
return pthread_attr_getstack(attr, stackaddr, &stacksize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
|
||||||
|
{
|
||||||
|
void *stackaddr;
|
||||||
|
return pthread_attr_getstack(attr, &stackaddr, stacksize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int pthread_attr_get_np(pthread_t pthread, pthread_attr_t *attr)
|
int pthread_attr_get_np(pthread_t pthread, pthread_attr_t *attr)
|
||||||
{
|
{
|
||||||
if (!attr)
|
if (!attr)
|
||||||
|
Loading…
Reference in New Issue
Block a user