summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxmsgq01/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-09 14:49:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-09 14:49:27 +0000
commit96bdacd57d85f374df7f559b812f813d54a2381e (patch)
treefedb7f376e6e897ec33e732e5f50fffebd9473b0 /testsuites/psxtests/psxmsgq01/init.c
parent23938252ade69f44ada5f35f183644e3e6c56549 (diff)
downloadrtems-96bdacd57d85f374df7f559b812f813d54a2381e.tar.bz2
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
Diffstat (limited to 'testsuites/psxtests/psxmsgq01/init.c')
-rw-r--r--testsuites/psxtests/psxmsgq01/init.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c
index 4009033ac2..69c3c918c0 100644
--- a/testsuites/psxtests/psxmsgq01/init.c
+++ b/testsuites/psxtests/psxmsgq01/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2008.
+ * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -170,8 +170,8 @@ void validate_mq_open_error_codes(void)
attr.mq_maxmsg = -1;
puts( "Init: mq_open - Create with maxmsg (-1) (EINVAL)" );
n_mq2 = mq_open( "mq2", O_CREAT | O_RDONLY, 0x777, &attr);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *)n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, EINVAL, "mq_open errno EINVAL");
attr.mq_maxmsg = MAXMSG;
@@ -182,8 +182,8 @@ void validate_mq_open_error_codes(void)
attr.mq_msgsize = -1;
puts( "Init: mq_open - Create with msgsize (-1) (EINVAL)" );
n_mq2 = mq_open( "mq2", O_CREAT | O_RDONLY, 0x777, &attr);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, EINVAL, "mq_open errno EINVAL");
attr.mq_msgsize = MSGSIZE;
@@ -193,8 +193,8 @@ void validate_mq_open_error_codes(void)
puts( "Init: mq_open - Open new mq without create flag (ENOENT)" );
n_mq2 = mq_open( "mq3", O_EXCL | O_RDONLY, 0x777, NULL);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, ENOENT, "mq_open errno ENOENT");
/*
@@ -207,8 +207,8 @@ void validate_mq_open_error_codes(void)
puts( "Init: mq_open - Open with too long of a name (ENAMETOOLONG)" );
n_mq2 = mq_open( Get_Too_Long_Name(), O_CREAT | O_RDONLY, 0x777, NULL );
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, ENAMETOOLONG, "mq_open errno ENAMETOOLONG");
/*
@@ -227,8 +227,8 @@ void validate_mq_open_error_codes(void)
n_mq2 = mq_open(
Build_Queue_Name(0), O_CREAT | O_EXCL | O_RDONLY, 0x777, NULL);
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, EEXIST, "mq_open errno EEXIST");
status = mq_unlink( Build_Queue_Name(0) );
@@ -269,8 +269,8 @@ void validate_mq_open_error_codes(void)
puts( "Init: mq_open - system is out of resources (ENFILE)" );
n_mq2 = mq_open( Build_Queue_Name(i), O_CREAT | O_RDONLY, 0x777, NULL );
- fatal_posix_service_status(
- (int) n_mq2, (int ) (-1), "mq_open error return status" );
+ fatal_posix_service_pointer_minus_one(
+ (void *) n_mq2, "mq_open error return status" );
fatal_posix_service_status( errno, ENFILE, "mq_open errno ENFILE");
/*
@@ -683,7 +683,7 @@ void verify_open_functionality(void)
puts( "Init: mq_open - Open an existing mq ( same id )" );
n_mq = mq_open( RD_NAME, 0 );
fatal_posix_service_status(
- (int) n_mq, (int ) Test_q[RD_QUEUE].mq, "mq_open error return status" );
+ assert( n_mq == Test_q[RD_QUEUE].mq );
#endif
}
@@ -958,7 +958,6 @@ void verify_notify(void)
wait_for_signal( &set, 3, 0 );
Read_msg_from_que( RW_QUEUE, 0 );
-
/*
* EBUSY - Already Registered
*/