diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-14 19:09:56 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-25 07:18:26 +0100 |
commit | ba74ebde7461b28bf0261523d4e91e7c0e17b622 (patch) | |
tree | 0929ec50a724db8418a8d1f1b6a5d8d4c847f1dd /cpukit/libcsupport/src/__usrenv.c | |
parent | config: Add _SMP_Is_enabled (diff) | |
download | rtems-ba74ebde7461b28bf0261523d4e91e7c0e17b622.tar.bz2 |
libio: Add POSIX user environment pointer to TCB
The IO library used a POSIX key to store an optional POSIX user
environment pointer. This pulled in the POSIX keys support in every
application configuration. Add a user environment pointer to the thread
control block (TCB) instead. Applications which do not need the POSIX
user environment will just get an overhead of one pointer per thread.
Close #3882.
Diffstat (limited to 'cpukit/libcsupport/src/__usrenv.c')
-rw-r--r-- | cpukit/libcsupport/src/__usrenv.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/__usrenv.c b/cpukit/libcsupport/src/__usrenv.c index 611e0d7a92..cd191f33ea 100644 --- a/cpukit/libcsupport/src/__usrenv.c +++ b/cpukit/libcsupport/src/__usrenv.c @@ -24,6 +24,8 @@ #include <sys/stat.h> #include <rtems/libio_.h> +#include <rtems/score/percpu.h> +#include <rtems/score/thread.h> static int null_handler_open( rtems_libio_t *iop, @@ -249,4 +251,14 @@ rtems_user_env_t rtems_global_user_env = { .umask = S_IWGRP | S_IWOTH }; -pthread_key_t rtems_current_user_env_key; +rtems_user_env_t *rtems_current_user_env_get(void) +{ + Thread_Control *executing = _Thread_Get_executing(); + rtems_user_env_t *env = executing->user_environment; + + if (env == NULL) { + return &rtems_global_user_env; + } + + return env; +} |