[rtems commit] posix: Simplify pthread_attr_setstack()
Sebastian Huber
sebh at rtems.org
Tue Oct 10 05:44:08 UTC 2017
Module: rtems
Branch: master
Commit: 8c5267a268ae8ce599e61d0e1bdff585e26187c5
Changeset: http://git.rtems.org/rtems/commit/?id=8c5267a268ae8ce599e61d0e1bdff585e26187c5
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Oct 10 07:11:29 2017 +0200
posix: Simplify pthread_attr_setstack()
Simplify
* pthread_attr_setstack(), and
* pthread_attr_setstacksize().
Update #2514.
---
cpukit/posix/src/pthreadattrsetstack.c | 9 +--------
cpukit/posix/src/pthreadattrsetstacksize.c | 8 +-------
testsuites/psxtests/psxgetattrnp01/init.c | 5 ++++-
3 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/cpukit/posix/src/pthreadattrsetstack.c b/cpukit/posix/src/pthreadattrsetstack.c
index 3f62247..b335274 100644
--- a/cpukit/posix/src/pthreadattrsetstack.c
+++ b/cpukit/posix/src/pthreadattrsetstack.c
@@ -22,9 +22,6 @@
#if HAVE_DECL_PTHREAD_ATTR_SETSTACK
-#include <rtems/posix/pthreadimpl.h>
-#include <rtems/score/stackimpl.h>
-
#include <pthread.h>
#include <errno.h>
@@ -37,11 +34,7 @@ int pthread_attr_setstack(
if ( !attr || !attr->is_initialized )
return EINVAL;
- if (stacksize < PTHREAD_MINIMUM_STACK_SIZE)
- attr->stacksize = PTHREAD_MINIMUM_STACK_SIZE;
- else
- attr->stacksize = stacksize;
-
+ attr->stacksize = stacksize;
attr->stackaddr = stackaddr;
return 0;
}
diff --git a/cpukit/posix/src/pthreadattrsetstacksize.c b/cpukit/posix/src/pthreadattrsetstacksize.c
index 4dae0f3..b54531d 100644
--- a/cpukit/posix/src/pthreadattrsetstacksize.c
+++ b/cpukit/posix/src/pthreadattrsetstacksize.c
@@ -20,9 +20,6 @@
#include "config.h"
#endif
-#include <rtems/posix/pthreadimpl.h>
-#include <rtems/score/stackimpl.h>
-
#include <pthread.h>
#include <errno.h>
@@ -34,9 +31,6 @@ int pthread_attr_setstacksize(
if ( !attr || !attr->is_initialized )
return EINVAL;
- if (stacksize < PTHREAD_MINIMUM_STACK_SIZE)
- attr->stacksize = PTHREAD_MINIMUM_STACK_SIZE;
- else
- attr->stacksize = stacksize;
+ attr->stacksize = stacksize;
return 0;
}
diff --git a/testsuites/psxtests/psxgetattrnp01/init.c b/testsuites/psxtests/psxgetattrnp01/init.c
index e5c3975..2b7d699 100644
--- a/testsuites/psxtests/psxgetattrnp01/init.c
+++ b/testsuites/psxtests/psxgetattrnp01/init.c
@@ -47,7 +47,10 @@ static int attribute_compare(
attr1->stackaddr != attr2->stackaddr )
return 1;
- if ( attr1->stacksize != attr2->stacksize )
+ if (
+ attr1->stacksize != 0 &&
+ attr2->stacksize != 0 &&
+ attr1->stacksize != attr2->stacksize )
return 1;
if ( attr1->contentionscope != attr2->contentionscope )
More information about the vc
mailing list