1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2009. |
---|
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.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #include <pmacros.h> |
---|
13 | #include <unistd.h> |
---|
14 | #include <errno.h> |
---|
15 | #include <tmacros.h> |
---|
16 | |
---|
17 | #include <fcntl.h> /* For O_* constants */ |
---|
18 | #include <sys/stat.h> /* For mode constants */ |
---|
19 | #include <mqueue.h> |
---|
20 | |
---|
21 | #include "test_support.h" |
---|
22 | |
---|
23 | void *POSIX_Init( |
---|
24 | void *argument |
---|
25 | ) |
---|
26 | { |
---|
27 | struct mq_attr attr; |
---|
28 | mqd_t Queue; |
---|
29 | int sc; |
---|
30 | |
---|
31 | puts( "\n\n*** POSIX MESSAGE QUEUE TEST 4 ***" ); |
---|
32 | |
---|
33 | attr.mq_maxmsg = 1; |
---|
34 | attr.mq_msgsize = sizeof(int); |
---|
35 | |
---|
36 | puts( "Init - Open message queue" ); |
---|
37 | Queue = mq_open( "Queue", O_CREAT | O_RDWR, 0x777, &attr ); |
---|
38 | if ( Queue == (-1) ) |
---|
39 | perror( "mq_open failed" ); |
---|
40 | assert( Queue != (-1) ); |
---|
41 | |
---|
42 | puts( "Init - Close message queue" ); |
---|
43 | sc = mq_close( Queue ); |
---|
44 | if ( sc != 0 ) |
---|
45 | perror( "mq_close failed" ); |
---|
46 | assert( sc == 0 ); |
---|
47 | |
---|
48 | puts( "*** END OF POSIX MESSAGE QUEUE TEST 4 ***" ); |
---|
49 | rtems_test_exit( 0 ); |
---|
50 | |
---|
51 | return NULL; /* just so the compiler thinks we returned something */ |
---|
52 | } |
---|
53 | |
---|
54 | /* configuration information */ |
---|
55 | |
---|
56 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
57 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
58 | |
---|
59 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
60 | |
---|
61 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
62 | #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 |
---|
63 | |
---|
64 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
65 | |
---|
66 | #define CONFIGURE_INIT |
---|
67 | #include <rtems/confdefs.h> |
---|
68 | /* end of include file */ |
---|