1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

2005-10-01 Ulrich Drepper <drepper@redhat.com>

Jakub Jelinek  <jakub@redhat.com>

	* descr.h: Define SETXID_BIT and SETXID_BITMASK.  Adjust
	CANCEL_RESTMASK.
	(struct pthread): Move specific_used field to avoid padding.
	Add setxid_futex field.
	* init.c (sighandler_setxid): Reset setxid flag and release the
	setxid futex.
	* allocatestack.c (setxid_signal_thread): New function.  Broken
	out of the bodies of the two loops in __nptl_setxid.  For undetached
	threads check whether they are exiting and if yes, don't send a signal.
	(__nptl_setxid): Simplify loops by using setxid_signal_thread.
	* pthread_create.c (start_thread): For undetached threads, check
	whether setxid bit is set.  If yes, wait until signal has been
	processed.

	* allocatestack.c (STACK_VARIABLES): Initialize them.
	* pthread_create.c (__pthread_create_2_1): Initialize pd.
This commit is contained in:
Ulrich Drepper
2005-10-01 17:20:34 +00:00
parent 2ff89ea46f
commit dff9a7a163
5 changed files with 102 additions and 50 deletions

View File

@ -314,6 +314,17 @@ start_thread (void *arg)
if (IS_DETACHED (pd))
/* Free the TCB. */
__free_tcb (pd);
else if (__builtin_expect (pd->cancelhandling & SETXID_BITMASK, 0))
{
/* Some other thread might call any of the setXid functions and expect
us to reply. In this case wait until we did that. */
do
lll_futex_wait (&pd->setxid_futex, 0);
while (pd->cancelhandling & SETXID_BITMASK);
/* Reset the value so that the stack can be reused. */
pd->setxid_futex = 0;
}
/* We cannot call '_exit' here. '_exit' will terminate the process.
@ -354,7 +365,7 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
accessing far-away memory. */
iattr = &default_attr;
struct pthread *pd;
struct pthread *pd = NULL;
int err = ALLOCATE_STACK (iattr, &pd);
if (__builtin_expect (err != 0, 0))
/* Something went wrong. Maybe a parameter of the attributes is