set_thread_area(2) - Linux man page
Name
set_thread_area - set a thread local storage (TLS) area
Synopsis
#include <linux/unistd.h>
#include <asm/ldt.h>
int set_thread_area(struct user_desc *u_info);
Note: There is no glibc wrapper for this system call; see NOTES.
Description
set_thread_area() sets an entry in the current thread's thread-local storage (TLS)
array. The TLS array entry set by set_thread_area() corresponds to the value of u_info->entry_number passed in by the user. If this value is
in bounds, set_thread_area() copies the TLS descriptor pointed to by u_info into the thread's TLS array.
When set_thread_area() is passed an entry_number of -1, it uses a free TLS entry. If set_thread_area() finds a free TLS entry, the
value of u_info->entry_number is set upon return to show which entry was changed.
Return Value
set_thread_area() returns 0 on success, and -1 on failure, with errno set
appropriately.
Errors
- EINVAL
- u_info->entry_number is out of bounds.
- EFAULT
- u_info is an invalid pointer.
- ESRCH
- A free TLS entry could not be located.
Versions
A version of set_thread_area() first appeared in Linux 2.5.29.
Conforming to
set_thread_area() is Linux-specific and should not be used in programs that are
intended to be portable.
Notes
Glibc does not provide a wrapper for this system call, since it is generally intended only for use by
threading libraries. In the unlikely event that you want to call it directly, use syscall(2).
See Also
get_thread_area(2)
Referenced By
arch_prctl(2),
clone(2)