From 21dd3ab8b66a29d38a829822ae732ab0ac8e6e62 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 4 Oct 2010 15:32:36 +0000 Subject: 2010-10-04 Joel Sherrill * 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. --- cpukit/ChangeLog | 7 +++++ cpukit/Makefile.am | 1 + cpukit/configure.ac | 1 + cpukit/posix/Makefile.am | 32 +++++++++++++---------- cpukit/posix/src/pthread.c | 3 +++ cpukit/posix/src/pthreadattrgetguardsize.c | 33 +++++++++++++++++++++++ cpukit/posix/src/pthreadattrgetstack.c | 35 +++++++++++++++++++++++++ cpukit/posix/src/pthreadattrsetguardsize.c | 36 +++++++++++++++++++++++++ cpukit/posix/src/pthreadattrsetstack.c | 42 ++++++++++++++++++++++++++++++ 9 files changed, 176 insertions(+), 14 deletions(-) create mode 100644 cpukit/posix/src/pthreadattrgetguardsize.c create mode 100644 cpukit/posix/src/pthreadattrgetstack.c create mode 100644 cpukit/posix/src/pthreadattrsetguardsize.c create mode 100644 cpukit/posix/src/pthreadattrsetstack.c diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index b0615eac1e..1e4bc39b10 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2010-10-04 Joel Sherrill + + * 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. + 2010-09-28 Sebastian Huber * posix/src/psignal.c: Fixed NULL pointer access. diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am index 741c7319dc..f5cc54c9fe 100644 --- a/cpukit/Makefile.am +++ b/cpukit/Makefile.am @@ -15,6 +15,7 @@ SUBDIRS += libi2c SUBDIRS += libmisc SUBDIRS += libmd SUBDIRS += libgnat +SUBDIRS += libdbm SUBDIRS += wrapup SUBDIRS += zlib diff --git a/cpukit/configure.ac b/cpukit/configure.ac index d42e8fd1f3..c54708202f 100644 --- a/cpukit/configure.ac +++ b/cpukit/configure.ac @@ -351,6 +351,7 @@ libcsupport/Makefile libnetworking/Makefile librpc/Makefile libmisc/Makefile +libdbm/Makefile libi2c/Makefile libmd/Makefile zlib/Makefile diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index c098fd4305..d75dc98eb4 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -111,20 +111,24 @@ libposix_a_SOURCES += src/mutexattrdestroy.c src/mutexattrgetprioceiling.c \ src/mutextranslatereturncode.c src/mutextrylock.c src/mutexunlock.c ## PTHREAD_C_FILES -libposix_a_SOURCES += src/pthread.c src/pthreadsetcputime.c \ - src/pthreadgetcputime.c src/pthreadgetcpuclockid.c src/pthreadonce.c \ - src/pthreadequal.c src/pthreadself.c src/pthreadexit.c \ - src/pthreaddetach.c src/pthreadjoin.c src/pthreadcreate.c \ - src/pthreadattrsetdetachstate.c src/pthreadattrgetdetachstate.c \ - src/pthreadattrgetstackaddr.c src/pthreadattrsetstackaddr.c \ - src/pthreadattrgetstacksize.c src/pthreadattrsetstacksize.c \ - src/pthreadattrinit.c src/pthreadattrdestroy.c \ - src/pthreadsetschedparam.c src/pthreadgetschedparam.c \ - src/pthreadattrsetschedparam.c src/pthreadattrgetschedparam.c \ - src/pthreadattrgetschedpolicy.c src/pthreadattrsetschedpolicy.c \ - src/pthreadattrgetinheritsched.c src/pthreadattrsetinheritsched.c \ - src/pthreadattrgetscope.c src/pthreadattrsetscope.c \ - src/pthreadinitthreads.c src/psxtransschedparam.c +libposix_a_SOURCES += src/pthreadatfork.c src/pthreadattrdestroy.c \ + src/pthreadattrgetdetachstate.c src/pthreadattrgetinheritsched.c \ + src/pthreadattrgetschedparam.c src/pthreadattrgetschedpolicy.c \ + src/pthreadattrgetscope.c src/pthreadattrgetstackaddr.c \ + src/pthreadattrgetstack.c src/pthreadattrgetstacksize.c \ + src/pthreadattrinit.c src/pthreadattrsetdetachstate.c \ + src/pthreadattrsetguardsize.c src/pthreadattrsetinheritsched.c \ + src/pthreadattrsetschedparam.c src/pthreadattrsetschedpolicy.c \ + src/pthreadattrsetscope.c src/pthreadattrsetstackaddr.c \ + src/pthreadattrsetstack.c src/pthreadattrsetstacksize.c \ + src/pthreadattrgetguardsize.c src/pthread.c \ + src/pthreadcreate.c src/pthreaddetach.c src/pthreadequal.c \ + src/pthreadexit.c src/pthreadgetcpuclockid.c \ + src/pthreadgetcputime.c src/pthreadgetschedparam.c \ + src/pthreadinitthreads.c src/pthreadjoin.c src/pthreadkill.c \ + src/pthreadonce.c src/pthreadself.c src/pthreadsetcputime.c \ + src/pthreadsetschedparam.c src/pthreadsigmask.c \ + src/psxpriorityisvalid.c src/psxtransschedparam.c ## PSIGNAL_C_FILES libposix_a_SOURCES += src/psignal.c src/alarm.c src/kill.c src/killinfo.c \ 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 +#include + +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 +#include + +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 +#include + +#include +#include + +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 +#include + +#include +#include + +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 -- cgit v1.2.3