Ignore:
Timestamp:
Apr 16, 2004, 9:24:30 AM (16 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
874297f3
Parents:
048dcd2
Message:

Remove stray white spaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psx05/init.c

    r048dcd2 r1b4f2b30  
    1 /* 
     1/*
    22 *  COPYRIGHT (c) 1989-1999.
    33 *  On-Line Applications Research Corporation (OAR).
     
    1414#include <errno.h>
    1515
    16 #define MUTEX_BAD_ID 0xfffffffe 
     16#define MUTEX_BAD_ID 0xfffffffe
    1717
    1818void Print_mutexattr(
     
    8989
    9090  assert( MUTEX_BAD_ID != PTHREAD_MUTEX_INITIALIZER );
    91   Mutex_bad_id = MUTEX_BAD_ID; 
     91  Mutex_bad_id = MUTEX_BAD_ID;
    9292
    9393  puts( "\n\n*** POSIX TEST 5 ***" );
     
    101101  Init_id = pthread_self();
    102102  printf( "Init's ID is 0x%08x\n", Init_id );
    103  
     103
    104104  /* tes pthread_mutex_attr_init */
    105105
     
    138138  status = pthread_mutexattr_getpshared( NULL, &pshared );
    139139  assert( status == EINVAL );
    140  
     140
    141141  puts( "Init: pthread_mutexattr_getpshared - EINVAL (NULL pshared)" );
    142142  status = pthread_mutexattr_getpshared( &attr, NULL );
    143143  assert( status == EINVAL );
    144  
     144
    145145  puts( "Init: pthread_mutexattr_getpshared - EINVAL (not initialized)" );
    146146  status = pthread_mutexattr_getpshared( &destroyed_attr, &pshared );
     
    151151  status = pthread_mutexattr_setpshared( NULL, pshared );
    152152  assert( status == EINVAL );
    153  
     153
    154154  pshared = PTHREAD_PROCESS_PRIVATE;
    155155  puts( "Init: pthread_mutexattr_setpshared - EINVAL (not initialized)" );
     
    164164  status = pthread_mutexattr_getprotocol( NULL, &protocol );
    165165  assert( status == EINVAL );
    166  
     166
    167167  puts( "Init: pthread_mutexattr_getprotocol - EINVAL (NULL protocol)" );
    168168  status = pthread_mutexattr_getprotocol( &attr, NULL );
    169169  assert( status == EINVAL );
    170  
     170
    171171  puts( "Init: pthread_mutexattr_getprotocol - EINVAL (not initialized)" );
    172172  status = pthread_mutexattr_getprotocol( &destroyed_attr, &protocol );
    173173  assert( status == EINVAL );
    174  
     174
    175175  puts( "Init: pthread_mutexattr_setprotocol - EINVAL (NULL attr)" );
    176176  status = pthread_mutexattr_setprotocol( NULL, PTHREAD_PRIO_NONE );
    177177  assert( status == EINVAL );
    178  
     178
    179179  puts( "Init: pthread_mutexattr_setprotocol - EINVAL (invalid protocol)" );
    180180  status = pthread_mutexattr_setprotocol( &attr, -1 );
    181181  assert( status == EINVAL );
    182  
     182
    183183  puts( "Init: pthread_mutexattr_setprotocol - EINVAL (not initialized)" );
    184184  status = pthread_mutexattr_setprotocol( &destroyed_attr, -1 );
     
    188188
    189189  empty_line();
    190  
     190
    191191  puts( "Init: pthread_mutexattr_getprioceiling - EINVAL (NULL attr)" );
    192192  status = pthread_mutexattr_getprioceiling( NULL, &ceiling );
    193193  assert( status == EINVAL );
    194  
     194
    195195  puts( "Init: pthread_mutexattr_getprioceiling - EINVAL (NULL prioceiling)" );
    196196  status = pthread_mutexattr_getprioceiling( &attr, NULL );
    197197  assert( status == EINVAL );
    198  
     198
    199199  puts( "Init: pthread_mutexattr_getprioceiling - EINVAL (not initialized)" );
    200200  status = pthread_mutexattr_getprioceiling( &destroyed_attr, &ceiling );
    201201  assert( status == EINVAL );
    202  
     202
    203203  puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (NULL attr)" );
    204204  status = pthread_mutexattr_setprioceiling( NULL, 128 );
    205205  assert( status == EINVAL );
    206  
     206
    207207  puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (invalid priority)" );
    208208  status = pthread_mutexattr_setprioceiling( &attr, 512 );
     
    210210    printf( "status = %d\n", status );
    211211  assert( status == EINVAL );
    212  
     212
    213213  puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (not initialized)" );
    214214  status = pthread_mutexattr_setprioceiling( &destroyed_attr, -1 );
     
    256256  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
    257257  assert( !status );
    258  
     258
    259259  status = pthread_mutexattr_setprioceiling( &attr, 128 );
    260260  assert( !status );
    261  
     261
    262262  status = pthread_mutexattr_setpshared( &attr, PTHREAD_PROCESS_SHARED );
    263263  assert( !status );
    264  
     264
    265265  Print_mutexattr( "Init: ", &attr );
    266  
     266
    267267  puts( "Init: Resetting mutex attributes" );
    268268  status = pthread_mutexattr_init( &attr );
     
    276276  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
    277277  assert( !status );
    278  
     278
    279279  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    280280  status = pthread_mutex_init( &Mutex_id, &attr );
     
    323323
    324324  sleep( 1 );
    325  
     325
    326326     /* switch to task 1 */
    327327
     
    377377  status = pthread_mutex_destroy( &Mutex2_id );
    378378  assert( !status );
    379  
     379
    380380  puts( "Init: pthread_mutex_destroy - EINVAL (invalid id)" );
    381381  status = pthread_mutex_destroy( &Mutex_bad_id );
    382382  assert( status == EINVAL );
    383  
     383
    384384  /* destroy a busy mutex */
    385  
    386   empty_line();
    387  
     385
     386  empty_line();
     387
    388388  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
    389389  status = pthread_mutexattr_init( &attr );
     
    393393  status = pthread_mutex_init( &Mutex2_id, &attr );
    394394  assert( !status );
    395  
     395
    396396  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    397397  status = pthread_mutex_trylock( &Mutex2_id );
     
    417417
    418418  empty_line();
    419  
     419
    420420  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
    421421  status = pthread_mutexattr_init( &attr );
     
    437437
    438438  /* create a thread at a lower priority */
    439  
     439
    440440  status = pthread_create( &Task2_id, NULL, Task_2, NULL );
    441441  assert( !status );
    442  
     442
    443443  /* set priority of Task2 to highest priority */
    444  
     444
    445445  param.sched_priority = 254;
    446  
     446
    447447  puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" );
    448448  status = pthread_setschedparam( Task2_id, SCHED_FIFO, &param );
     
    458458  status = pthread_mutex_unlock( &Mutex2_id );
    459459  assert( !status );
    460  
     460
    461461  puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
    462462  status = pthread_mutexattr_destroy( &attr );
     
    466466  status = pthread_mutex_destroy( &Mutex2_id );
    467467  assert( !status );
    468  
     468
    469469  /* priority ceiling mutex */
    470  
    471   empty_line();
    472  
     470
     471  empty_line();
     472
    473473  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
    474474  status = pthread_mutexattr_init( &attr );
    475475  assert( !status );
    476  
     476
    477477  puts(
    478478    "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_PROTECT)"
     
    480480  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
    481481  assert( !status );
    482  
     482
    483483  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    484484  status = pthread_mutex_init( &Mutex2_id, &attr );
    485485  assert( !status );
    486  
     486
    487487  puts( "Init: pthread_mutex_getprioceiling - EINVAL (invalid id)" );
    488488  status = pthread_mutex_getprioceiling( &Mutex_bad_id, &ceiling );
     
    496496  assert( !status );
    497497  printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling );
    498  
     498
    499499  puts( "Init: pthread_mutex_setprioceiling - EINVAL (invalid id)" );
    500500  status = pthread_mutex_setprioceiling( &Mutex_bad_id, 200, &old_ceiling );
     
    517517    "Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling
    518518  );
    519  
     519
    520520  status = pthread_getschedparam( pthread_self(), &policy, &param );
    521521  assert( !status );
     
    527527  status = pthread_mutex_trylock( &Mutex2_id );
    528528  assert( !status );
    529  
     529
    530530  status = pthread_getschedparam( pthread_self(), &policy, &param );
    531531  assert( !status );
     
    535535
    536536  /* create a thread at a higher priority */
    537  
     537
    538538  status = pthread_create( &Task3_id, NULL, Task_3, NULL );
    539539  assert( !status );
    540  
     540
    541541  /* set priority of Task3 to highest priority */
    542  
     542
    543543  param.sched_priority = 199;
    544  
     544
    545545  status = pthread_setschedparam( Task3_id, SCHED_FIFO, &param );
    546546  assert( !status );
    547547  puts( "Init: pthread_setschedparam - set Task3 priority to highest" );
    548  
     548
    549549  /* DOES NOT SWITCH to Task3 */
    550550
     
    552552  assert( !status );
    553553  sleep( 1 );
    554  
     554
    555555  /* switch to task 3 */
    556  
     556
    557557  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    558558  status = pthread_mutex_unlock( &Mutex2_id );
    559559  assert( !status );
    560  
     560
    561561  status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
    562562  assert( !status );
    563563  printf( "Init: pthread_mutex_getprioceiling- ceiling = %d\n", ceiling );
    564  
     564
    565565  /* set priority of Init to highest priority */
    566  
     566
    567567  param.sched_priority = 254;
    568  
     568
    569569  status = pthread_setschedparam( Init_id, SCHED_FIFO, &param );
    570570  assert( !status );
    571571  puts( "Init: pthread_setschedparam - set Init priority to highest" );
    572  
     572
    573573  puts( "Init: pthread_mutex_lock - EINVAL (priority ceiling violation)" );
    574574  status = pthread_mutex_lock( &Mutex2_id );
Note: See TracChangeset for help on using the changeset viewer.