summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-14 11:20:42 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-25 07:15:18 +0100
commit3b4795b46fa190ea29007a6b9766689cacffe3d2 (patch)
tree0a1bb8cc582370c2469805d580eb0c230a832289
parentconfig: Bring back RTEMS 4.11 configuration table (diff)
downloadrtems-3b4795b46fa190ea29007a6b9766689cacffe3d2.tar.bz2
config: Remove CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_* configuration options. These two options are probably unused, see also: * https://lists.rtems.org/pipermail/users/2019-April/033129.html * https://lists.rtems.org/pipermail/users/2019-April/033130.html Removing them simplifies the configuration. If there is a real user need which shows up after the removal, we can resurrect them on demand. Using CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE would have required the use of the undocumented CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME and CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE configuration options. Update #3874.
-rw-r--r--cpukit/headers.am1
-rw-r--r--cpukit/include/rtems/confdefs.h51
-rw-r--r--cpukit/include/rtems/config.h1
-rw-r--r--cpukit/include/rtems/posix/config.h60
-rw-r--r--cpukit/include/rtems/posix/pthread.h25
-rw-r--r--cpukit/include/rtems/posix/pthreadimpl.h1
-rw-r--r--cpukit/posix/src/pthreadinitthreads.c75
-rw-r--r--testsuites/psxtests/psxfatal01/init.c22
-rw-r--r--testsuites/psxtests/psxfatal02/init.c40
9 files changed, 83 insertions, 193 deletions
diff --git a/cpukit/headers.am b/cpukit/headers.am
index 6f44b833e1..244e435c62 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -189,7 +189,6 @@ include_rtems_debugger_HEADERS += include/rtems/debugger/rtems-debugger-server.h
include_rtems_posix_HEADERS += include/rtems/posix/aio_misc.h
include_rtems_posix_HEADERS += include/rtems/posix/barrierimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/condimpl.h
-include_rtems_posix_HEADERS += include/rtems/posix/config.h
include_rtems_posix_HEADERS += include/rtems/posix/key.h
include_rtems_posix_HEADERS += include/rtems/posix/keyimpl.h
include_rtems_posix_HEADERS += include/rtems/posix/mmanimpl.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 13ba4466f0..6a8b9ecb7e 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2155,32 +2155,14 @@ struct _reent *__getreent(void)
#endif
#ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
- #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
- #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
- #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init
- #endif
-
- #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
- #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
- CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
- #endif
-
- #ifdef CONFIGURE_INIT
- posix_initialization_threads_table POSIX_Initialization_threads[] = {
- { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
- CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
- };
- #endif
-
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
- POSIX_Initialization_threads
+ #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
+ #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init
+ #endif
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
- RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
- #endif /* !CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
-#else /* !CONFIGURE_POSIX_INIT_THREAD_TABLE */
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
- #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
+ #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+ #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+ CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
+ #endif
#endif /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
/**
@@ -2755,17 +2737,14 @@ struct _reent *__getreent(void)
* then we need to install the code that runs that loop.
*/
#ifdef CONFIGURE_INIT
- #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
- defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
- posix_initialization_threads_table * const
- _Configuration_POSIX_Initialization_threads =
- CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME;
-
- const size_t _Configuration_POSIX_Initialization_thread_count =
- CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE;
+ #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE)
+ const posix_initialization_threads_table _POSIX_Threads_User_thread_table = {
+ CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
+ CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+ };
RTEMS_SYSINIT_ITEM(
- _POSIX_Threads_Initialize_user_threads_body,
+ _POSIX_Threads_Initialize_user_thread,
RTEMS_SYSINIT_POSIX_USER_THREADS,
RTEMS_SYSINIT_ORDER_MIDDLE
);
@@ -2990,6 +2969,10 @@ struct _reent *__getreent(void)
#warning "The CONFIGURE_MAXIMUM_PTYS configuration option is obsolete since RTEMS 5.1"
#endif
+#ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
+ #warning "The CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE configuration option is obsolete since RTEMS 5.1"
+#endif
+
#ifdef CONFIGURE_TERMIOS_DISABLED
#warning "The CONFIGURE_TERMIOS_DISABLED configuration option is obsolete since RTEMS 5.1"
#endif
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 24a654e39c..d9f91db741 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -34,7 +34,6 @@
#include <rtems/score/userextdata.h>
#include <rtems/score/watchdogticks.h>
#include <rtems/rtems/config.h>
-#include <rtems/posix/config.h>
#include <rtems/extension.h>
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/rtems/types.h>
diff --git a/cpukit/include/rtems/posix/config.h b/cpukit/include/rtems/posix/config.h
deleted file mode 100644
index a7e60c2fee..0000000000
--- a/cpukit/include/rtems/posix/config.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @file
- *
- * @brief User Defined Configuration Parameters Specific For The POSIX API
- *
- * This include file contains the table of user defined configuration
- * parameters specific for the POSIX API.
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#ifndef _RTEMS_POSIX_CONFIG_H
-#define _RTEMS_POSIX_CONFIG_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup PosixConfig Configuration
- *
- * @ingroup POSIXAPI
- *
- * This encapsulates functionality related to the application's configuration
- * of the Classic API including the maximum number of each class of objects.
- */
-/**@{*/
-
-/**
- * For now, we are only allowing the user to specify the entry point
- * and stack size for POSIX initialization threads.
- */
-typedef struct {
- /** This is the entry point for a POSIX initialization thread. */
- void *(*thread_entry)(void *);
- /** This is the stack size for a POSIX initialization thread. */
- int stack_size;
-} posix_initialization_threads_table;
-
-extern posix_initialization_threads_table * const
- _Configuration_POSIX_Initialization_threads;
-
-extern const size_t _Configuration_POSIX_Initialization_thread_count;
-
-/**@}*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/cpukit/include/rtems/posix/pthread.h b/cpukit/include/rtems/posix/pthread.h
index 5df938e0b9..8aa11c53fe 100644
--- a/cpukit/include/rtems/posix/pthread.h
+++ b/cpukit/include/rtems/posix/pthread.h
@@ -36,15 +36,32 @@ extern "C" {
*/
/**@{**/
+/**
+ * For now, we are only allowing the user to specify the entry point
+ * and stack size for POSIX initialization threads.
+ */
+typedef struct {
+ /** This is the entry point for a POSIX initialization thread. */
+ void *(*thread_entry)(void *);
+ /** This is the stack size for a POSIX initialization thread. */
+ int stack_size;
+} posix_initialization_threads_table;
+
extern const size_t _POSIX_Threads_Minimum_stack_size;
/**
- * @brief POSIX threads initialize user threads body.
+ * @brief Initialization table for the first user POSIX thread.
*
- * This routine creates and starts all configured user
- * initialization threads.
+ * This table is used by _POSIX_Threads_Initialize_user_thread() and
+ * initialized via <rtems/confdefs.h>.
+ */
+extern const posix_initialization_threads_table
+ _POSIX_Threads_User_thread_table;
+
+/**
+ * @brief System initialization handler to create the first user POSIX thread.
*/
-extern void _POSIX_Threads_Initialize_user_threads_body(void);
+extern void _POSIX_Threads_Initialize_user_thread( void );
/**
* The following defines the information control block used to manage
diff --git a/cpukit/include/rtems/posix/pthreadimpl.h b/cpukit/include/rtems/posix/pthreadimpl.h
index fd263c2761..74e46e4d92 100644
--- a/cpukit/include/rtems/posix/pthreadimpl.h
+++ b/cpukit/include/rtems/posix/pthreadimpl.h
@@ -20,7 +20,6 @@
#define _RTEMS_POSIX_PTHREADIMPL_H
#include <rtems/posix/pthread.h>
-#include <rtems/posix/config.h>
#include <rtems/posix/threadsup.h>
#include <rtems/score/assert.h>
#include <rtems/score/objectimpl.h>
diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c
index 89163f43ab..3adaa8b7ab 100644
--- a/cpukit/posix/src/pthreadinitthreads.c
+++ b/cpukit/posix/src/pthreadinitthreads.c
@@ -18,33 +18,22 @@
#include "config.h"
#endif
-#include <errno.h>
+#include <rtems/posix/pthread.h>
+
#include <pthread.h>
-#include <limits.h>
-#include <rtems/config.h>
-#include <rtems/score/stack.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/wkspace.h>
-#include <rtems/posix/posixapi.h>
-#include <rtems/posix/pthreadimpl.h>
-#include <rtems/posix/priorityimpl.h>
-#include <rtems/posix/config.h>
+#include <rtems/score/assert.h>
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/interr.h>
-void _POSIX_Threads_Initialize_user_threads_body(void)
+void _POSIX_Threads_Initialize_user_thread( void )
{
- int eno;
- uint32_t index;
- uint32_t maximum;
- posix_initialization_threads_table *user_threads;
- pthread_t thread_id;
- pthread_attr_t attr;
-
- user_threads = _Configuration_POSIX_Initialization_threads;
- maximum = _Configuration_POSIX_Initialization_thread_count;
+ int eno;
+ const posix_initialization_threads_table *user_thread;
+ pthread_t thread_id;
+ pthread_attr_t attr;
- if ( !user_threads )
- return;
+ user_thread = &_POSIX_Threads_User_thread_table;
/*
* Be careful .. if the default attribute set changes, this may need to.
@@ -53,29 +42,27 @@ void _POSIX_Threads_Initialize_user_threads_body(void)
* to inherit the idle tasks attributes.
*/
- for ( index=0 ; index < maximum ; index++ ) {
- /*
- * There is no way for these calls to fail in this situation.
- */
- eno = pthread_attr_init( &attr );
- _Assert( eno == 0 );
- eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
- _Assert( eno == 0 );
- eno = pthread_attr_setstacksize(&attr, user_threads[ index ].stack_size);
- _Assert( eno == 0 );
+ /*
+ * There is no way for these calls to fail in this situation.
+ */
+ eno = pthread_attr_init( &attr );
+ _Assert( eno == 0 );
+ eno = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
+ _Assert( eno == 0 );
+ eno = pthread_attr_setstacksize( &attr, user_thread->stack_size );
+ _Assert( eno == 0 );
- eno = pthread_create(
- &thread_id,
- &attr,
- user_threads[ index ].thread_entry,
- NULL
- );
- if ( eno != 0 ) {
- _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED );
- }
+ eno = pthread_create(
+ &thread_id,
+ &attr,
+ user_thread->thread_entry,
+ NULL
+ );
+ if ( eno != 0 ) {
+ _Internal_error( INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED );
+ }
- if ( _Thread_Global_constructor == 0 ) {
- _Thread_Global_constructor = thread_id;
- }
+ if ( _Thread_Global_constructor == 0 ) {
+ _Thread_Global_constructor = thread_id;
}
}
diff --git a/testsuites/psxtests/psxfatal01/init.c b/testsuites/psxtests/psxfatal01/init.c
index fb0e2b24ed..ffc5b35b12 100644
--- a/testsuites/psxtests/psxfatal01/init.c
+++ b/testsuites/psxtests/psxfatal01/init.c
@@ -8,27 +8,7 @@
* Classic API Init task create failure
*/
-#include <errno.h>
-
-#include <rtems/posix/posixapi.h>
-
-/*
- * Way too much stack space. Should generate a fatal error
- * on the init task create.
- */
-#define CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
-#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0
-posix_initialization_threads_table POSIX_Initialization_threads[] = {
- { NULL, /* bad thread entry */
- 0
- }
-};
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME POSIX_Initialization_threads
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
- sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
- sizeof(posix_initialization_threads_table)
+#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT NULL
#define FATAL_ERROR_TEST_NAME "1"
#define FATAL_ERROR_DESCRIPTION \
diff --git a/testsuites/psxtests/psxfatal02/init.c b/testsuites/psxtests/psxfatal02/init.c
index 260c0aea0d..eaf933092d 100644
--- a/testsuites/psxtests/psxfatal02/init.c
+++ b/testsuites/psxtests/psxfatal02/init.c
@@ -8,39 +8,25 @@
* Classic API Init task create failure
*/
-#include <errno.h>
-#include <limits.h>
-
-#include <rtems/posix/posixapi.h>
-
-/*
- * Way too much stack space. Should generate a fatal error
- * on the init task create.
- */
-#define CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
-#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0
-posix_initialization_threads_table POSIX_Initialization_threads[] = {
- { POSIX_Init,
-#if INT_MAX < (12 * 1024 * 1024)
- INT_MAX
-#else
- 12 * 1024 * 1024 /* too much stack */
-#endif
- }
-};
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME POSIX_Initialization_threads
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
- sizeof(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) / \
- sizeof(posix_initialization_threads_table)
-
#define FATAL_ERROR_TEST_NAME "2"
#define FATAL_ERROR_DESCRIPTION \
"POSIX API Init thread create failure -- no memory for stack"
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED
+static void *stack_allocator(size_t unused)
+{
+ return NULL;
+}
+
+static void stack_deallocator(void *unused)
+{
+}
+
+#define CONFIGURE_TASK_STACK_ALLOCATOR stack_allocator
+
+#define CONFIGURE_TASK_STACK_DEALLOCATOR stack_deallocator
+
static void force_error(void)
{
/* we will not run this far */