Changeset 96bdacd in rtems


Ignore:
Timestamp:
Nov 9, 2009, 2:49:27 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
1369978
Parents:
2393825
Message:

2009-11-09 Joel Sherrill <joel.sherrill@…>

  • psxmsgq01/init.c, psxsem01/init.c: Add service to check status returned by POSIX methods which return a pointer which is -1 on error. This eliminated some casts.
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r2393825 r96bdacd  
     12009-11-09      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * psxmsgq01/init.c, psxsem01/init.c: Add service to check status
     4        returned by POSIX methods which return a pointer which is -1 on
     5        error. This eliminated some casts.
     6
    172009-11-09      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • testsuites/psxtests/psxmsgq01/init.c

    r2393825 r96bdacd  
    11/*
    2  *  COPYRIGHT (c) 1989-2008.
     2 *  COPYRIGHT (c) 1989-2009.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    171171  puts( "Init: mq_open - Create with maxmsg (-1) (EINVAL)" );
    172172  n_mq2 = mq_open( "mq2", O_CREAT | O_RDONLY, 0x777, &attr);
    173   fatal_posix_service_status(
    174     (int) n_mq2, (int ) (-1), "mq_open error return status" );
     173  fatal_posix_service_pointer_minus_one(
     174    (void *)n_mq2, "mq_open error return status" );
    175175  fatal_posix_service_status( errno, EINVAL,  "mq_open errno EINVAL");
    176176  attr.mq_maxmsg  = MAXMSG;
     
    183183  puts( "Init: mq_open - Create with msgsize (-1) (EINVAL)" );
    184184  n_mq2 = mq_open( "mq2", O_CREAT | O_RDONLY, 0x777, &attr);
    185   fatal_posix_service_status(
    186     (int) n_mq2, (int ) (-1), "mq_open error return status" );
     185  fatal_posix_service_pointer_minus_one(
     186    (void *) n_mq2, "mq_open error return status" );
    187187  fatal_posix_service_status( errno, EINVAL,  "mq_open errno EINVAL");
    188188  attr.mq_msgsize = MSGSIZE;
     
    194194  puts( "Init: mq_open - Open new mq without create flag (ENOENT)" );
    195195  n_mq2 = mq_open( "mq3", O_EXCL | O_RDONLY, 0x777, NULL);
    196   fatal_posix_service_status(
    197     (int) n_mq2, (int ) (-1), "mq_open error return status" );
     196  fatal_posix_service_pointer_minus_one(
     197    (void *) n_mq2, "mq_open error return status" );
    198198  fatal_posix_service_status( errno, ENOENT,  "mq_open errno ENOENT");
    199199
     
    208208  puts( "Init: mq_open - Open with too long of a name (ENAMETOOLONG)" );
    209209  n_mq2 = mq_open( Get_Too_Long_Name(), O_CREAT | O_RDONLY, 0x777, NULL );
    210   fatal_posix_service_status(
    211     (int) n_mq2, (int ) (-1), "mq_open error return status" );
     210  fatal_posix_service_pointer_minus_one(
     211    (void *) n_mq2, "mq_open error return status" );
    212212  fatal_posix_service_status( errno, ENAMETOOLONG, "mq_open errno ENAMETOOLONG");
    213213
     
    228228  n_mq2 = mq_open(
    229229    Build_Queue_Name(0), O_CREAT | O_EXCL | O_RDONLY, 0x777, NULL);
    230   fatal_posix_service_status(
    231     (int) n_mq2, (int ) (-1), "mq_open error return status" );
     230  fatal_posix_service_pointer_minus_one(
     231    (void *) n_mq2, "mq_open error return status" );
    232232  fatal_posix_service_status( errno, EEXIST,  "mq_open errno EEXIST");
    233233
     
    270270  puts( "Init: mq_open - system is out of resources (ENFILE)" );
    271271  n_mq2 = mq_open( Build_Queue_Name(i), O_CREAT | O_RDONLY, 0x777, NULL );
    272   fatal_posix_service_status(
    273     (int) n_mq2, (int ) (-1), "mq_open error return status" );
     272  fatal_posix_service_pointer_minus_one(
     273    (void *) n_mq2, "mq_open error return status" );
    274274  fatal_posix_service_status( errno, ENFILE,  "mq_open errno ENFILE");
    275275
     
    684684  n_mq = mq_open( RD_NAME, 0 );
    685685  fatal_posix_service_status(
    686     (int) n_mq, (int ) Test_q[RD_QUEUE].mq, "mq_open error return status" );
     686  assert( n_mq == Test_q[RD_QUEUE].mq );
    687687#endif
    688688}
     
    958958  wait_for_signal( &set, 3, 0 );
    959959  Read_msg_from_que( RW_QUEUE, 0 );
    960 
    961960
    962961  /*
  • testsuites/psxtests/psxsem01/init.c

    r2393825 r96bdacd  
    172172  puts( "Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)" );
    173173  n_sem1 = sem_open(Get_Too_Long_Name(), O_CREAT, 0777, 1 );
    174   fatal_posix_service_status(
    175     (int) n_sem1, (int) SEM_FAILED, "sem_open error return status");
     174  fatal_posix_service_pointer_minus_one(
     175    n_sem1, "sem_open error return status");
    176176  fatal_posix_service_status(
    177177    errno, ENAMETOOLONG, "sem_open errorno ENAMETOOLONG" );
     
    188188  puts( "Init: sem_open - Create an Existing sem (EEXIST)" );
    189189  n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 0777, 1);
    190   fatal_posix_service_status(
    191     (int) n_sem2, (int) SEM_FAILED, "sem_open error return status" );
     190  fatal_posix_service_pointer_minus_one(
     191    n_sem2, "sem_open error return status" );
    192192  fatal_posix_service_status( errno, EEXIST,  "sem_open errno EEXIST");
    193193
    194194  puts( "Init: sem_open - Open new sem without create flag (ENOENT)" );
    195195  n_sem2 = sem_open("sem3", O_EXCL, 0777, 1);
    196   fatal_posix_service_status(
    197     (int) n_sem2, (int) SEM_FAILED, "sem_open error return status" );
     196  fatal_posix_service_pointer_minus_one(
     197    n_sem2, "sem_open error return status" );
    198198  fatal_posix_service_status( errno, ENOENT,  "sem_open errno EEXIST");
    199199
     
    219219  puts( "Init: sem_open - Open an existing sem ( same id )" );
    220220  n_sem2 = sem_open("sem1", 0 );
    221   fatal_posix_service_status(
    222     (int) n_sem2, (int) n_sem1, "sem_open error return status" );
     221  assert( n_sem2 == n_sem1 );
    223222
    224223  /*
     
    243242  status = sem_close( n_sem1 );
    244243  fatal_posix_service_status( status, 0, "sem_close semaphore");
    245 
    246244
    247245  /*
Note: See TracChangeset for help on using the changeset viewer.