summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-10 07:18:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-10 07:18:09 +0200
commitbd5be58fa6b4f1108fc69c8ff55cf2d20ddde620 (patch)
tree747a03289a5f31df52a69f04a57a916b069d4a78 /cpukit/posix/src
parentposix: Constify default thread processor affinity (diff)
downloadrtems-bd5be58fa6b4f1108fc69c8ff55cf2d20ddde620.tar.bz2
posix: Unconditional thread attribute support
Update #2514.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/pthread.c39
-rw-r--r--cpukit/posix/src/pthreadattrdefault.c60
-rw-r--r--cpukit/posix/src/pthreadattrdestroy.c3
-rw-r--r--cpukit/posix/src/pthreadattrinit.c6
-rw-r--r--cpukit/posix/src/pthreadattrsetguardsize.c4
-rw-r--r--cpukit/posix/src/pthreadattrsetinheritsched.c3
-rw-r--r--cpukit/posix/src/pthreadattrsetschedpolicy.c3
-rw-r--r--cpukit/posix/src/pthreadattrsetscope.c3
-rw-r--r--cpukit/posix/src/pthreadcreate.c1
9 files changed, 64 insertions, 58 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 171d0366df..17f7fe3a82 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -43,45 +43,6 @@
Thread_Information _POSIX_Threads_Information;
-/*
- * The default pthreads attributes structure.
- *
- * NOTE: Be careful .. if the default attribute set changes,
- * _POSIX_Threads_Initialize_user_threads will need to be examined.
- */
-const pthread_attr_t _POSIX_Threads_Default_attributes = {
- .is_initialized = true, /* is_initialized */
- .stackaddr = NULL, /* stackaddr */
- .stacksize = 0, /* stacksize -- will be adjusted to minimum */
- .contentionscope = PTHREAD_SCOPE_PROCESS, /* contentionscope */
- .inheritsched = PTHREAD_INHERIT_SCHED, /* inheritsched */
- .schedpolicy = SCHED_FIFO, /* schedpolicy */
- .schedparam =
- { /* schedparam */
- 2, /* sched_priority */
- #if defined(_POSIX_SPORADIC_SERVER) || \
- defined(_POSIX_THREAD_SPORADIC_SERVER)
- 0, /* sched_ss_low_priority */
- { 0L, 0 }, /* sched_ss_repl_period */
- { 0L, 0 }, /* sched_ss_init_budget */
- 0 /* sched_ss_max_repl */
- #endif
- },
-
- #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
- .guardsize = 0, /* guardsize */
- #endif
- #if defined(_POSIX_THREAD_CPUTIME)
- .cputime_clock_allowed = 1, /* cputime_clock_allowed */
- #endif
- .detachstate = PTHREAD_CREATE_JOINABLE, /* detachstate */
- .affinitysetsize =
- sizeof( _POSIX_Threads_Default_attributes.affinitysetpreallocated ),
- .affinityset =
- &_POSIX_Threads_Default_attributes.affinitysetpreallocated,
- .affinitysetpreallocated = { { -1L } }
-};
-
void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
{
POSIX_API_Control *api;
diff --git a/cpukit/posix/src/pthreadattrdefault.c b/cpukit/posix/src/pthreadattrdefault.c
new file mode 100644
index 0000000000..efd6671fe6
--- /dev/null
+++ b/cpukit/posix/src/pthreadattrdefault.c
@@ -0,0 +1,60 @@
+/**
+ * @file
+ *
+ * @brief Private Support Information for POSIX Threads
+ * @ingroup POSIX_PTHREADS Private Threads
+ */
+
+/*
+ * 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/posix/pthreadattrimpl.h>
+
+/*
+ * The default pthreads attributes structure.
+ *
+ * NOTE: Be careful .. if the default attribute set changes,
+ * _POSIX_Threads_Initialize_user_threads will need to be examined.
+ */
+const pthread_attr_t _POSIX_Threads_Default_attributes = {
+ .is_initialized = true, /* is_initialized */
+ .stackaddr = NULL, /* stackaddr */
+ .stacksize = 0, /* stacksize -- will be adjusted to minimum */
+ .contentionscope = PTHREAD_SCOPE_PROCESS, /* contentionscope */
+ .inheritsched = PTHREAD_INHERIT_SCHED, /* inheritsched */
+ .schedpolicy = SCHED_FIFO, /* schedpolicy */
+ .schedparam =
+ { /* schedparam */
+ 2, /* sched_priority */
+ #if defined(_POSIX_SPORADIC_SERVER) || \
+ defined(_POSIX_THREAD_SPORADIC_SERVER)
+ 0, /* sched_ss_low_priority */
+ { 0L, 0 }, /* sched_ss_repl_period */
+ { 0L, 0 }, /* sched_ss_init_budget */
+ 0 /* sched_ss_max_repl */
+ #endif
+ },
+
+ #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
+ .guardsize = 0, /* guardsize */
+ #endif
+ #if defined(_POSIX_THREAD_CPUTIME)
+ .cputime_clock_allowed = 1, /* cputime_clock_allowed */
+ #endif
+ .detachstate = PTHREAD_CREATE_JOINABLE, /* detachstate */
+ .affinitysetsize =
+ sizeof( _POSIX_Threads_Default_attributes.affinitysetpreallocated ),
+ .affinityset =
+ &_POSIX_Threads_Default_attributes.affinitysetpreallocated,
+ .affinitysetpreallocated = { { -1L } }
+};
diff --git a/cpukit/posix/src/pthreadattrdestroy.c b/cpukit/posix/src/pthreadattrdestroy.c
index d36c1d6dfe..7d30be9ed5 100644
--- a/cpukit/posix/src/pthreadattrdestroy.c
+++ b/cpukit/posix/src/pthreadattrdestroy.c
@@ -20,8 +20,7 @@
#include <pthread.h>
#include <errno.h>
-
-#include <rtems/system.h>
+#include <stdbool.h>
int pthread_attr_destroy(
pthread_attr_t *attr
diff --git a/cpukit/posix/src/pthreadattrinit.c b/cpukit/posix/src/pthreadattrinit.c
index 311e42cc7a..d69cac497b 100644
--- a/cpukit/posix/src/pthreadattrinit.c
+++ b/cpukit/posix/src/pthreadattrinit.c
@@ -18,11 +18,7 @@
#include "config.h"
#endif
-#include <pthread.h>
-#include <errno.h>
-
-#include <rtems/system.h>
-#include <rtems/posix/pthreadimpl.h>
+#include <rtems/posix/pthreadattrimpl.h>
/**
* 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
diff --git a/cpukit/posix/src/pthreadattrsetguardsize.c b/cpukit/posix/src/pthreadattrsetguardsize.c
index 829a1b30c6..766066ce24 100644
--- a/cpukit/posix/src/pthreadattrsetguardsize.c
+++ b/cpukit/posix/src/pthreadattrsetguardsize.c
@@ -19,12 +19,10 @@
#endif
#if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
+
#include <pthread.h>
#include <errno.h>
-#include <rtems/system.h>
-#include <rtems/posix/pthreadimpl.h>
-
int pthread_attr_setguardsize(
pthread_attr_t *attr,
size_t guardsize
diff --git a/cpukit/posix/src/pthreadattrsetinheritsched.c b/cpukit/posix/src/pthreadattrsetinheritsched.c
index 8ce3a5db0e..c3b8a53053 100644
--- a/cpukit/posix/src/pthreadattrsetinheritsched.c
+++ b/cpukit/posix/src/pthreadattrsetinheritsched.c
@@ -23,9 +23,6 @@
#include <pthread.h>
#include <errno.h>
-#include <rtems/system.h>
-#include <rtems/posix/pthreadimpl.h>
-
int pthread_attr_setinheritsched(
pthread_attr_t *attr,
int inheritsched
diff --git a/cpukit/posix/src/pthreadattrsetschedpolicy.c b/cpukit/posix/src/pthreadattrsetschedpolicy.c
index 9adec1b8f9..235e7a8ad1 100644
--- a/cpukit/posix/src/pthreadattrsetschedpolicy.c
+++ b/cpukit/posix/src/pthreadattrsetschedpolicy.c
@@ -23,9 +23,6 @@
#include <pthread.h>
#include <errno.h>
-#include <rtems/system.h>
-#include <rtems/posix/pthreadimpl.h>
-
int pthread_attr_setschedpolicy(
pthread_attr_t *attr,
int policy
diff --git a/cpukit/posix/src/pthreadattrsetscope.c b/cpukit/posix/src/pthreadattrsetscope.c
index 78b0fde984..1d8bec0467 100644
--- a/cpukit/posix/src/pthreadattrsetscope.c
+++ b/cpukit/posix/src/pthreadattrsetscope.c
@@ -23,9 +23,6 @@
#include <pthread.h>
#include <errno.h>
-#include <rtems/system.h>
-#include <rtems/posix/pthreadimpl.h>
-
int pthread_attr_setscope(
pthread_attr_t *attr,
int contentionscope
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index ebb96bf8a4..41e2b67122 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -27,6 +27,7 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/pthreadimpl.h>
+#include <rtems/posix/pthreadattrimpl.h>
#include <rtems/score/assert.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/threadimpl.h>