diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-10-04 15:32:36 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-10-04 15:32:36 +0000 |
commit | 21dd3ab8b66a29d38a829822ae732ab0ac8e6e62 (patch) | |
tree | fc5169d6fc9ad9b5a19d01f9d284eec9d8253f9b /cpukit/posix/src | |
parent | ad8adccd9b9283b97f3d3900eaacc228d9149fd9 (diff) |
2010-10-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, posix/Makefile.am, posix/src/pthread.c:
* posix/src/pthreadattrgetguardsize.c, posix/src/pthreadattrgetstack.c,
posix/src/pthreadattrsetguardsize.c, posix/src/pthreadattrsetstack.c:
New files.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r-- | cpukit/posix/src/pthread.c | 3 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadattrgetguardsize.c | 33 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadattrgetstack.c | 35 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadattrsetguardsize.c | 36 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadattrsetstack.c | 42 |
5 files changed, 149 insertions, 0 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 45d0ff18fd..06ce1fe168 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -55,6 +55,9 @@ const pthread_attr_t _POSIX_Threads_Default_attributes = { { 0L, 0 } /* sched_ss_init_budget */ #endif }, + #if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE + 0, /* guardsize */ + #endif #if defined(_POSIX_THREAD_CPUTIME) 1, /* cputime_clock_allowed */ #endif diff --git a/cpukit/posix/src/pthreadattrgetguardsize.c b/cpukit/posix/src/pthreadattrgetguardsize.c new file mode 100644 index 0000000000..b3c64fbfad --- /dev/null +++ b/cpukit/posix/src/pthreadattrgetguardsize.c @@ -0,0 +1,33 @@ +/* + * 16.1.1 Thread Creation Attributes + * + * COPYRIGHT (c) 1989-2010. + * 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.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#if HAVE_DECL_PTHREAD_ATTR_GETGUARDSIZE +#include <pthread.h> +#include <errno.h> + +int pthread_attr_getguardsize( + const pthread_attr_t *attr, + size_t *guardsize +) +{ + if ( !attr || !attr->is_initialized || !guardsize ) + return EINVAL; + + *guardsize = attr->guardsize; + return 0; +} +#endif diff --git a/cpukit/posix/src/pthreadattrgetstack.c b/cpukit/posix/src/pthreadattrgetstack.c new file mode 100644 index 0000000000..8303099a96 --- /dev/null +++ b/cpukit/posix/src/pthreadattrgetstack.c @@ -0,0 +1,35 @@ +/* + * 16.1.1 Thread Creation Attributes + * + * COPYRIGHT (c) 1989-2010. + * 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.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#if HAVE_DECL_PTHREAD_ATTR_GETSTACK +#include <pthread.h> +#include <errno.h> + +int pthread_attr_getstack( + const pthread_attr_t *attr, + void **stackaddr, + size_t *stacksize +) +{ + if ( !attr || !attr->is_initialized || !stackaddr || !stacksize ) + return EINVAL; + + *stackaddr = attr->stackaddr; + *stacksize = attr->stacksize; + return 0; +} +#endif diff --git a/cpukit/posix/src/pthreadattrsetguardsize.c b/cpukit/posix/src/pthreadattrsetguardsize.c new file mode 100644 index 0000000000..f69ff7b173 --- /dev/null +++ b/cpukit/posix/src/pthreadattrsetguardsize.c @@ -0,0 +1,36 @@ +/* + * 16.1.1 Thread Creation Attributes + * + * COPYRIGHT (c) 1989-2010. + * 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.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#if HAVE_DECL_PTHREAD_ATTR_SETGUARDSIZE +#include <pthread.h> +#include <errno.h> + +#include <rtems/system.h> +#include <rtems/posix/pthread.h> + +int pthread_attr_setguardsize( + pthread_attr_t *attr, + size_t guardsize +) +{ + if ( !attr || !attr->is_initialized ) + return EINVAL; + + attr->guardsize = guardsize; + return 0; +} +#endif diff --git a/cpukit/posix/src/pthreadattrsetstack.c b/cpukit/posix/src/pthreadattrsetstack.c new file mode 100644 index 0000000000..f97d3ac885 --- /dev/null +++ b/cpukit/posix/src/pthreadattrsetstack.c @@ -0,0 +1,42 @@ +/* + * 16.1.1 Thread Creation Attributes + * + * COPYRIGHT (c) 1989-2010. + * 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.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#if HAVE_DECL_PTHREAD_ATTR_SETSTACK +#include <pthread.h> +#include <errno.h> + +#include <rtems/system.h> +#include <rtems/posix/pthread.h> + +int pthread_attr_setstack( + pthread_attr_t *attr, + void *stackaddr, + size_t stacksize +) +{ + if ( !attr || !attr->is_initialized ) + return EINVAL; + + if (stacksize < PTHREAD_MINIMUM_STACK_SIZE) + attr->stacksize = PTHREAD_MINIMUM_STACK_SIZE; + else + attr->stacksize = stacksize; + + attr->stackaddr = stackaddr; + return 0; +} +#endif |