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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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  /*
Note: See TracChangeset for help on using the changeset viewer.