[rtems commit] posix: Fix return status of pthread_cancel()

Sebastian Huber sebh at rtems.org
Tue May 17 06:40:55 UTC 2016


Module:    rtems
Branch:    4.11
Commit:    94b1ba5aedfff76a9b42721e5109679ac9d417e2
Changeset: http://git.rtems.org/rtems/commit/?id=94b1ba5aedfff76a9b42721e5109679ac9d417e2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May 13 14:59:31 2016 +0200

posix: Fix return status of pthread_cancel()

POSIX recommends ESRCH in case no thread exists for the specified
identifier.

Update #2713.

---

 cpukit/posix/src/cancel.c            | 2 +-
 testsuites/psxtests/psxcancel/init.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
index 0267b48..f103d65 100644
--- a/cpukit/posix/src/cancel.c
+++ b/cpukit/posix/src/cancel.c
@@ -64,5 +64,5 @@ int pthread_cancel(
       break;
   }
 
-  return EINVAL;
+  return ESRCH;
 }
diff --git a/testsuites/psxtests/psxcancel/init.c b/testsuites/psxtests/psxcancel/init.c
index c8c96b55..dba26b9 100644
--- a/testsuites/psxtests/psxcancel/init.c
+++ b/testsuites/psxtests/psxcancel/init.c
@@ -101,9 +101,9 @@ void *countTaskAsync(void *ignored)
   sc = pthread_setcanceltype(12, &old);
   fatal_posix_service_status( sc, EINVAL, "cancel type EINVAL" );
 
-  puts( "Init - pthread_cancel - bad ID - EINVAL" );
+  puts( "Init - pthread_cancel - bad ID - ESRCH" );
   sc = pthread_cancel(0x100);
-  fatal_posix_service_status( sc, EINVAL, "cancel bad Id" );
+  fatal_posix_service_status( sc, ESRCH, "cancel bad Id" );
 
   /* Start countTask deferred */
   {



More information about the vc mailing list