summaryrefslogtreecommitdiff
path: root/src/env
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-10 04:49:49 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-10 04:49:49 -0400
commitac31bf278d9ed855e6765bb71d64ed19d2b7c0f8 (patch)
tree7bb84ee108a4ce18d69164e3bd28ca5f586f9d30 /src/env
parentdf15168cf8baf34fb9c94e19eaa1a5c79c853970 (diff)
downloadmusl-ac31bf278d9ed855e6765bb71d64ed19d2b7c0f8.tar.gz
musl-ac31bf278d9ed855e6765bb71d64ed19d2b7c0f8.tar.bz2
musl-ac31bf278d9ed855e6765bb71d64ed19d2b7c0f8.tar.xz
musl-ac31bf278d9ed855e6765bb71d64ed19d2b7c0f8.zip
simplify errno implementation
the motivation for the errno_ptr field in the thread structure, which this commit removes, was to allow the main thread's errno to keep its address when lazy thread pointer initialization was used. &errno was evaluated prior to setting up the thread pointer and stored in errno_ptr for the main thread; subsequently created threads would have errno_ptr pointing to their own errno_val in the thread structure. since lazy initialization was removed, there is no need for this extra level of indirection; __errno_location can simply return the address of the thread's errno_val directly. this does cause &errno to change, but the change happens before entry to application code, and thus is not observable.
Diffstat (limited to 'src/env')
-rw-r--r--src/env/__init_tls.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
index e1a2b614..f7eab8d6 100644
--- a/src/env/__init_tls.c
+++ b/src/env/__init_tls.c
@@ -16,7 +16,6 @@ int __init_tp(void *p)
if (!r) libc.can_do_threads = 1;
libc.has_thread_pointer = 1;
td->tid = td->pid = __syscall(SYS_set_tid_address, &td->tid);
- td->errno_ptr = &td->errno_val;
return 0;
}