unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OpenBSD-5.7)
Page:
Section:
Apropos / Subsearch:
optional field

__GET_TCB(2)                BSD System Calls Manual               __GET_TCB(2)

NAME
     __get_tcb, __set_tcb -- get and set the address of the thread control
     block of the current thread

SYNOPSIS
     void *
     __get_tcb(void);

     void
     __set_tcb(void *);

DESCRIPTION
     The __get_tcb() and __set_tcb() functions are for use by librthread and
     other parts of the system 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 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 fork(2), vfork(2), or __tfork(2), inherit the TCB
     address of the thread that created them.  execve(2) resets it to zero.

     On some platforms, this address is also directly mapped to a CPU register
     which can be accessed from userspace.

RETURN VALUES
     __get_tcb() returns the address of the thread control block of the cur-
     rent thread.

SEE ALSO
     __tfork(2)

HISTORY
     The __get_tcb() and __set_tcb() system calls appeared in OpenBSD 5.1.

BSD                             April 12, 2012                             BSD