diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-03-20 05:00:23 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-03-20 05:00:23 +0000 |
commit | 8a127ccbe8a5216e39894b887bfe0a867f3e84c2 (patch) | |
tree | a31ffb08915abaaa29c86998215bdb3431b50290 /lib/libc | |
parent | f98739189c8cbc9838b35171c1a8d2dc5e9d0541 (diff) |
It's libpthread, not librthread, and __tfork(2) lets you set the TCB
address of the new thread
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/__get_tcb.2 | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/libc/sys/__get_tcb.2 b/lib/libc/sys/__get_tcb.2 index 58cf27191e8..18074de2b4f 100644 --- a/lib/libc/sys/__get_tcb.2 +++ b/lib/libc/sys/__get_tcb.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: __get_tcb.2,v 1.4 2012/04/12 14:25:57 deraadt Exp $ +.\" $OpenBSD: __get_tcb.2,v 1.5 2016/03/20 05:00:22 guenther Exp $ .\" .\" Copyright (c) 2011 Philip Guenther <guenther@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 12 2012 $ +.Dd $Mdocdate: March 20 2016 $ .Dt __GET_TCB 2 .Os .Sh NAME @@ -31,21 +31,24 @@ The .Fn __get_tcb and .Fn __set_tcb -functions are for use by librthread and other parts of the system +functions are for use by libpthread and other parts of the C runtime to retrieve and set the address of the current thread's thread control block (TCB). This is used to locate per-thread data such as .Va errno . Each kernel-level thread in a process has a separate value for this address, which can be obtained and changed via these system calls. -New threads (including the first thread of a new process) created using -.Xr fork 2 , -.Xr vfork 2 , +.Pp +The initial thread of a new process created using +.Xr fork 2 or -.Xr __tfork 2 , -inherit the TCB address of the thread that created them. +.Xr vfork 2 +inherits the TCB address of the thread that created it. +A thread created using +.Xr __tfork 2 +starts with the TCB address specified in that call. .Xr execve 2 -resets it to zero. +resets the thread's TCB address to zero. .Pp On some platforms, this address is also directly mapped to a CPU register which can be accessed from userspace. |