pd->header.data.tcb = pd;
pd->tcb = pd;
__pthread_create_2_1 (newthread, attr, start_routine, arg)     pthread_t *newthread;     const pthread_attr_t *attr;     void *(*start_routine) (void *);     void *arg;{  STACK_VARIABLES;  const struct pthread_attr *iattr;  struct pthread *pd;  int err;  iattr = (struct pthread_attr *) attr;  if (iattr == NULL)    /* Is this the best idea?  On NUMA machines this could mean       accessing far-away memory.  */    iattr = &default_attr;  err = ALLOCATE_STACK (iattr, &pd);  if (__builtin_expect (err != 0, 0))    /* Something went wrong.  Maybe a parameter of the attributes is       invalid or we could not allocate memory.  */    return err;  /* Initialize the TCB.  All initializations with zero should be     performed in 'get_cached_stack'.  This way we avoid doing this if     the stack freshly allocated with 'mmap'.  */  /* Reference to the TCB itself.  */  pd->header.data.self = pd;#ifdef TLS_TCB_AT_TP  /* Self-reference.  */  pd->header.data.tcb = pd;#endif  /* Store the address of the start routine and the parameter.  Since     we do not start the function directly the stillborn thread will     get the information from its thread descriptor.  */  pd->start_routine = start_routine;  pd->arg = arg;  /* Copy the thread attribute flags.  */  pd->flags = iattr->flags;  /* Initialize the field for the ID of the thread which is waiting     for us.  This is a self-reference in case the thread is created     detached.  */  pd->joinid = iattr->flags & ATTR_FLAG_DETACHSTATE ? pd : NULL;  /* The debug events are inherited from the parent.  */  pd->eventbuf = THREAD_SELF->eventbuf;  /* Determine scheduling parameters for the thread.     XXX How to determine whether scheduling handling is needed?  */  if (0 && attr != NULL)    {      if (iattr->flags & ATTR_FLAG_NOTINHERITSCHED)	{	  /* Use the scheduling parameters the user provided.  */	  pd->schedpolicy = iattr->schedpolicy;	  memcpy (&pd->schedparam, &iattr->schedparam,		  sizeof (struct sched_param));	}      else	{	  /* Just store the scheduling attributes of the parent.  */	  pd->schedpolicy = __sched_getscheduler (0);	  __sched_getparam (0, &pd->schedparam);	}    }  /* Pass the descriptor to the caller.  */  *newthread = (pthread_t) pd;  /* Start the thread.  */  err = create_thread (pd, STACK_VARIABLES_ARGS);  if (err != 0)    {      /* Something went wrong.  Free the resources.  */      __deallocate_stack (pd);      return err;    }  return 0;}