Index: cpukit/posix/include/rtems/posix/pthreadimpl.h
===================================================================
--- cpukit/posix/include/rtems/posix/pthreadimpl.h	(revision 29cacfdbf3a7b90ecb513a591f225e68f14ad340)
+++ cpukit/posix/include/rtems/posix/pthreadimpl.h	(revision 185e46f6a05295755f0f4522cf44c93ec8cbd7d1)
@@ -25,4 +25,5 @@
 #include <rtems/score/objectimpl.h>
 #include <rtems/score/thread.h>
+#include <rtems/score/assert.h>
 
 #ifdef __cplusplus
@@ -49,5 +50,5 @@
  * This variable contains the default POSIX Thread attributes.
  */
-extern const pthread_attr_t _POSIX_Threads_Default_attributes;
+extern pthread_attr_t _POSIX_Threads_Default_attributes;
 
 /**
@@ -76,4 +77,21 @@
  */
 RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void );
+
+/**
+ * @brief Copy POSIX Thread attribute structure.
+ *
+ * This routine copies the attr2 thread attribute structure
+ * to the attr1 Thread Attribute structure.
+ *
+ * @param[in] dst_attr is a pointer to the thread attribute
+ * structure to copy into.
+ *
+ * @param[out] src_attr is a pointer to the thread attribute
+ * structure to copy from.
+ */
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes( 
+  pthread_attr_t        *dst_attr,
+  const pthread_attr_t  *src_attr
+);
 
 /**
@@ -111,4 +129,13 @@
 
 /**
+ * @brief POSIX threads initialize user threads body.
+ *
+ * This routine initializes the thread attributes structure.
+ */
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes( 
+  pthread_attr_t  *attr 
+);
+
+/**
  * @brief Check if a POSIX thread control block is NULL.
  *
@@ -178,4 +205,12 @@
 
 /*
+ * rtems_pthread_attribute_compare
+ */
+int rtems_pthread_attribute_compare(
+  const pthread_attr_t *attr1,
+  const pthread_attr_t *attr2
+);
+ 
+/*
  *  _POSIX_Threads_Allocate
  */
@@ -185,4 +220,22 @@
   return (Thread_Control *) _Objects_Allocate( &_POSIX_Threads_Information );
 }
+
+/*
+ * _POSIX_Threads_Copy_attributes
+ */
+
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes( 
+  pthread_attr_t        *dst_attr,
+  const pthread_attr_t  *src_attr
+)
+{
+  *dst_attr = *src_attr;
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
+  _Assert( 
+    dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
+  );
+  dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
+#endif
+} 
 
 /*
@@ -211,4 +264,18 @@
 
 /*
+ * _POSIX_Threads_Initialize_attributes
+ */
+
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes( 
+  pthread_attr_t  *attr 
+)
+{
+  _POSIX_Threads_Copy_attributes(
+    attr,
+    &_POSIX_Threads_Default_attributes
+  );
+} 
+
+/*
  *  _POSIX_Threads_Is_null
  */
Index: cpukit/posix/src/pthread.c
===================================================================
--- cpukit/posix/src/pthread.c	(revision 29cacfdbf3a7b90ecb513a591f225e68f14ad340)
+++ cpukit/posix/src/pthread.c	(revision 185e46f6a05295755f0f4522cf44c93ec8cbd7d1)
@@ -18,8 +18,10 @@
 #include "config.h"
 #endif
+#include <stdio.h>
 
 #include <errno.h>
 #include <pthread.h>
 #include <limits.h>
+#include <assert.h>
 
 #include <rtems/system.h>
@@ -47,11 +49,12 @@
  *        _POSIX_Threads_Initialize_user_threads will need to be examined.
  */
-const pthread_attr_t _POSIX_Threads_Default_attributes = {
-  true,                       /* is_initialized */
-  NULL,                       /* stackaddr */
-  0,                          /* stacksize -- will be adjusted to minimum */
-  PTHREAD_SCOPE_PROCESS,      /* contentionscope */
-  PTHREAD_INHERIT_SCHED,      /* inheritsched */
-  SCHED_FIFO,                 /* schedpolicy */
+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 */
@@ -64,11 +67,17 @@
     #endif
   },
+
   #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE
-    0,                        /* guardsize */
+    .guardsize = 0,                            /* guardsize */
   #endif
   #if defined(_POSIX_THREAD_CPUTIME)
