From 7ae7cf76afd70c3e756d3132491d28f5df7ef35a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 26 Apr 2002 23:41:02 +0000 Subject: 2001-04-26 Joel Sherrill * psxmsgq01/init.c: Reflect changes made to address PR81 that reworked POSIX message queues to add a descriptor separate from the underlying message queue. This allows non-blocking to follow the "open" not the underlying queue. --- c/src/tests/psxtests/ChangeLog | 7 ++++++ c/src/tests/psxtests/psxmsgq01/init.c | 42 ++++++++++++++++++++++++----------- testsuites/psxtests/ChangeLog | 7 ++++++ testsuites/psxtests/psxmsgq01/init.c | 42 ++++++++++++++++++++++++----------- 4 files changed, 72 insertions(+), 26 deletions(-) diff --git a/c/src/tests/psxtests/ChangeLog b/c/src/tests/psxtests/ChangeLog index 8198a7cba4..ba856c1ea7 100644 --- a/c/src/tests/psxtests/ChangeLog +++ b/c/src/tests/psxtests/ChangeLog @@ -1,3 +1,10 @@ +2001-04-26 Joel Sherrill + + * psxmsgq01/init.c: Reflect changes made to address PR81 that + reworked POSIX message queues to add a descriptor separate from + the underlying message queue. This allows non-blocking to follow + the "open" not the underlying queue. + 2002-04-14 Ralf Corsepius * configure.ac: Remove ENABLE_GCC28. diff --git a/c/src/tests/psxtests/psxmsgq01/init.c b/c/src/tests/psxtests/psxmsgq01/init.c index d1197d6a90..fcb52dee1b 100644 --- a/c/src/tests/psxtests/psxmsgq01/init.c +++ b/c/src/tests/psxtests/psxmsgq01/init.c @@ -158,7 +158,7 @@ void validate_mq_open_error_codes() mqd_t n_mq2; struct mq_attr attr; int status; - mqd_t open_mq[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES]; + mqd_t open_mq[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES + 1]; attr.mq_maxmsg = MAXMSG; attr.mq_msgsize = MSGSIZE; @@ -203,7 +203,6 @@ void validate_mq_open_error_codes() (int) n_mq2, (int ) (-1), "mq_open error return status" ); fatal_posix_service_status( errno, ENOENT, "mq_open errno ENOENT"); - /* * XXX EINTR - call was interrupted by a signal */ @@ -223,6 +222,27 @@ void validate_mq_open_error_codes() * Per implementation not possible. */ + /* + * EEXIST - Create an existing queue. + */ + + puts( "Init: mq_open - Create an Existing mq (EEXIST)" ); + open_mq[0] = mq_open( + Build_Queue_Name(0), O_CREAT | O_RDWR | O_NONBLOCK, 0x777, NULL ); + assert( open_mq[0] != (-1) ); + + 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_status( errno, EEXIST, "mq_open errno EEXIST"); + + status = mq_unlink( Build_Queue_Name(0) ); + fatal_posix_service_status( status, 0, "mq_unlink message queue"); + + status = mq_close( open_mq[0]); + fatal_posix_service_status( status, 0, "mq_close message queue"); + /* * Open maximum number of message queues */ @@ -232,7 +252,9 @@ void validate_mq_open_error_codes() open_mq[i] = mq_open( Build_Queue_Name(i), O_CREAT | O_RDWR | O_NONBLOCK, 0x777, NULL ); assert( open_mq[i] != (-1) ); + assert( open_mq[i] ); /*XXX - Isn't there a more general check */ +/* JRS printf( "mq_open 0x%x %s\n", open_mq[i], Build_Queue_Name(i) ); */ } /* @@ -243,17 +265,6 @@ void validate_mq_open_error_codes() * XXX EACCES - queue exists permissions specified by o_flag are denied. */ - /* - * EEXIST - Create an existing queue. - */ - - puts( "Init: mq_open - Create an Existing mq (EEXIST)" ); - 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_status( errno, EEXIST, "mq_open errno EEXIST"); - /* * XXX EMFILE - Too many message queues in use by the process */ @@ -279,7 +290,10 @@ void validate_mq_open_error_codes() fatal_posix_service_status( status, 0, "mq_close message queue"); status = mq_unlink( Build_Queue_Name(i) ); + if ( status == -1 ) + perror( "mq_unlink" ); fatal_posix_service_status( status, 0, "mq_unlink message queue"); + /* JRS printf( "mq_close/mq_unlink 0x%x %s\n", open_mq[i], Build_Queue_Name(i) ); */ } } @@ -669,10 +683,12 @@ void verify_open_functionality() * Validate a second open returns the same message queue. */ +#if 0 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" ); +#endif } void verify_unlink_functionality() diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 8198a7cba4..ba856c1ea7 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,10 @@ +2001-04-26 Joel Sherrill + + * psxmsgq01/init.c: Reflect changes made to address PR81 that + reworked POSIX message queues to add a descriptor separate from + the underlying message queue. This allows non-blocking to follow + the "open" not the underlying queue. + 2002-04-14 Ralf Corsepius * configure.ac: Remove ENABLE_GCC28. diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c index d1197d6a90..fcb52dee1b 100644 --- a/testsuites/psxtests/psxmsgq01/init.c +++ b/testsuites/psxtests/psxmsgq01/init.c @@ -158,7 +158,7 @@ void validate_mq_open_error_codes() mqd_t n_mq2; struct mq_attr attr; int status; - mqd_t open_mq[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES]; + mqd_t open_mq[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES + 1]; attr.mq_maxmsg = MAXMSG; attr.mq_msgsize = MSGSIZE; @@ -203,7 +203,6 @@ void validate_mq_open_error_codes() (int) n_mq2, (int ) (-1), "mq_open error return status" ); fatal_posix_service_status( errno, ENOENT, "mq_open errno ENOENT"); - /* * XXX EINTR - call was interrupted by a signal */ @@ -223,6 +222,27 @@ void validate_mq_open_error_codes() * Per implementation not possible. */ + /* + * EEXIST - Create an existing queue. + */ + + puts( "Init: mq_open - Create an Existing mq (EEXIST)" ); + open_mq[0] = mq_open( + Build_Queue_Name(0), O_CREAT | O_RDWR | O_NONBLOCK, 0x777, NULL ); + assert( open_mq[0] != (-1) ); + + 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_status( errno, EEXIST, "mq_open errno EEXIST"); + + status = mq_unlink( Build_Queue_Name(0) ); + fatal_posix_service_status( status, 0, "mq_unlink message queue"); + + status = mq_close( open_mq[0]); + fatal_posix_service_status( status, 0, "mq_close message queue"); + /* * Open maximum number of message queues */ @@ -232,7 +252,9 @@ void validate_mq_open_error_codes() open_mq[i] = mq_open( Build_Queue_Name(i), O_CREAT | O_RDWR | O_NONBLOCK, 0x777, NULL ); assert( open_mq[i] != (-1) ); + assert( open_mq[i] ); /*XXX - Isn't there a more general check */ +/* JRS printf( "mq_open 0x%x %s\n", open_mq[i], Build_Queue_Name(i) ); */ } /* @@ -243,17 +265,6 @@ void validate_mq_open_error_codes() * XXX EACCES - queue exists permissions specified by o_flag are denied. */ - /* - * EEXIST - Create an existing queue. - */ - - puts( "Init: mq_open - Create an Existing mq (EEXIST)" ); - 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_status( errno, EEXIST, "mq_open errno EEXIST"); - /* * XXX EMFILE - Too many message queues in use by the process */ @@ -279,7 +290,10 @@ void validate_mq_open_error_codes() fatal_posix_service_status( status, 0, "mq_close message queue"); status = mq_unlink( Build_Queue_Name(i) ); + if ( status == -1 ) + perror( "mq_unlink" ); fatal_posix_service_status( status, 0, "mq_unlink message queue"); + /* JRS printf( "mq_close/mq_unlink 0x%x %s\n", open_mq[i], Build_Queue_Name(i) ); */ } } @@ -669,10 +683,12 @@ void verify_open_functionality() * Validate a second open returns the same message queue. */ +#if 0 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" ); +#endif } void verify_unlink_functionality() -- cgit v1.2.3