[a8df60b] | 1 | /* |
---|
[08311cc3] | 2 | * COPYRIGHT (c) 1989-1999. |
---|
[a8df60b] | 3 | * On-Line Applications Research Corporation (OAR). |
---|
| 4 | * |
---|
| 5 | * The license and distribution terms for this file may be |
---|
| 6 | * found in the file LICENSE in this distribution or at |
---|
| 7 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 8 | * |
---|
| 9 | * $Id$ |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | #define CONFIGURE_INIT |
---|
| 13 | #include "system.h" |
---|
| 14 | #include <sched.h> |
---|
[6eb3e68] | 15 | #include <fcntl.h> |
---|
| 16 | #include <time.h> |
---|
| 17 | #include <tmacros.h> |
---|
[a8df60b] | 18 | |
---|
[6eb3e68] | 19 | char Queue_Name[PATH_MAX + 2]; |
---|
| 20 | char *Get_Queue_Name( |
---|
| 21 | int i |
---|
| 22 | ) |
---|
| 23 | { |
---|
| 24 | sprintf(Queue_Name,"mq%d",i+1); |
---|
| 25 | return Queue_Name; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | char *Get_Too_Long_Name() |
---|
| 29 | { |
---|
| 30 | int i; |
---|
| 31 | |
---|
| 32 | for ( i=0; i< PATH_MAX+1; i++ ) |
---|
| 33 | Queue_Name[i] = 'N'; |
---|
| 34 | Queue_Name[i] = '\0'; |
---|
| 35 | return Queue_Name; |
---|
| 36 | } |
---|
| 37 | |
---|
[99e7ab89] | 38 | typedef enum { |
---|
| 39 | DEFAULT_SIZE_TYPE, |
---|
| 40 | TEST_SIZE_TYPE, |
---|
| 41 | MAX_SIZE, |
---|
| 42 | TYPES_OF_TEST_SIZES |
---|
| 43 | } TEST_MQ_SIZE_TYPES; |
---|
| 44 | |
---|
| 45 | |
---|
[6eb3e68] | 46 | /* |
---|
| 47 | * Opens CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES then leaves size queues |
---|
| 48 | * opened but closes the rest. |
---|
| 49 | */ |
---|
| 50 | |
---|
| 51 | void validate_mq_open_error_codes( |
---|
| 52 | mqd_t *mqs, /* Must be large enough for Maximum to be opened. */ |
---|
| 53 | int size |
---|
[a8df60b] | 54 | ) |
---|
| 55 | { |
---|
[e492f910] | 56 | int i; |
---|
[6eb3e68] | 57 | mqd_t n_mq2; |
---|
| 58 | struct mq_attr attr; |
---|
| 59 | int status; |
---|
[e492f910] | 60 | |
---|
[6eb3e68] | 61 | assert( size < (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES-1) ); |
---|
| 62 | |
---|
| 63 | /* |
---|
| 64 | * Validate mq_open errors that can occur when no queues are open. |
---|
| 65 | * EINVAL |
---|
| 66 | * ENOENT |
---|
| 67 | * EINTR |
---|
| 68 | */ |
---|
| 69 | |
---|
| 70 | /* |
---|
| 71 | * XXX EINVAL - inappropriate name was given for the message queue |
---|
| 72 | */ |
---|
| 73 | |
---|
| 74 | attr.mq_maxmsg = -1; |
---|
| 75 | puts( "mq_open - Create with maxmsg (-1) (EINVAL)" ); |
---|
[99e7ab89] | 76 | n_mq2 = mq_open("mq2", O_CREAT | O_RDONLY, 0x777, &attr); |
---|
[6eb3e68] | 77 | fatal_directive_status( |
---|
| 78 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
| 79 | fatal_directive_status( errno, EINVAL, "mq_open errno EINVAL"); |
---|
| 80 | |
---|
| 81 | attr.mq_msgsize = -1; |
---|
| 82 | puts( "mq_open - Create with msgsize (-1) (EINVAL)" ); |
---|
[99e7ab89] | 83 | n_mq2 = mq_open("mq2", O_CREAT | O_RDONLY, 0x777, &attr); |
---|
[6eb3e68] | 84 | fatal_directive_status( |
---|
| 85 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
| 86 | fatal_directive_status( errno, EINVAL, "mq_open errno EINVAL"); |
---|
[a8df60b] | 87 | |
---|
[6eb3e68] | 88 | puts( "mq_open - Open new mq without create flag (ENOENT)" ); |
---|
[99e7ab89] | 89 | n_mq2 = mq_open("mq3", O_EXCL | O_RDONLY, 0x777, NULL); |
---|
[6eb3e68] | 90 | fatal_directive_status( |
---|
| 91 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
| 92 | fatal_directive_status( errno, ENOENT, "mq_open errno ENOENT"); |
---|
| 93 | |
---|
| 94 | /* |
---|
| 95 | * XXX EINTR - call was interrupted by a signal |
---|
| 96 | */ |
---|
| 97 | |
---|
| 98 | /* |
---|
| 99 | * XXX ENAMETOOLONG - Not checked in either sem_open or mq_open is |
---|
| 100 | * this an error? |
---|
| 101 | */ |
---|
| 102 | |
---|
| 103 | puts( "mq_open - Open with too long of a name (ENAMETOOLONG)" ); |
---|
[99e7ab89] | 104 | n_mq2 = mq_open( Get_Too_Long_Name(), O_CREAT | O_RDONLY, 0x777, NULL ); |
---|
[6eb3e68] | 105 | fatal_directive_status( |
---|
| 106 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
| 107 | fatal_directive_status( errno, ENAMETOOLONG, "mq_open errno ENAMETOOLONG"); |
---|
| 108 | |
---|
| 109 | /* |
---|
| 110 | * Open maximum number of message queues |
---|
| 111 | */ |
---|
| 112 | |
---|
| 113 | puts( "mq_open - SUCCESSFUL" ); |
---|
| 114 | for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES; i++) { |
---|
[99e7ab89] | 115 | mqs[i] = mq_open( Get_Queue_Name(i), O_CREAT | O_RDWR, 0x777, NULL ); |
---|
[6eb3e68] | 116 | assert( mqs[i] != (-1) ); |
---|
| 117 | /*XXX - Isn't there a more general check */ |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | /* |
---|
| 121 | * Validate open errors that must occur after message queues are open. |
---|
| 122 | * EACCES |
---|
| 123 | * EEXIST |
---|
| 124 | * EMFILE |
---|
| 125 | * ENFILE |
---|
| 126 | */ |
---|
[e492f910] | 127 | |
---|
| 128 | /* |
---|
[6eb3e68] | 129 | * XXX EACCES - permission to create is denied. |
---|
[e492f910] | 130 | */ |
---|
| 131 | |
---|
[6eb3e68] | 132 | /* |
---|
| 133 | * XXX EACCES - queue exists permissions specified by o_flag are denied. |
---|
| 134 | puts( "mq_open - open mq as write (EACCES)" ); |
---|
[99e7ab89] | 135 | n_mq2 = mq_open("mq1", O_CREAT | O_WRONLY, 0x777, NULL); |
---|
[6eb3e68] | 136 | fatal_directive_status( |
---|
| 137 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
| 138 | fatal_directive_status( errno, EACCES, "mq_open errno EACCES"); |
---|
| 139 | */ |
---|
[e492f910] | 140 | |
---|
[6eb3e68] | 141 | puts( "mq_open - Create an Existing mq (EEXIST)" ); |
---|
[99e7ab89] | 142 | n_mq2 = mq_open("mq1", O_CREAT | O_EXCL | O_RDONLY, 0x777, NULL); |
---|
[e492f910] | 143 | fatal_directive_status( |
---|
[6eb3e68] | 144 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
[e492f910] | 145 | fatal_directive_status( errno, EEXIST, "mq_open errno EEXIST"); |
---|
| 146 | |
---|
[6eb3e68] | 147 | |
---|
| 148 | /* |
---|
| 149 | * XXX EMFILE - Too many message queues open |
---|
| 150 | */ |
---|
| 151 | |
---|
| 152 | puts( "mq_open - system is out of resources (ENFILE)" ); |
---|
[99e7ab89] | 153 | n_mq2 = mq_open( Get_Queue_Name(i), O_CREAT | O_RDONLY, 0x777, NULL ); |
---|
[e492f910] | 154 | fatal_directive_status( |
---|
[6eb3e68] | 155 | (int) n_mq2, (int ) (-1), "mq_open error return status" ); |
---|
| 156 | fatal_directive_status( errno, ENFILE, "mq_open errno ENFILE"); |
---|
[e492f910] | 157 | |
---|
| 158 | /* |
---|
[6eb3e68] | 159 | * Unlink and Close . |
---|
[e492f910] | 160 | */ |
---|
| 161 | |
---|
[6eb3e68] | 162 | puts( "mq_close and mq_unlink (mq3...mqn) - SUCCESSFUL" ); |
---|
| 163 | for (i = size; i < CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES; i++) { |
---|
| 164 | |
---|
| 165 | status = mq_close( mqs[i] ); |
---|
| 166 | fatal_directive_status( status, 0, "mq_close message queue"); |
---|
| 167 | |
---|
| 168 | status = mq_unlink( Get_Queue_Name(i) ); |
---|
| 169 | fatal_directive_status( status, 0, "mq_unlink message queue"); |
---|
| 170 | } |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | void validate_mq_unlink_error_codes( |
---|
[99e7ab89] | 174 | mqd_t *mqs, |
---|
| 175 | int size /* Number still open in mqs */ |
---|
[6eb3e68] | 176 | ) |
---|
| 177 | { |
---|
| 178 | int status; |
---|
| 179 | |
---|
[e492f910] | 180 | /* |
---|
[6eb3e68] | 181 | * XXX - EACCES Permission Denied |
---|
[e492f910] | 182 | */ |
---|
| 183 | |
---|
[6eb3e68] | 184 | /* |
---|
| 185 | * XXX ENAMETOOLONG - Not checked in either sem_unlink or mq_unlink is |
---|
| 186 | * this an error? |
---|
[99e7ab89] | 187 | */ |
---|
| 188 | |
---|
| 189 | puts( "mq_unlink - mq_unlink with too long of a name (ENAMETOOLONG)" ); |
---|
| 190 | status = mq_unlink( Get_Too_Long_Name() ); |
---|
| 191 | fatal_directive_status( status, -1, "mq_unlink error return status"); |
---|
| 192 | fatal_directive_status( errno, ENAMETOOLONG, "mq_unlink errno ENAMETOOLONG"); |
---|
[6eb3e68] | 193 | |
---|
| 194 | puts( "mq_unlink - UNSUCCESSFUL (ENOENT)" ); |
---|
| 195 | status = mq_unlink(Get_Queue_Name(size)); |
---|
| 196 | fatal_directive_status( status, -1, "mq_unlink error return status"); |
---|
| 197 | fatal_directive_status( errno, ENOENT, "mq_unlink errno ENOENT"); |
---|
[99e7ab89] | 198 | |
---|
| 199 | /* |
---|
| 200 | * XXX - These errors are not in the POSIX manual but may occur. |
---|
| 201 | */ |
---|
| 202 | |
---|
| 203 | puts( "mq_unlink (NULL) - EINVAL" ); |
---|
| 204 | status = mq_unlink( NULL ); |
---|
| 205 | fatal_directive_status( status, -1, "mq_unlink error return status"); |
---|
| 206 | fatal_directive_status( errno, EINVAL, "mq_unlink errno value"); |
---|
| 207 | |
---|
| 208 | puts( "mq_unlink (\"\") - EINVAL" ); |
---|
| 209 | status = mq_unlink( "" ); |
---|
| 210 | fatal_directive_status( status, -1, "mq_unlink error return status"); |
---|
| 211 | fatal_directive_status( errno, EINVAL, "mq_unlink errno value"); |
---|
[6eb3e68] | 212 | } |
---|
| 213 | |
---|
| 214 | void validate_mq_close_error_codes( |
---|
[99e7ab89] | 215 | mqd_t *mqs, |
---|
| 216 | int size /* Number still open in mqs */ |
---|
[6eb3e68] | 217 | ) |
---|
| 218 | { |
---|
| 219 | int status; |
---|
| 220 | |
---|
| 221 | puts( "mq_close - UNSUCCESSFUL (EBADF)" ); |
---|
| 222 | status = mq_close(mqs[size]); |
---|
| 223 | fatal_directive_status( status, -1, "mq_close error return status"); |
---|
| 224 | fatal_directive_status( errno, EBADF, "mq_close errno EBADF"); |
---|
[99e7ab89] | 225 | } |
---|
| 226 | |
---|
| 227 | /* |
---|
| 228 | * Returns the number of messages queued after the test on the |
---|
| 229 | * first queue. |
---|
| 230 | */ |
---|
| 231 | |
---|
| 232 | int validate_mq_send_error_codes( |
---|
| 233 | mqd_t *mqs, |
---|
| 234 | int size /* Number still open in mqs */ |
---|
| 235 | ) |
---|
| 236 | { |
---|
| 237 | int status; |
---|
| 238 | int i; |
---|
| 239 | mqd_t n_mq1; |
---|
| 240 | struct mq_attr attr; |
---|
| 241 | |
---|
| 242 | attr.mq_maxmsg = 3; |
---|
| 243 | attr.mq_msgsize = 8; |
---|
| 244 | |
---|
| 245 | /* |
---|
| 246 | * XXX - EBADF Not a valid message descriptor. |
---|
| 247 | * Write to a invalid message descriptor |
---|
| 248 | * XXX - Write to a read only queue |
---|
| 249 | */ |
---|
| 250 | |
---|
| 251 | puts( "mq_send - Closed message queue (EBADF)" ); |
---|
| 252 | status = mq_send( mqs[size], "", 1, 0 ); |
---|
| 253 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 254 | fatal_directive_status( errno, EBADF, "mq_send errno EBADF"); |
---|
| 255 | |
---|
| 256 | puts( "mq_open - Open a read only queue" ); |
---|
| 257 | n_mq1 = mq_open("read_only", O_CREAT | O_RDONLY, 0x777, &attr); |
---|
| 258 | assert( n_mq1 != (-1) ); |
---|
| 259 | /*XXX - Isn't there a more general check */ |
---|
| 260 | |
---|
| 261 | puts( "mq_send - Read only message queue (EBADF)" ); |
---|
| 262 | status = mq_send( n_mq1, "", 1, 0 ); |
---|
| 263 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 264 | fatal_directive_status( errno, EBADF, "mq_send errno EBADF"); |
---|
| 265 | |
---|
| 266 | status = mq_close( n_mq1 ); |
---|
| 267 | fatal_directive_status( status, 0, "mq_close message queue"); |
---|
| 268 | |
---|
| 269 | status = mq_unlink( "read_only" ); |
---|
| 270 | fatal_directive_status( status, 0, "mq_unlink message queue"); |
---|
| 271 | |
---|
| 272 | /* |
---|
| 273 | * XXX - EINTR |
---|
| 274 | * Signal interrupted the call. |
---|
| 275 | |
---|
| 276 | puts( "mq_send - UNSUCCESSFUL (EINTR)" ); |
---|
| 277 | status = mq_send( mqs, "", 0xffff, 0 ); |
---|
| 278 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 279 | fatal_directive_status( errno, E, "mq_send errno E"); |
---|
| 280 | */ |
---|
| 281 | |
---|
| 282 | /* |
---|
| 283 | * XXX - EINVAL priority is out of range. |
---|
| 284 | */ |
---|
| 285 | |
---|
| 286 | puts( "mq_send - Priority out of range (EINVAL)" ); |
---|
| 287 | status = mq_send( mqs[0], "", 1, MQ_PRIO_MAX + 1 ); |
---|
| 288 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 289 | fatal_directive_status( errno, EINVAL, "mq_send errno EINVAL"); |
---|
| 290 | |
---|
| 291 | /* |
---|
| 292 | * XXX - EMSGSIZE - Message size larger than msg_len |
---|
| 293 | */ |
---|
| 294 | |
---|
| 295 | puts( "mq_send - Message longer than msg_len (EMSGSIZE)" ); |
---|
| 296 | status = mq_send( mqs[0], "", 0xffff, 0 ); |
---|
| 297 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 298 | fatal_directive_status( errno, EMSGSIZE, "mq_send errno EMSGSIZE"); |
---|
| 299 | |
---|
| 300 | /* |
---|
| 301 | * ENOSYS - send is supported should never happen. |
---|
| 302 | */ |
---|
| 303 | |
---|
| 304 | |
---|
| 305 | /* |
---|
| 306 | * XXX - EAGAIN |
---|
| 307 | * O_NONBLOCK and message queue is full. |
---|
| 308 | * This is validated in the read/write test. |
---|
| 309 | */ |
---|
| 310 | |
---|
| 311 | i=0; |
---|
| 312 | do { |
---|
| 313 | status = mq_send( mqs[0], "", 1, 0 ); |
---|
| 314 | i++; |
---|
| 315 | } while (status == 0); |
---|
| 316 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 317 | fatal_directive_status( errno, EAGAIN, "mq_send errno EAGAIN"); |
---|
| 318 | |
---|
| 319 | return i-1; |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | void validate_mq_receive_error_codes( |
---|
| 323 | mqd_t *mqs, |
---|
| 324 | int size /* Number still open in mqs */ |
---|
| 325 | ) |
---|
| 326 | { |
---|
| 327 | int status; |
---|
| 328 | |
---|
| 329 | /* |
---|
| 330 | * EAGAIN - |
---|
| 331 | */ |
---|
| 332 | |
---|
| 333 | /* |
---|
| 334 | * EBADF - |
---|
| 335 | */ |
---|
| 336 | |
---|
| 337 | /* |
---|
| 338 | * EMSGSIZE - |
---|
| 339 | */ |
---|
| 340 | |
---|
| 341 | /* |
---|
| 342 | * EINTR - |
---|
| 343 | */ |
---|
| 344 | |
---|
| 345 | /* |
---|
| 346 | * EBADMSG - a data corruption problem. |
---|
| 347 | * XXX - Can not cause. |
---|
| 348 | */ |
---|
| 349 | |
---|
| 350 | /* |
---|
| 351 | puts( "mq_ - UNSUCCESSFUL ()" ); |
---|
| 352 | status = mq_( ); |
---|
| 353 | fatal_directive_status( status, -1, "mq_ error return status"); |
---|
| 354 | fatal_directive_status( errno, E, "mq_c errno E"); |
---|
| 355 | |
---|
| 356 | */ |
---|
| 357 | /* |
---|
| 358 | * ENOSYS - |
---|
| 359 | */ |
---|
| 360 | |
---|
| 361 | } |
---|
[6eb3e68] | 362 | |
---|
[99e7ab89] | 363 | void non_blocking_mq_read_write( |
---|
| 364 | mqd_t *mqs, |
---|
| 365 | int size /* Number still open in mqs */ |
---|
| 366 | ) |
---|
| 367 | { |
---|
| 368 | /* |
---|
| 369 | int status; |
---|
| 370 | char *messages[] = { |
---|
| 371 | "Msg 1", |
---|
| 372 | "Test 2", |
---|
| 373 | "12345678901234567890" |
---|
| 374 | }; |
---|
| 375 | |
---|
| 376 | status = mq_send( mqs[0], messages[0], strlen( messages[0] ), 0 ); |
---|
| 377 | fatal_directive_status( status, 0, "mq_send error return status" ); |
---|
| 378 | |
---|
| 379 | puts( "mq_send - UNSUCCESSFUL ()" ); |
---|
| 380 | do { |
---|
| 381 | status = mq_send( ); |
---|
| 382 | fatal_directive_status( status, -1, "mq_send error return status"); |
---|
| 383 | fatal_directive_status( errno, E, "mq_send errno E"); |
---|
| 384 | } |
---|
| 385 | */ |
---|
[6eb3e68] | 386 | } |
---|
| 387 | |
---|
| 388 | void *POSIX_Init( |
---|
| 389 | void *argument |
---|
| 390 | ) |
---|
| 391 | { |
---|
| 392 | int status; |
---|
| 393 | mqd_t mqs[CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES]; |
---|
| 394 | mqd_t n_mq1; |
---|
| 395 | mqd_t n_mq2; |
---|
[99e7ab89] | 396 | char *messages[] = { |
---|
| 397 | "Msg 1", |
---|
| 398 | "Test 2", |
---|
| 399 | "12345678901234567890" |
---|
| 400 | }; |
---|
[6eb3e68] | 401 | |
---|
| 402 | puts( "\n\n*** POSIX MESSAGE QUEUE TEST ***" ); |
---|
| 403 | |
---|
| 404 | validate_mq_open_error_codes( mqs, 2 ); |
---|
| 405 | validate_mq_unlink_error_codes( mqs, 2 ); |
---|
| 406 | validate_mq_close_error_codes( mqs, 2 ); |
---|
[e492f910] | 407 | |
---|
[99e7ab89] | 408 | validate_mq_send_error_codes( mqs, 2 ); |
---|
| 409 | validate_mq_receive_error_codes( mqs, 2 ); |
---|
| 410 | |
---|
| 411 | |
---|
[e492f910] | 412 | /* |
---|
| 413 | * Validate a second open returns the same message queue. |
---|
| 414 | */ |
---|
| 415 | |
---|
[6eb3e68] | 416 | puts( "mq_open - Open an existing mq ( same id )" ); |
---|
[99e7ab89] | 417 | n_mq1 = mq_open("mq1", 0 ); |
---|
[e492f910] | 418 | fatal_directive_status( |
---|
[99e7ab89] | 419 | (int) n_mq1, (int ) mqs[0], "mq_open error return status" ); |
---|
[e492f910] | 420 | |
---|
| 421 | /* |
---|
| 422 | * Unlink the message queue, then verify an open of the same name produces a |
---|
| 423 | * different message queue. |
---|
| 424 | */ |
---|
| 425 | |
---|
[6eb3e68] | 426 | puts( "mq_unlink - mq1 SUCCESSFUL" ); |
---|
[e492f910] | 427 | status = mq_unlink( "mq1" ); |
---|
| 428 | fatal_directive_status( status, 0, "mq_unlink locked message queue"); |
---|
| 429 | |
---|
[6eb3e68] | 430 | puts( "mq_open - Reopen mq1 SUCCESSFUL with a different id" ); |
---|
| 431 | n_mq2 = mq_open( "mq1", O_CREAT | O_EXCL, 00777, NULL); |
---|
| 432 | assert( n_mq2 != (-1) ); |
---|
[e492f910] | 433 | assert( n_mq2 != n_mq1 ); |
---|
| 434 | |
---|
| 435 | /* |
---|
[99e7ab89] | 436 | * Validate it "mq1" can be closed and unlinked. |
---|
[e492f910] | 437 | */ |
---|
| 438 | |
---|
[99e7ab89] | 439 | puts( "mq_unlink - mq1 SUCCESSFUL" ); |
---|
[e492f910] | 440 | status = mq_unlink( "mq1" ); |
---|
| 441 | fatal_directive_status( status, 0, "mq_unlink locked message queue"); |
---|
| 442 | |
---|
[99e7ab89] | 443 | puts( "mq_close mq1 - SUCCESSFUL" ); |
---|
[6eb3e68] | 444 | status = mq_close( n_mq2 ); |
---|
| 445 | fatal_directive_status( status, 0, "mq_close message queue"); |
---|
[99e7ab89] | 446 | status = mq_close( n_mq1 ); |
---|
| 447 | fatal_directive_status( status, 0, "mq_close message queue"); |
---|
| 448 | status = mq_close( mqs[0] ); |
---|
| 449 | fatal_directive_status( status, 0, "mq_close message queue"); |
---|
[6eb3e68] | 450 | |
---|
[99e7ab89] | 451 | puts( "mq_unlink - UNSUCCESSFUL (ENOENT)" ); |
---|
[e492f910] | 452 | status = mq_unlink("mq1"); |
---|
| 453 | fatal_directive_status( status, -1, "mq_unlink error return status"); |
---|
| 454 | fatal_directive_status( errno, ENOENT, "mq_close errno EINVAL"); |
---|
| 455 | |
---|
| 456 | /* |
---|
| 457 | * XXX - Cant' create location OBJECTS_ERROR or OBJECTS_REMOTE. |
---|
| 458 | * mq_close and mq_unlink. |
---|
[99e7ab89] | 459 | * XXX - Don't think we need this save until yellow line tested. |
---|
[e492f910] | 460 | puts( "Init: mq_unlink - UNSUCCESSFUL (ENOENT)" ); |
---|
[6eb3e68] | 461 | status = mq_unlink("mq3"); |
---|
[e492f910] | 462 | fatal_directive_status( status, -1, "mq_unlink error return status"); |
---|
| 463 | fatal_directive_status( errno, ENOENT, "mq_unlink errno ENOENT"); |
---|
| 464 | assert( (status == -1) && (errno == ENOENT) ); |
---|
[99e7ab89] | 465 | */ |
---|
[6eb3e68] | 466 | |
---|
| 467 | |
---|
| 468 | /* |
---|
| 469 | * Validate we can wait on a message queue opened with mq_open. |
---|
| 470 | */ |
---|
| 471 | #if (0) /* XXX FIX ME */ |
---|
| 472 | puts( "Init: mq_wait on mq1" ); |
---|
| 473 | status = mq_receive(n_mq1); |
---|
| 474 | fatal_directive_status( status, 0, "mq_wait opened message queue"); |
---|
[e492f910] | 475 | #endif |
---|
[6eb3e68] | 476 | |
---|
| 477 | |
---|
[a8df60b] | 478 | puts( "*** END OF POSIX MESSAGE QUEUE TEST ***" ); |
---|
| 479 | exit( 0 ); |
---|
| 480 | |
---|
| 481 | return NULL; /* just so the compiler thinks we returned something */ |
---|
| 482 | } |
---|
[99e7ab89] | 483 | |
---|
| 484 | |
---|