From 66c9ad8692d26e3a44ee958ed1731472b52a8432 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Sat, 3 Apr 2010 06:07:24 +0000 Subject: Reflect POSIX changes to sched_param. --- testsuites/psxtests/psx07/init.c | 59 +++++++++++++++++---------------- testsuites/psxtests/psx09/init.c | 35 +++++++++---------- testsuites/psxtests/psx12/init.c | 49 +++++++++++++-------------- testsuites/psxtests/psxhdrs/pthread11.c | 10 +++--- testsuites/psxtests/psxhdrs/pthread22.c | 10 +++--- testsuites/psxtests/psxhdrs/sched01.c | 10 +++--- testsuites/psxtests/psxhdrs/sched03.c | 10 +++--- 7 files changed, 93 insertions(+), 90 deletions(-) (limited to 'testsuites/psxtests') diff --git a/testsuites/psxtests/psx07/init.c b/testsuites/psxtests/psx07/init.c index f075beff90..5577a9ab62 100644 --- a/testsuites/psxtests/psx07/init.c +++ b/testsuites/psxtests/psx07/init.c @@ -41,13 +41,14 @@ void print_schedparam( { printf( "%ssched priority = %d\n", prefix, schedparam->sched_priority ); #if defined(_POSIX_SPORADIC_SERVER) - printf( "%sss_low_priority = %d\n", prefix, schedparam->ss_low_priority ); - printf( "%sss_replenish_period = (%ld, %ld)\n", prefix, - schedparam->ss_replenish_period.tv_sec, - schedparam->ss_replenish_period.tv_nsec ); - printf( "%sss_initial_budget = (%ld, %ld)\n", prefix, - schedparam->ss_initial_budget.tv_sec, - schedparam->ss_initial_budget.tv_nsec ); + printf( "%ssched_ss_low_priority = %d\n", + prefix, schedparam->sched_ss_low_priority ); + printf( "%ssched_ss_replenish_period = (%ld, %ld)\n", prefix, + schedparam->sched_ss_repl_period.tv_sec, + schedparam->sched_ss_repl_period.tv_nsec ); + printf( "%ssched_sched_ss_initial_budget = (%ld, %ld)\n", prefix, + schedparam->sched_ss_init_budget.tv_sec, + schedparam->sched_ss_init_budget.tv_nsec ); #else printf( "%s_POSIX_SPORADIC_SERVER is not defined\n" ); #endif @@ -533,38 +534,38 @@ void *POSIX_Init( /* now get sporadic server errors */ - schedparam.ss_replenish_period.tv_sec = 0; - schedparam.ss_replenish_period.tv_nsec = 0; - schedparam.ss_initial_budget.tv_sec = 1; - schedparam.ss_initial_budget.tv_nsec = 1; + schedparam.sched_ss_repl_period.tv_sec = 0; + schedparam.sched_ss_repl_period.tv_nsec = 0; + schedparam.sched_ss_init_budget.tv_sec = 1; + schedparam.sched_ss_init_budget.tv_nsec = 1; puts( "Init - pthread_setschedparam - EINVAL (replenish == 0)" ); status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam ); fatal_directive_check_status_only( status, EINVAL, "replenish == 0" ); - schedparam.ss_replenish_period.tv_sec = 1; - schedparam.ss_replenish_period.tv_nsec = 1; - schedparam.ss_initial_budget.tv_sec = 0; - schedparam.ss_initial_budget.tv_nsec = 0; + schedparam.sched_ss_repl_period.tv_sec = 1; + schedparam.sched_ss_repl_period.tv_nsec = 1; + schedparam.sched_ss_init_budget.tv_sec = 0; + schedparam.sched_ss_init_budget.tv_nsec = 0; puts( "Init - pthread_setschedparam - EINVAL (budget == 0)" ); status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam ); fatal_directive_check_status_only( status, EINVAL, "budget == 0" ); - schedparam.ss_replenish_period.tv_sec = 1; - schedparam.ss_replenish_period.tv_nsec = 0; - schedparam.ss_initial_budget.tv_sec = 1; - schedparam.ss_initial_budget.tv_nsec = 1; + schedparam.sched_ss_repl_period.tv_sec = 1; + schedparam.sched_ss_repl_period.tv_nsec = 0; + schedparam.sched_ss_init_budget.tv_sec = 1; + schedparam.sched_ss_init_budget.tv_nsec = 1; puts( "Init - pthread_setschedparam - EINVAL (replenish < budget)" ); status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam ); fatal_directive_check_status_only( status, EINVAL, "replenish < budget" ); - schedparam.ss_replenish_period.tv_sec = 2; - schedparam.ss_replenish_period.tv_nsec = 0; - schedparam.ss_initial_budget.tv_sec = 1; - schedparam.ss_initial_budget.tv_nsec = 0; - schedparam.ss_low_priority = -1; + schedparam.sched_ss_repl_period.tv_sec = 2; + schedparam.sched_ss_repl_period.tv_nsec = 0; + schedparam.sched_ss_init_budget.tv_sec = 1; + schedparam.sched_ss_init_budget.tv_nsec = 0; + schedparam.sched_ss_low_priority = -1; puts( "Init - pthread_setschedparam - EINVAL (invalid priority)" ); status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam ); @@ -584,12 +585,12 @@ void *POSIX_Init( status = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED ); rtems_test_assert( !status ); - schedparam.ss_replenish_period.tv_sec = 3; - schedparam.ss_replenish_period.tv_nsec = 3; - schedparam.ss_initial_budget.tv_sec = 1; - schedparam.ss_initial_budget.tv_nsec = 1; + schedparam.sched_ss_repl_period.tv_sec = 3; + schedparam.sched_ss_repl_period.tv_nsec = 3; + schedparam.sched_ss_init_budget.tv_sec = 1; + schedparam.sched_ss_init_budget.tv_nsec = 1; schedparam.sched_priority = sched_get_priority_max( SCHED_FIFO ); - schedparam.ss_low_priority = sched_get_priority_max( SCHED_FIFO ) - 6; + schedparam.sched_ss_low_priority = sched_get_priority_max( SCHED_FIFO ) - 6; puts( "Init - pthread_attr_setschedpolicy - SUCCESSFUL" ); status = pthread_attr_setschedpolicy( &attr, SCHED_SPORADIC ); diff --git a/testsuites/psxtests/psx09/init.c b/testsuites/psxtests/psx09/init.c index ca4c5c99ee..4b6af0242d 100644 --- a/testsuites/psxtests/psx09/init.c +++ b/testsuites/psxtests/psx09/init.c @@ -31,13 +31,14 @@ void print_schedparam( { printf( "%ssched priority = %d\n", prefix, schedparam->sched_priority ); #if defined(_POSIX_SPORADIC_SERVER) - printf( "%sss_low_priority = %d\n", prefix, schedparam->ss_low_priority ); - printf( "%sss_replenish_period = (%ld, %ld)\n", prefix, - schedparam->ss_replenish_period.tv_sec, - schedparam->ss_replenish_period.tv_nsec ); - printf( "%sss_initial_budget = (%ld, %ld)\n", prefix, - schedparam->ss_initial_budget.tv_sec, - schedparam->ss_initial_budget.tv_nsec ); + printf( "%ssched_ss_low_priority = %d\n", + prefix, schedparam->sched_ss_low_priority ); + printf( "%ssched_ss_repl_period = (%ld, %ld)\n", prefix, + schedparam->sched_ss_repl_period.tv_sec, + schedparam->sched_ss_repl_period.tv_nsec ); + printf( "%ssched_ss_init_budget = (%ld, %ld)\n", prefix, + schedparam->sched_ss_init_budget.tv_sec, + schedparam->sched_ss_init_budget.tv_nsec ); #else printf( "%s_POSIX_SPORADIC_SERVER is not defined\n" ); #endif @@ -78,13 +79,13 @@ void *POSIX_Init( sprintf( buffer, " - current priority = %d", priority ); print_current_time( "Init: ", buffer ); - schedparam.ss_replenish_period.tv_sec = 0; - schedparam.ss_replenish_period.tv_nsec = 500000000; /* 1/2 second */ - schedparam.ss_initial_budget.tv_sec = 0; - schedparam.ss_initial_budget.tv_nsec = 250000000; /* 1/4 second */ + schedparam.sched_ss_repl_period.tv_sec = 0; + schedparam.sched_ss_repl_period.tv_nsec = 500000000; /* 1/2 second */ + schedparam.sched_ss_init_budget.tv_sec = 0; + schedparam.sched_ss_init_budget.tv_nsec = 250000000; /* 1/4 second */ schedparam.sched_priority = sched_get_priority_max(SCHED_SPORADIC); - schedparam.ss_low_priority = sched_get_priority_max(SCHED_SPORADIC) - 2; + schedparam.sched_ss_low_priority = sched_get_priority_max(SCHED_SPORADIC) - 2; puts( "Init: pthread_setschedparam - SUCCESSFUL (sporadic server)" ); status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam ); @@ -118,17 +119,17 @@ void *POSIX_Init( status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam ); rtems_test_assert( !status ); - schedparam.ss_replenish_period.tv_sec = 0; - schedparam.ss_replenish_period.tv_nsec = 500000000; /* 1/2 second */ - schedparam.ss_initial_budget.tv_sec = 0; - schedparam.ss_initial_budget.tv_nsec = 250000000; /* 1/4 second */ + schedparam.sched_ss_repl_period.tv_sec = 0; + schedparam.sched_ss_repl_period.tv_nsec = 500000000; /* 1/2 second */ + schedparam.sched_ss_init_budget.tv_sec = 0; + schedparam.sched_ss_init_budget.tv_nsec = 250000000; /* 1/4 second */ HIGH_PRIORITY = sched_get_priority_max( SCHED_SPORADIC ); MEDIUM_PRIORITY = sched_get_priority_max( SCHED_SPORADIC ) - 2; LOW_PRIORITY = sched_get_priority_max( SCHED_SPORADIC ) - 4; schedparam.sched_priority = HIGH_PRIORITY; - schedparam.ss_low_priority = LOW_PRIORITY; + schedparam.sched_ss_low_priority = LOW_PRIORITY; puts( "Init: pthread_setschedparam - SUCCESSFUL (sporadic server)" ); status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam ); diff --git a/testsuites/psxtests/psx12/init.c b/testsuites/psxtests/psx12/init.c index c5e6e62ffb..d96b3cdb42 100644 --- a/testsuites/psxtests/psx12/init.c +++ b/testsuites/psxtests/psx12/init.c @@ -27,13 +27,14 @@ void print_schedparam( { printf( "%ssched priority = %d\n", prefix, schedparam->sched_priority ); #if defined(_POSIX_SPORADIC_SERVER) - printf( "%sss_low_priority = %d\n", prefix, schedparam->ss_low_priority ); - printf( "%sss_replenish_period = (%ld, %ld)\n", prefix, - schedparam->ss_replenish_period.tv_sec, - schedparam->ss_replenish_period.tv_nsec ); - printf( "%sss_initial_budget = (%ld, %ld)\n", prefix, - schedparam->ss_initial_budget.tv_sec, - schedparam->ss_initial_budget.tv_nsec ); + printf( "%ssched_ss_low_priority = %d\n", + prefix, schedparam->sched_ss_low_priority ); + printf( "%ssched_ss_repl_period = (%ld, %ld)\n", prefix, + schedparam->sched_ss_repl_period.tv_sec, + schedparam->sched_ss_repl_period.tv_nsec ); + printf( "%ssched_ss_init_budget = (%ld, %ld)\n", prefix, + schedparam->sched_ss_init_budget.tv_sec, + schedparam->sched_ss_init_budget.tv_nsec ); #else printf( "%s_POSIX_SPORADIC_SERVER is not defined\n" ); #endif @@ -82,13 +83,13 @@ void *POSIX_Init( status = pthread_attr_setschedpolicy( &attr, SCHED_SPORADIC ); rtems_test_assert( !status ); - schedparam.ss_replenish_period.tv_sec = 1; - schedparam.ss_replenish_period.tv_nsec = 0; - schedparam.ss_initial_budget.tv_sec = 2; - schedparam.ss_initial_budget.tv_nsec = 0; + schedparam.sched_ss_repl_period.tv_sec = 1; + schedparam.sched_ss_repl_period.tv_nsec = 0; + schedparam.sched_ss_init_budget.tv_sec = 2; + schedparam.sched_ss_init_budget.tv_nsec = 0; schedparam.sched_priority = 200; - schedparam.ss_low_priority = 100; + schedparam.sched_ss_low_priority = 100; status = pthread_attr_setschedparam( &attr, &schedparam ); rtems_test_assert( !status ); @@ -100,32 +101,32 @@ void *POSIX_Init( status = pthread_create( &Task_id, &attr, Task_1, NULL ); rtems_test_assert( status == EINVAL ); - /* invalid ss_low_priority error */ + /* invalid sched_ss_low_priority error */ - schedparam.ss_replenish_period.tv_sec = 2; - schedparam.ss_replenish_period.tv_nsec = 0; - schedparam.ss_initial_budget.tv_sec = 1; - schedparam.ss_initial_budget.tv_nsec = 0; + schedparam.sched_ss_repl_period.tv_sec = 2; + schedparam.sched_ss_repl_period.tv_nsec = 0; + schedparam.sched_ss_init_budget.tv_sec = 1; + schedparam.sched_ss_init_budget.tv_nsec = 0; schedparam.sched_priority = 200; - schedparam.ss_low_priority = -1; + schedparam.sched_ss_low_priority = -1; status = pthread_attr_setschedparam( &attr, &schedparam ); rtems_test_assert( !status ); - puts( "Init: pthread_create - EINVAL (invalid ss_low_priority)" ); + puts( "Init: pthread_create - EINVAL (invalid sched_ss_low_priority)" ); status = pthread_create( &Task_id, &attr, Task_1, NULL ); rtems_test_assert( status == EINVAL ); /* create a thread as a sporadic server */ - schedparam.ss_replenish_period.tv_sec = 2; - schedparam.ss_replenish_period.tv_nsec = 0; - schedparam.ss_initial_budget.tv_sec = 1; - schedparam.ss_initial_budget.tv_nsec = 0; + schedparam.sched_ss_repl_period.tv_sec = 2; + schedparam.sched_ss_repl_period.tv_nsec = 0; + schedparam.sched_ss_init_budget.tv_sec = 1; + schedparam.sched_ss_init_budget.tv_nsec = 0; schedparam.sched_priority = sched_get_priority_max( SCHED_FIFO ); - schedparam.ss_low_priority = sched_get_priority_max( SCHED_FIFO ) - 6; + schedparam.sched_ss_low_priority = sched_get_priority_max( SCHED_FIFO ) - 6; status = pthread_attr_setschedparam( &attr, &schedparam ); rtems_test_assert( !status ); diff --git a/testsuites/psxtests/psxhdrs/pthread11.c b/testsuites/psxtests/psxhdrs/pthread11.c index 8ccf2d018c..bc0eb7dd6e 100644 --- a/testsuites/psxtests/psxhdrs/pthread11.c +++ b/testsuites/psxtests/psxhdrs/pthread11.c @@ -42,11 +42,11 @@ void test( void ) param.sched_priority = 0; #ifdef _POSIX_SPORADIC_SERVER - param.ss_low_priority = 0; - param.ss_replenish_period.tv_sec = 0; - param.ss_replenish_period.tv_nsec = 0; - param.ss_initial_budget.tv_sec = 0; - param.ss_initial_budget.tv_nsec = 0; + param.sched_ss_low_priority = 0; + param.sched_ss_repl_period.tv_sec = 0; + param.sched_ss_repl_period.tv_nsec = 0; + param.sched_ss_init_budget.tv_sec = 0; + param.sched_ss_init_budget.tv_nsec = 0; #endif result = pthread_setschedparam( thread, policy, ¶m ); diff --git a/testsuites/psxtests/psxhdrs/pthread22.c b/testsuites/psxtests/psxhdrs/pthread22.c index 74bf2252d1..ba15472256 100644 --- a/testsuites/psxtests/psxhdrs/pthread22.c +++ b/testsuites/psxtests/psxhdrs/pthread22.c @@ -40,11 +40,11 @@ void test( void ) param.sched_priority = 0; #ifdef _POSIX_SPORADIC_SERVER - param.ss_low_priority = 0; - param.ss_replenish_period.tv_sec = 0; - param.ss_replenish_period.tv_nsec = 0; - param.ss_initial_budget.tv_sec = 0; - param.ss_initial_budget.tv_nsec = 0; + param.sched_ss_low_priority = 0; + param.sched_ss_repl_period.tv_sec = 0; + param.sched_ss_repl_period.tv_nsec = 0; + param.sched_ss_init_budget.tv_sec = 0; + param.sched_ss_init_budget.tv_nsec = 0; #endif result = pthread_setschedparam( thread, policy, ¶m ); diff --git a/testsuites/psxtests/psxhdrs/sched01.c b/testsuites/psxtests/psxhdrs/sched01.c index aa862c99b1..44b1c8e01b 100644 --- a/testsuites/psxtests/psxhdrs/sched01.c +++ b/testsuites/psxtests/psxhdrs/sched01.c @@ -34,11 +34,11 @@ void test( void ) param.sched_priority = 0; #ifdef _POSIX_SPORADIC_SERVER - param.ss_low_priority = 0; - param.ss_replenish_period.tv_sec = 0; - param.ss_replenish_period.tv_nsec = 0; - param.ss_initial_budget.tv_sec = 0; - param.ss_initial_budget.tv_nsec = 0; + param.sched_ss_low_priority = 0; + param.sched_ss_repl_period.tv_sec = 0; + param.sched_ss_repl_period.tv_nsec = 0; + param.sched_ss_init_budget.tv_sec = 0; + param.sched_ss_init_budget.tv_nsec = 0; #endif result = sched_setparam( pid, ¶m ); diff --git a/testsuites/psxtests/psxhdrs/sched03.c b/testsuites/psxtests/psxhdrs/sched03.c index e860d0e52c..ba4dccf1b8 100644 --- a/testsuites/psxtests/psxhdrs/sched03.c +++ b/testsuites/psxtests/psxhdrs/sched03.c @@ -42,11 +42,11 @@ void test( void ) param.sched_priority = 0; #ifdef _POSIX_SPORADIC_SERVER - param.ss_low_priority = 0; - param.ss_replenish_period.tv_sec = 0; - param.ss_replenish_period.tv_nsec = 0; - param.ss_initial_budget.tv_sec = 0; - param.ss_initial_budget.tv_nsec = 0; + param.sched_ss_low_priority = 0; + param.sched_ss_repl_period.tv_sec = 0; + param.sched_ss_repl_period.tv_nsec = 0; + param.sched_ss_init_budget.tv_sec = 0; + param.sched_ss_init_budget.tv_nsec = 0; #endif result = sched_setscheduler( pid, policy, ¶m ); -- cgit v1.2.3