summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-01 14:16:48 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-02 14:05:02 +0200
commit3b3d1489e409d451b4e7ffabd706d0205f400def (patch)
tree6c7e25427190f5f8de8bdae99e964cc4023c21ae
parentd9d0a84f8584042f5c594a4c4306a6d1ad87835e (diff)
downloadrtems-3b3d1489e409d451b4e7ffabd706d0205f400def.tar.bz2
posix: glibc compatibility
-rw-r--r--cpukit/posix/src/setcancelstate.c7
-rw-r--r--cpukit/posix/src/setcanceltype.c7
-rw-r--r--testsuites/psxtests/psxcancel/init.c8
-rw-r--r--testsuites/psxtests/psxcancel/psxcancel.scn6
4 files changed, 13 insertions, 15 deletions
diff --git a/cpukit/posix/src/setcancelstate.c b/cpukit/posix/src/setcancelstate.c
index 0ae7339e46..a451c2c4b4 100644
--- a/cpukit/posix/src/setcancelstate.c
+++ b/cpukit/posix/src/setcancelstate.c
@@ -50,9 +50,6 @@ int pthread_setcancelstate(
if ( _ISR_Is_in_progress() )
return EPROTO;
- if ( !oldstate )
- return EINVAL;
-
if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
return EINVAL;
@@ -61,7 +58,9 @@ int pthread_setcancelstate(
executing = _Thread_Executing;
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];
- *oldstate = thread_support->cancelability_state;
+ if (oldstate != NULL)
+ *oldstate = thread_support->cancelability_state;
+
thread_support->cancelability_state = state;
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
diff --git a/cpukit/posix/src/setcanceltype.c b/cpukit/posix/src/setcanceltype.c
index 2ad7cc900e..8c4687a981 100644
--- a/cpukit/posix/src/setcanceltype.c
+++ b/cpukit/posix/src/setcanceltype.c
@@ -50,9 +50,6 @@ int pthread_setcanceltype(
if ( _ISR_Is_in_progress() )
return EPROTO;
- if ( !oldtype )
- return EINVAL;
-
if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
return EINVAL;
@@ -61,7 +58,9 @@ int pthread_setcanceltype(
executing = _Thread_Executing;
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];
- *oldtype = thread_support->cancelability_type;
+ if ( oldtype != NULL )
+ *oldtype = thread_support->cancelability_type;
+
thread_support->cancelability_type = type;
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
diff --git a/testsuites/psxtests/psxcancel/init.c b/testsuites/psxtests/psxcancel/init.c
index 2007529d42..4af4e76652 100644
--- a/testsuites/psxtests/psxcancel/init.c
+++ b/testsuites/psxtests/psxcancel/init.c
@@ -95,17 +95,17 @@ void *countTaskAsync(void *ignored)
TEST_BEGIN();
/* generate some error conditions */
- puts( "Init - pthread_setcancelstate - NULL oldstate - EINVAL" );
+ puts( "Init - pthread_setcancelstate - NULL oldstate" );
sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- fatal_posix_service_status( sc, EINVAL, "cancel state EINVAL" );
+ fatal_posix_service_status( sc, 0, "cancel state NULL" );
puts( "Init - pthread_setcancelstate - bad state - EINVAL" );
sc = pthread_setcancelstate(12, &old);
fatal_posix_service_status( sc, EINVAL, "cancel state EINVAL" );
- puts( "Init - pthread_setcanceltype - NULL oldtype - EINVAL" );
+ puts( "Init - pthread_setcanceltype - NULL oldtype" );
sc = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
- fatal_posix_service_status( sc, EINVAL, "cancel type EINVAL" );
+ fatal_posix_service_status( sc, 0, "cancel type NULL" );
puts( "Init - pthread_setcanceltype - bad type - EINVAL" );
sc = pthread_setcanceltype(12, &old);
diff --git a/testsuites/psxtests/psxcancel/psxcancel.scn b/testsuites/psxtests/psxcancel/psxcancel.scn
index b51dd73f5f..7bc9498b01 100644
--- a/testsuites/psxtests/psxcancel/psxcancel.scn
+++ b/testsuites/psxtests/psxcancel/psxcancel.scn
@@ -1,7 +1,7 @@
-*** POSIX CANCEL TEST ***
-Init - pthread_setcancelstate - NULL oldstate - EINVAL
+*** BEGIN OF TEST PSXCANCEL ***
+Init - pthread_setcancelstate - NULL oldstate
Init - pthread_setcancelstate - bad state - EINVAL
-Init - pthread_setcanceltype - NULL oldtype - EINVAL
+Init - pthread_setcanceltype - NULL oldtype
Init - pthread_setcanceltype - bad type - EINVAL
Init - pthread_cancel - bad ID - EINVAL
countTaskDeferred: elapsed time (second): 0