kernel: support using thread local storage for errno

This enables storing errno in the thread local storage area.
With this enabled, a syscall to access errno can be avoided
when userspace is also enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-10-05 14:54:45 -07:00 committed by Andrew Boie
commit 62cf1960ad
5 changed files with 35 additions and 3 deletions

View file

@ -266,7 +266,9 @@ struct _mem_domain_info {
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
struct _thread_userspace_local_data {
#if defined(CONFIG_ERRNO) && !defined(CONFIG_ERRNO_IN_TLS)
int errno_var;
#endif
};
#endif
@ -329,7 +331,7 @@ struct k_thread {
struct _thread_userspace_local_data *userspace_local_data;
#endif
#ifdef CONFIG_ERRNO
#if defined(CONFIG_ERRNO) && !defined(CONFIG_ERRNO_IN_TLS)
#ifndef CONFIG_USERSPACE
/** per-thread errno variable */
int errno_var;