summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-03-28 06:09:24 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-03-28 06:09:24 +0000
commitf8168da7cf95cc9e1082de2f92593fa9e40bbde5 (patch)
treeac985a06120dcffc30366f910f16d1483f8eccad /lib
parentb99f1961b8b3456fa23cc4113117f8f1139d5c60 (diff)
downloadFreeBSD-src-f8168da7cf95cc9e1082de2f92593fa9e40bbde5.zip
FreeBSD-src-f8168da7cf95cc9e1082de2f92593fa9e40bbde5.tar.gz
Allocate space for thread pointer, this allows thread library to access
its pointer from begin, and simplifies _get_curthread() in libthr.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/tls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 033c737..f63b361 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -131,7 +131,7 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign __unused)
if (size < tcbsize)
size = tcbsize;
- tls = malloc(size);
+ tls = calloc(1, size);
dtv = malloc(3 * sizeof(Elf_Addr));
*(Elf_Addr **) tls = dtv;
@@ -202,7 +202,7 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign)
size = round(tls_static_space, tcbalign);
assert(tcbsize >= 2*sizeof(Elf_Addr));
- tls = malloc(size + tcbsize);
+ tls = calloc(1, size + tcbsize);
dtv = malloc(3 * sizeof(Elf_Addr));
segbase = (Elf_Addr)(tls + size);
@@ -309,7 +309,7 @@ _init_tls()
}
}
- tls = _rtld_allocate_tls(NULL, 2*sizeof(Elf_Addr),
+ tls = _rtld_allocate_tls(NULL, 3*sizeof(Elf_Addr),
sizeof(Elf_Addr));
_set_tp(tls);
OpenPOWER on IntegriCloud