summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psx11/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/psxtests/psx11/init.c')
-rw-r--r--testsuites/psxtests/psx11/init.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/testsuites/psxtests/psx11/init.c b/testsuites/psxtests/psx11/init.c
index cbea072ae5..254fe33801 100644
--- a/testsuites/psxtests/psx11/init.c
+++ b/testsuites/psxtests/psx11/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -20,6 +20,10 @@ void *POSIX_Init(
int status;
struct sched_param param;
pthread_attr_t attr;
+ int priority_1;
+ int priority_2;
+ int priority_3;
+ int priority_4;
puts( "\n\n*** POSIX TEST 11 ***" );
@@ -34,32 +38,47 @@ void *POSIX_Init(
/* exercise pthread_setschedparam */
- param.sched_priority = 127;
+ priority_1 = sched_get_priority_max( SCHED_FIFO ); /* was 127 */
+ priority_2 = sched_get_priority_max( SCHED_FIFO ) - 2; /* was 125 */
+ priority_3 = sched_get_priority_max( SCHED_FIFO ) - 6; /* was 121 */
+ priority_4 = sched_get_priority_max( SCHED_FIFO ) - 7; /* was 120 */
- puts( "Init: Setting scheduling parameters to FIFO with priority 127" );
+ param.sched_priority = priority_1;
+
+ printf(
+ "Init: Setting scheduling parameters to FIFO with priority %d\n",
+ priority_1
+ );
status = pthread_setschedparam( Init_id, SCHED_FIFO, &param );
assert( !status );
- param.sched_priority = 125;
+ param.sched_priority = priority_2;
- puts( "Init: Setting scheduling parameters to RR with priority 125" );
+ printf(
+ "Init: Setting scheduling parameters to RR with priority %d\n",
+ priority_2
+ );
status = pthread_setschedparam( Init_id, SCHED_RR, &param );
assert( !status );
- param.sched_priority = 121;
+ param.sched_priority = priority_3;
- puts( "Init: Setting scheduling parameters to OTHER with priority 121" );
+ printf(
+ "Init: Setting scheduling parameters to OTHER with priority %d\n",
+ priority_3
+ );
status = pthread_setschedparam( Init_id, SCHED_OTHER, &param );
assert( !status );
/* create a thread as SCHED_FIFO */
- puts( "Init: create a thread of SCHED_FIFO with priority 120" );
+ printf(
+ "Init: create a thread of SCHED_FIFO with priority %d\n", priority_4 );
status = pthread_attr_init( &attr );
assert( !status );
attr.schedpolicy = SCHED_FIFO;
- attr.schedparam.sched_priority = 120;
+ attr.schedparam.sched_priority = priority_4;
status = pthread_create( &Task_id, &attr, Task_1, NULL );
assert( !status );
@@ -70,12 +89,12 @@ void *POSIX_Init(
/* create a thread as SCHED_RR */
- puts( "Init: create a thread of SCHED_RR with priority 120" );
+ printf( "Init: create a thread of SCHED_RR with priority %d\n", priority_4 );
status = pthread_attr_init( &attr );
assert( !status );
attr.schedpolicy = SCHED_RR;
- attr.schedparam.sched_priority = 120;
+ attr.schedparam.sched_priority = priority_4;
status = pthread_create( &Task_id, &attr, Task_1, NULL );
assert( !status );
@@ -86,12 +105,13 @@ void *POSIX_Init(
/* create a thread as SCHED_OTHER */
- puts( "Init: create a thread of SCHED_OTHER with priority 120" );
+ printf(
+ "Init: create a thread of SCHED_OTHER with priority %d\n", priority_4 );
status = pthread_attr_init( &attr );
assert( !status );
attr.schedpolicy = SCHED_OTHER;
- attr.schedparam.sched_priority = 120;
+ attr.schedparam.sched_priority = priority_4;
status = pthread_create( &Task_id, &attr, Task_1, NULL );
assert( !status );