summaryrefslogtreecommitdiff
path: root/nptl/allocatestack.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r--nptl/allocatestack.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 223f0e445d..e042cf4840 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -332,6 +332,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
pd->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo);
#endif
+ /* The process ID is also the same as that of the caller. */
+ pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
+
/* Allocate the DTV for this thread. */
if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
/* Something went wrong. */
@@ -464,6 +467,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
pd->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo);
#endif
+ /* The process ID is also the same as that of the caller. */
+ pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
+
/* Allocate the DTV for this thread. */
if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
{
@@ -626,6 +632,9 @@ __reclaim_stacks (void)
/* This marks the stack as free. */
curp->tid = 0;
+ /* The PID field must be initialized for the new process. */
+ curp->pid = self->pid;
+
/* Account for the size of the stack. */
stack_cache_actsize += curp->stackblock_size;
}