-    1,                        /* cputime_clock_allowed */
-  #endif
-  PTHREAD_CREATE_JOINABLE,    /* detachstate */
+    .cputime_clock_allowed = 1,                        /* cputime_clock_allowed */
+  #endif
+  .detachstate             = PTHREAD_CREATE_JOINABLE,    /* detachstate */
+  #if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
+    .affinitysetsize         = 0,
+    .affinityset             = NULL,
+    .affinitysetpreallocated = {{0x0}}
+  #endif
 };
 
@@ -188,5 +197,5 @@
 
   /* XXX check all fields are touched */
-  api->Attributes  = _POSIX_Threads_Default_attributes;
+  _POSIX_Threads_Initialize_attributes( &api->Attributes );
   api->detachstate = _POSIX_Threads_Default_attributes.detachstate;
   api->schedpolicy = _POSIX_Threads_Default_attributes.schedpolicy;
@@ -347,4 +356,25 @@
 void _POSIX_Threads_Manager_initialization(void)
 {
+  #if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
+    pthread_attr_t *attr;
+    int i;
+    int max_cpus = 1;
+
+    /* Initialize default attribute. */
+    attr = &_POSIX_Threads_Default_attributes;
+
+    /* We do not support a cpu count over CPU_SETSIZE  */
+    max_cpus = _SMP_Get_processor_count();
+    assert( max_cpus <= CPU_SETSIZE );
+
+    /*  Initialize the affinity to be the set of all available CPU's   */
+    attr->affinityset             = &attr->affinitysetpreallocated;
+    attr->affinitysetsize         = sizeof( *attr->affinityset );
+    CPU_ZERO_S( attr->affinitysetsize, &attr->affinitysetpreallocated );
+
+    for (i=0; i<max_cpus; i++)  
+      CPU_SET_S(i, attr->affinitysetsize, attr->affinityset );
+  #endif
+
   _Objects_Initialize_information(
     &_POSIX_Threads_Information, /* object information table */
Index: cpukit/posix/src/pthreadattrinit.c
===================================================================
--- cpukit/posix/src/pthreadattrinit.c	(revision 29cacfdbf3a7b90ecb513a591f225e68f14ad340)
+++ cpukit/posix/src/pthreadattrinit.c	(revision 185e46f6a05295755f0f4522cf44c93ec8cbd7d1)
@@ -35,5 +35,6 @@
     return EINVAL;
 
-  *attr = _POSIX_Threads_Default_attributes;
-   return 0;
+  _POSIX_Threads_Initialize_attributes( attr );
+
+  return 0;
 }
Index: cpukit/posix/src/pthreadcreate.c
===================================================================
--- cpukit/posix/src/pthreadcreate.c	(revision 29cacfdbf3a7b90ecb513a591f225e68f14ad340)
+++ cpukit/posix/src/pthreadcreate.c	(revision 185e46f6a05295755f0f4522cf44c93ec8cbd7d1)
@@ -28,4 +28,5 @@
 #include <rtems/posix/pthreadimpl.h>
 #include <rtems/posix/time.h>
+#include <rtems/score/cpusetimpl.h>
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/apimutex.h>
@@ -137,4 +138,12 @@
     return rc;
 
+#if defined(RTEMS_SMP)
+#if __RTEMS_HAVE_SYS_CPUSET_H__
+  rc = _CPU_set_Is_valid( attr->affinityset, attr->affinitysetsize );
+  if ( rc != 0 )
+    return EINVAL;
+#endif
+#endif
+
   /*
    *  Currently all POSIX threads are floating point if the hardware
@@ -180,5 +189,4 @@
     name                  /* posix threads don't have a name */
   );
-
   if ( !status ) {
     _POSIX_Threads_Free( the_thread );
@@ -187,4 +195,11 @@
   }
 
+#if defined(RTEMS_SMP)
+#if __RTEMS_HAVE_SYS_CPUSET_H__
+   the_thread->affinity.setsize   = attr->affinitysetsize;
+   *the_thread->affinity.set      = *attr->affinityset;
+#endif
+#endif
+
   /*
    *  finish initializing the per API structure
@@ -192,5 +207,5 @@
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
 
-  api->Attributes  = *the_attr;
+  _POSIX_Threads_Copy_attributes( &api->Attributes, the_attr );
   api->detachstate = the_attr->detachstate;
   api->schedpolicy = schedpolicy;
