-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for pthread_getattr_np #470
Conversation
} else { | ||
bounds.base = &__global_base; | ||
bounds.size = (size_t)&__global_base; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code only calculates the stack found of the main thread (i.e. the singular stack that the linker produces). Is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fills data for main thread, spawned threads have these fields filled in pthread_create.
@@ -20,5 +23,9 @@ int pthread_getattr_np(pthread_t t, pthread_attr_t *a) | |||
l += PAGE_SIZE; | |||
a->_a_stacksize = l; | |||
} | |||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can leave the if / else
above and just replace the else block.
It looks like that if
block covers secondary threads and the else
block covers the main thread? We could use the __stack_high
/ __stack_low
globals for the else case I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to fill these fields in main thread struct and handle everything the same way. Otherwise this would need to duplicate the logic for getting stack bounds, fallback to __heap_base, etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced only else
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable to me
@Milek7, can you rebase to fix the conflicts and then I can merge? |
Add pthread_getattr_np for getting stack bounds.