Changeset ce6e9ec2 in rtems
- Timestamp:
- 06/14/16 04:50:38 (7 years ago)
- Branches:
- 5, master
- Children:
- 2df7fcf
- Parents:
- 655ce0fb
- git-author:
- Sebastian Huber <sebastian.huber@…> (06/14/16 04:50:38)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (06/22/16 12:00:27)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/posix/src/mutexattrsetprioceiling.c
r655ce0fb rce6e9ec2 22 22 #include <pthread.h> 23 23 24 #include <rtems/system.h>25 #include <rtems/score/coremuteximpl.h>26 #include <rtems/score/watchdog.h>27 #include <rtems/posix/muteximpl.h>28 #include <rtems/posix/priorityimpl.h>29 30 24 /* 31 25 * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 … … 40 34 return EINVAL; 41 35 42 if ( !_POSIX_Priority_Is_valid( prioceiling ) )43 return EINVAL;44 45 36 attr->prio_ceiling = prioceiling; 46 37 return 0; -
cpukit/posix/src/mutexinit.c
r655ce0fb rce6e9ec2 37 37 const pthread_mutexattr_t *the_attr; 38 38 POSIX_Mutex_Protocol protocol; 39 Priority_Control priority; 39 40 40 41 if ( attr ) the_attr = attr; … … 87 88 } 88 89 89 /*90 * Validate the priority ceiling field -- should always be valid.91 */92 if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )93 return EINVAL;94 95 90 #if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) 96 91 /* … … 110 105 #endif 111 106 107 if ( protocol == POSIX_MUTEX_PRIORITY_CEILING ) { 108 if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) ) { 109 return EINVAL; 110 } 111 112 priority = _POSIX_Priority_To_core( the_attr->prio_ceiling ); 113 } 114 112 115 the_mutex = _POSIX_Mutex_Allocate(); 113 116 … … 120 123 the_mutex->is_recursive = ( the_attr->type == PTHREAD_MUTEX_RECURSIVE ); 121 124 122 switch ( the_mutex->protocol ) {125 switch ( protocol ) { 123 126 case POSIX_MUTEX_PRIORITY_CEILING: 124 127 _CORE_ceiling_mutex_Initialize( 125 128 &the_mutex->Mutex, 126 _POSIX_Priority_To_core( the_attr->prio_ceiling )129 priority 127 130 ); 128 131 break; -
testsuites/psxtests/psx05/init.c
r655ce0fb rce6e9ec2 17 17 #include "system.h" 18 18 #include <errno.h> 19 #include <limits.h> 19 20 20 21 #include <rtems/score/todimpl.h> … … 376 377 rtems_test_assert( status == EINVAL ); 377 378 378 puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (invalid priority)" ); 379 status = pthread_mutexattr_setprioceiling( &attr, 512 ); 380 if ( status != EINVAL ) 381 printf( "status = %d\n", status ); 382 rtems_test_assert( status == EINVAL ); 379 puts( "Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MAX)" ); 380 status = pthread_mutexattr_setprioceiling( &attr, INT_MAX ); 381 rtems_test_assert( status == 0 ); 382 383 puts( "Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MIN)" ); 384 status = pthread_mutexattr_setprioceiling( &attr, INT_MIN ); 385 rtems_test_assert( status == 0 ); 383 386 384 387 puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (not initialized)" ); … … 410 413 rtems_test_assert( status == EINVAL ); 411 414 412 /* must get around error checks in attribute set routines */ 413 attr.protocol = PTHREAD_PRIO_INHERIT; 414 attr.prio_ceiling = -1; 415 puts( "Init: pthread_mutexattr_setprotocol - SUCCESSFUL" ); 416 status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT ); 417 rtems_test_assert( !status ); 418 419 puts( "Init: pthread_mutexattr_setprioceiling - SUCCESSFUL" ); 420 status = pthread_mutexattr_setprioceiling( &attr, -1 ); 421 rtems_test_assert( !status ); 415 422 416 423 puts( "Init: pthread_mutex_init - EINVAL (bad priority ceiling)" ); -
testsuites/psxtests/psx05/psx05.scn
r655ce0fb rce6e9ec2 1 *** POSIX TEST5 ***1 *** BEGIN OF TEST PSX 5 *** 2 2 Init's ID is 0x0b010001 3 3 Init: pthread_mutexattr_init - EINVAL (NULL attr) … … 27 27 Init: pthread_mutexattr_getprioceiling - EINVAL (not initialized) 28 28 Init: pthread_mutexattr_setprioceiling - EINVAL (NULL attr) 29 Init: pthread_mutexattr_setprioceiling - EINVAL (invalid priority) 29 Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MAX) 30 Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MIN) 30 31 Init: pthread_mutexattr_setprioceiling - EINVAL (not initialized) 31 32 … … 33 34 Init: pthread_mutex_init - EINVAL (not initialized attr) 34 35 Init: pthread_mutex_init - EINVAL (bad protocol) 36 Init: pthread_mutexattr_setprotocol - SUCCESSFUL 37 Init: pthread_mutexattr_setprioceiling - SUCCESSFUL 35 38 Init: pthread_mutex_init - EINVAL (bad priority ceiling) 36 39 Init: Resetting mutex attributes … … 83 86 Init: pthread_setschedparam - Setting Task2 priority to highest 84 87 Task 2: pthread_mutex_lock unavailable (inherit case) 85 Init: pthread_getschedparam - priority = 2 5488 Init: pthread_getschedparam - priority = 2 86 89 Init: pthread_mutex_unlock - SUCCESSFUL 87 90 Task 2: mutex acquired … … 104 107 Init: pthread_getschedparam - priority = 2 105 108 Init: pthread_mutex_trylock - SUCCESSFUL 106 Init: pthread_getschedparam - priority = 2 00109 Init: pthread_getschedparam - priority = 2 107 110 Init: pthread_setschedparam - set Task3 priority to highest 108 111 Init: Sleep 1 second … … 117 120 Init: pthread_mutex_lock - EINVAL (priority ceiling violation) 118 121 Init: Recursive Mutex 119 *** END OF POSIX TEST5 ***122 *** END OF TEST PSX 5 ***
Note: See TracChangeset
for help on using the changeset viewer.