forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -139,11 +139,6 @@ extern "C" {
|
||||
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 3
|
||||
#endif
|
||||
|
||||
/*
|
||||
* POSIX key count used by the IO library.
|
||||
*/
|
||||
#define _CONFIGURE_LIBIO_POSIX_KEYS 1
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
rtems_libio_t rtems_libio_iops[CONFIGURE_MAXIMUM_FILE_DESCRIPTORS];
|
||||
|
||||
@@ -2073,14 +2068,6 @@ struct _reent *__getreent(void)
|
||||
(CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This macro is calculated to specify the total number of
|
||||
* POSIX API keys required by the application and configured
|
||||
* system capabilities.
|
||||
*/
|
||||
#define _CONFIGURE_POSIX_KEYS \
|
||||
(CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS)
|
||||
|
||||
/**
|
||||
* This configuration parameter specifies the maximum number of
|
||||
* POSIX API threads.
|
||||
@@ -2550,8 +2537,8 @@ struct _reent *__getreent(void)
|
||||
CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS;
|
||||
#endif
|
||||
|
||||
#if _CONFIGURE_POSIX_KEYS > 0
|
||||
POSIX_KEYS_INFORMATION_DEFINE( _CONFIGURE_POSIX_KEYS );
|
||||
#if CONFIGURE_MAXIMUM_POSIX_KEYS > 0
|
||||
POSIX_KEYS_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_KEYS );
|
||||
#endif
|
||||
|
||||
#if CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES > 0
|
||||
|
||||
@@ -336,10 +336,6 @@ void rtems_filesystem_location_free( rtems_filesystem_location_info_t *loc );
|
||||
*/
|
||||
#include <rtems/userenv.h>
|
||||
|
||||
void rtems_libio_free_user_env( void *env );
|
||||
|
||||
extern pthread_key_t rtems_current_user_env_key;
|
||||
|
||||
void rtems_libio_lock( void );
|
||||
|
||||
void rtems_libio_unlock( void );
|
||||
|
||||
@@ -197,7 +197,7 @@ typedef enum {
|
||||
INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT = 31,
|
||||
INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED = 32,
|
||||
INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED = 33,
|
||||
INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34,
|
||||
/* INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34, */
|
||||
/* INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35, */
|
||||
INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36,
|
||||
INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37,
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
#include <rtems/score/processormask.h>
|
||||
#endif
|
||||
|
||||
struct rtems_user_env_t;
|
||||
|
||||
struct _pthread_cleanup_context;
|
||||
|
||||
struct Per_CPU_Control;
|
||||
@@ -858,6 +860,11 @@ struct _Thread_Control {
|
||||
|
||||
Thread_Capture_control Capture;
|
||||
|
||||
/**
|
||||
* @brief Pointer to an optional thread-specific POSIX user environment.
|
||||
*/
|
||||
struct rtems_user_env_t *user_environment;
|
||||
|
||||
/**
|
||||
* @brief LIFO list of POSIX cleanup contexts.
|
||||
*/
|
||||
|
||||
@@ -68,6 +68,7 @@ extern "C" {
|
||||
#define RTEMS_SYSINIT_POSIX_CLEANUP 001c00
|
||||
#define RTEMS_SYSINIT_IDLE_THREADS 001d00
|
||||
#define RTEMS_SYSINIT_LIBIO 001e00
|
||||
#define RTEMS_SYSINIT_USER_ENVIRONMENT 001e80
|
||||
#define RTEMS_SYSINIT_ROOT_FILESYSTEM 001f00
|
||||
#define RTEMS_SYSINIT_DRVMGR 002000
|
||||
#define RTEMS_SYSINIT_MP_SERVER 002100
|
||||
|
||||
@@ -53,10 +53,12 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct rtems_user_env_t rtems_user_env_t;
|
||||
|
||||
/**
|
||||
* @brief User environment.
|
||||
*/
|
||||
typedef struct {
|
||||
struct rtems_user_env_t {
|
||||
/**
|
||||
* @brief The anchor directory for relative paths.
|
||||
*/
|
||||
@@ -111,7 +113,7 @@ typedef struct {
|
||||
* @brief The list of supplementary group IDs.
|
||||
*/
|
||||
gid_t groups[NGROUPS];
|
||||
} rtems_user_env_t;
|
||||
};
|
||||
|
||||
extern rtems_user_env_t rtems_global_user_env;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ static void rtems_libio_init( void )
|
||||
{
|
||||
uint32_t i;
|
||||
rtems_libio_t *iop;
|
||||
int eno;
|
||||
|
||||
if (rtems_libio_number_iops > 0)
|
||||
{
|
||||
@@ -59,17 +58,6 @@ static void rtems_libio_init( void )
|
||||
iop->data1 = NULL;
|
||||
rtems_libio_iop_free_tail = &iop->data1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the posix key for user environment.
|
||||
*/
|
||||
eno = pthread_key_create(
|
||||
&rtems_current_user_env_key,
|
||||
rtems_libio_free_user_env
|
||||
);
|
||||
if (eno != 0) {
|
||||
_Internal_error( INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED );
|
||||
}
|
||||
}
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
|
||||
@@ -24,23 +24,15 @@
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#include <rtems/score/userextimpl.h>
|
||||
#include <rtems/sysinit.h>
|
||||
|
||||
/**
|
||||
* Instantiate a private user environment for the calling thread.
|
||||
*/
|
||||
|
||||
rtems_user_env_t * rtems_current_user_env_get(void)
|
||||
static void rtems_libio_free_user_env(rtems_user_env_t *env)
|
||||
{
|
||||
void *ptr = pthread_getspecific(rtems_current_user_env_key);
|
||||
if (ptr == NULL) {
|
||||
ptr = &rtems_global_user_env;
|
||||
}
|
||||
return (rtems_user_env_t *) ptr;
|
||||
}
|
||||
|
||||
void rtems_libio_free_user_env(void *arg)
|
||||
{
|
||||
rtems_user_env_t *env = arg;
|
||||
bool uses_global_env = env == &rtems_global_user_env;
|
||||
|
||||
if (!uses_global_env) {
|
||||
@@ -72,16 +64,9 @@ rtems_status_code rtems_libio_set_private_env(void)
|
||||
!rtems_filesystem_global_location_is_null(new_env->root_directory)
|
||||
&& !rtems_filesystem_global_location_is_null(new_env->current_directory)
|
||||
) {
|
||||
int eno = pthread_setspecific(
|
||||
rtems_current_user_env_key,
|
||||
new_env
|
||||
);
|
||||
Thread_Control *executing = _Thread_Get_executing();
|
||||
|
||||
if (eno == 0) {
|
||||
rtems_libio_free_user_env(old_env);
|
||||
} else {
|
||||
sc = RTEMS_TOO_MANY;
|
||||
}
|
||||
executing->user_environment = new_env;
|
||||
} else {
|
||||
sc = RTEMS_UNSATISFIED;
|
||||
}
|
||||
@@ -107,10 +92,48 @@ void rtems_libio_use_global_env(void)
|
||||
if (uses_private_env) {
|
||||
Thread_Life_state life_state =
|
||||
_Thread_Set_life_protection(THREAD_LIFE_PROTECTED);
|
||||
Thread_Control *executing;
|
||||
|
||||
rtems_libio_free_user_env(env);
|
||||
pthread_setspecific(rtems_current_user_env_key, NULL);
|
||||
executing = _Thread_Get_executing();
|
||||
executing->user_environment = NULL;
|
||||
|
||||
_Thread_Set_life_protection(life_state);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtems_libio_env_thread_terminate(Thread_Control *the_thread)
|
||||
{
|
||||
rtems_user_env_t *env = the_thread->user_environment;
|
||||
|
||||
if (env != NULL) {
|
||||
rtems_libio_free_user_env(env);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtems_libio_env_thread_restart(
|
||||
Thread_Control *executing,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
(void) executing;
|
||||
rtems_libio_env_thread_terminate( the_thread );
|
||||
}
|
||||
|
||||
static User_extensions_Control rtems_libio_env_extensions = {
|
||||
.Callouts = {
|
||||
.thread_restart = rtems_libio_env_thread_restart,
|
||||
.thread_terminate = rtems_libio_env_thread_terminate
|
||||
}
|
||||
};
|
||||
|
||||
static void rtems_libio_env_init(void)
|
||||
{
|
||||
_User_extensions_Add_API_set(&rtems_libio_env_extensions);
|
||||
}
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
rtems_libio_env_init,
|
||||
RTEMS_SYSINIT_USER_ENVIRONMENT,
|
||||
RTEMS_SYSINIT_ORDER_MIDDLE
|
||||
);
|
||||
|
||||
@@ -86,6 +86,7 @@ SYSINIT_VERBOSE( POSIX_KEYS );
|
||||
SYSINIT_VERBOSE( POSIX_CLEANUP );
|
||||
SYSINIT_VERBOSE( IDLE_THREADS );
|
||||
SYSINIT_VERBOSE( LIBIO );
|
||||
SYSINIT_VERBOSE( USER_ENVIRONMENT );
|
||||
SYSINIT_VERBOSE( ROOT_FILESYSTEM );
|
||||
SYSINIT_VERBOSE( DRVMGR );
|
||||
SYSINIT_VERBOSE( MP_SERVER );
|
||||
@@ -468,9 +469,16 @@ static void _Sysinit_Verbose_LIBIO( void )
|
||||
}
|
||||
}
|
||||
|
||||
static void _Sysinit_Verbose_USER_ENVIRONMENT( void )
|
||||
{
|
||||
if ( !SYSINIT_IS_ADJACENT( LIBIO, USER_ENVIRONMENT ) ) {
|
||||
printk( "sysinit: USER_ENVIRONMENT: done\n" );
|
||||
}
|
||||
}
|
||||
|
||||
static void _Sysinit_Verbose_ROOT_FILESYSTEM( void )
|
||||
{
|
||||
if ( !SYSINIT_IS_ADJACENT( LIBIO, ROOT_FILESYSTEM ) ) {
|
||||
if ( !SYSINIT_IS_ADJACENT( USER_ENVIRONMENT, ROOT_FILESYSTEM ) ) {
|
||||
printk( "sysinit: ROOT_FILESYSTEM: done\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1437,7 +1437,6 @@ size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configu
|
||||
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
#define CONFIGURE_MAXIMUM_SEMAPHORES (2 * RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE)
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
|
||||
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
|
||||
|
||||
@@ -41,7 +41,6 @@ test_shutdown_filesystem (void)
|
||||
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 40
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (16 * 1024)
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
@@ -157,8 +157,6 @@ void test_shutdown_filesystem(void)
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
|
||||
@@ -90,7 +90,6 @@ void test_shutdown_filesystem(void)
|
||||
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 40
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (16 * 1024)
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ test_shutdown_filesystem (void)
|
||||
#define CONFIGURE_MAXIMUM_TASKS 10
|
||||
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 40
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_FILESYSTEM_IMFS
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ test_shutdown_filesystem (void)
|
||||
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 40
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
|
||||
|
||||
|
||||
@@ -262,8 +262,6 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
|
||||
@@ -32,8 +32,6 @@ rtems_task Init(
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
@@ -301,7 +301,7 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
rtems_test_assert(eno == EAGAIN);
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.active_posix_keys == _CONFIGURE_POSIX_KEYS
|
||||
snapshot.active_posix_keys == CONFIGURE_MAXIMUM_POSIX_KEYS
|
||||
);
|
||||
rtems_test_assert(
|
||||
snapshot.active_posix_key_value_pairs == CONFIGURE_MAXIMUM_POSIX_KEYS
|
||||
|
||||
@@ -36,8 +36,6 @@ rtems_task Init(
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
@@ -1030,15 +1030,6 @@ spfatal26_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal26) \
|
||||
$(support_includes)
|
||||
endif
|
||||
|
||||
if TEST_spfatal27
|
||||
sp_tests += spfatal27
|
||||
sp_screens += spfatal27/spfatal27.scn
|
||||
sp_docs += spfatal27/spfatal27.doc
|
||||
spfatal27_SOURCES = spfatal27/init.c
|
||||
spfatal27_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal27) \
|
||||
$(support_includes)
|
||||
endif
|
||||
|
||||
if TEST_spfatal28
|
||||
sp_tests += spfatal28
|
||||
sp_screens += spfatal28/spfatal28.scn
|
||||
|
||||
@@ -152,7 +152,6 @@ RTEMS_TEST_CHECK([spfatal16])
|
||||
RTEMS_TEST_CHECK([spfatal24])
|
||||
RTEMS_TEST_CHECK([spfatal25])
|
||||
RTEMS_TEST_CHECK([spfatal26])
|
||||
RTEMS_TEST_CHECK([spfatal27])
|
||||
RTEMS_TEST_CHECK([spfatal28])
|
||||
RTEMS_TEST_CHECK([spfatal29])
|
||||
RTEMS_TEST_CHECK([spfatal30])
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../spfatal_support/spfatal.h"
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Dornierstrasse 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#define FATAL_ERROR_TEST_NAME "27"
|
||||
#define FATAL_ERROR_DESCRIPTION "libio init no posix key left"
|
||||
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
|
||||
#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED
|
||||
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEYS (-1)
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS (0)
|
||||
|
||||
static void force_error(void)
|
||||
{
|
||||
/* we should not reach this */
|
||||
}
|
||||
|
||||
#include "../spfatal_support/spfatalimpl.h"
|
||||
@@ -1,23 +0,0 @@
|
||||
# Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||
#
|
||||
# embedded brains GmbH
|
||||
# Dornierstrasse 4
|
||||
# 82178 Puchheim
|
||||
# Germany
|
||||
# <rtems@embedded-brains.de>
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.rtems.org/license/LICENSE.
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
|
||||
test set name: spfatal27
|
||||
|
||||
directives:
|
||||
|
||||
rtems_libio_init
|
||||
|
||||
concepts:
|
||||
|
||||
+ Force the fatal error when no POSIX key is left.
|
||||
@@ -1,3 +0,0 @@
|
||||
*** BEGIN OF TEST FATAL 27 ***
|
||||
Fatal error (libio init no posix key left) hit
|
||||
*** END OF TEST FATAL 27 ***
|
||||
@@ -123,9 +123,6 @@ rtems_task Init(
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
|
||||
#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
@@ -125,6 +125,8 @@ typedef enum {
|
||||
IDLE_THREADS_POST,
|
||||
LIBIO_PRE,
|
||||
LIBIO_POST,
|
||||
USER_ENVIRONMENT_PRE,
|
||||
USER_ENVIRONMENT_POST,
|
||||
ROOT_FILESYSTEM_PRE,
|
||||
ROOT_FILESYSTEM_POST,
|
||||
BSP_PRE_DRIVERS_PRE,
|
||||
@@ -513,7 +515,7 @@ FIRST(RTEMS_SYSINIT_POSIX_KEYS)
|
||||
|
||||
LAST(RTEMS_SYSINIT_POSIX_KEYS)
|
||||
{
|
||||
assert(info_is_init(&_POSIX_Keys_Information, 2));
|
||||
assert(info_is_init(&_POSIX_Keys_Information, 1));
|
||||
next_step(POSIX_KEYS_POST);
|
||||
}
|
||||
|
||||
@@ -541,6 +543,24 @@ LAST(RTEMS_SYSINIT_LIBIO)
|
||||
next_step(LIBIO_POST);
|
||||
}
|
||||
|
||||
static size_t user_extensions_pre_user_env;
|
||||
|
||||
FIRST(RTEMS_SYSINIT_USER_ENVIRONMENT)
|
||||
{
|
||||
user_extensions_pre_user_env =
|
||||
_Chain_Node_count_unprotected(&_User_extensions_List.Active);
|
||||
next_step(USER_ENVIRONMENT_PRE);
|
||||
}
|
||||
|
||||
LAST(RTEMS_SYSINIT_USER_ENVIRONMENT)
|
||||
{
|
||||
assert(
|
||||
user_extensions_pre_user_env + 1 ==
|
||||
_Chain_Node_count_unprotected(&_User_extensions_List.Active)
|
||||
);
|
||||
next_step(USER_ENVIRONMENT_POST);
|
||||
}
|
||||
|
||||
FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM)
|
||||
{
|
||||
struct stat st;
|
||||
@@ -842,6 +862,18 @@ static void do_cleanup_push_pop(void)
|
||||
pthread_cleanup_pop(0);
|
||||
}
|
||||
|
||||
static void do_posix_key_create(void)
|
||||
{
|
||||
pthread_key_t key;
|
||||
int eno;
|
||||
|
||||
eno = pthread_key_create(&key, NULL);
|
||||
rtems_test_assert(eno == 0);
|
||||
|
||||
eno = pthread_key_delete(key);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
|
||||
static void do_posix_mq_open(void)
|
||||
{
|
||||
struct mq_attr attr;
|
||||
@@ -925,6 +957,11 @@ static void check_config(void)
|
||||
rtems_test_assert(config->User_initialization_tasks_table != NULL);
|
||||
}
|
||||
|
||||
static void do_use_global_user_env(void)
|
||||
{
|
||||
rtems_libio_use_global_env();
|
||||
}
|
||||
|
||||
static void Init(rtems_task_argument arg)
|
||||
{
|
||||
next_step(INIT_TASK);
|
||||
@@ -939,10 +976,12 @@ static void Init(rtems_task_argument arg)
|
||||
do_task_create();
|
||||
do_timer_create();
|
||||
do_cleanup_push_pop();
|
||||
do_posix_key_create();
|
||||
do_posix_mq_open();
|
||||
do_posix_sem_open();
|
||||
do_posix_shm_open();
|
||||
do_posix_timer_create();
|
||||
do_use_global_user_env();
|
||||
check_config();
|
||||
TEST_END();
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user