1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2012. |
---|
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.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #define CONFIGURE_INIT |
---|
15 | #include "system.h" |
---|
16 | #include <errno.h> |
---|
17 | #include "tmacros.h" |
---|
18 | #include <mqueue.h> |
---|
19 | #include <sched.h> |
---|
20 | #include <fcntl.h> |
---|
21 | #include <time.h> |
---|
22 | #include <tmacros.h> |
---|
23 | #include <signal.h> /* signal facilities */ |
---|
24 | #include "test_support.h" |
---|
25 | |
---|
26 | const char rtems_test_name[] = "PSXMSGQ 2"; |
---|
27 | |
---|
28 | /* forward declarations to avoid warnings */ |
---|
29 | void *POSIX_Init(void *argument); |
---|
30 | |
---|
31 | pthread_t Init_id; |
---|
32 | |
---|
33 | void *POSIX_Init( |
---|
34 | void *argument |
---|
35 | ) |
---|
36 | { |
---|
37 | struct mq_attr attr; |
---|
38 | mqd_t mq; |
---|
39 | |
---|
40 | TEST_BEGIN(); |
---|
41 | |
---|
42 | |
---|
43 | /* set the time of day, and print our buffer in multiple ways */ |
---|
44 | |
---|
45 | set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 ); |
---|
46 | |
---|
47 | /* get id of this thread */ |
---|
48 | |
---|
49 | Init_id = pthread_self(); |
---|
50 | printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id ); |
---|
51 | |
---|
52 | rtems_workspace_greedy_allocate( NULL, 0 ); |
---|
53 | |
---|
54 | attr.mq_maxmsg = MAXMSG; |
---|
55 | attr.mq_msgsize = MSGSIZE; |
---|
56 | puts("Init: mq_open - Workspace not available - ENOMEM"); |
---|
57 | mq = mq_open( Get_Longest_Name(), O_CREAT, 0x777, &attr ); |
---|
58 | fatal_posix_service_status_errno(mq, ENOMEM, "no workspace available"); |
---|
59 | |
---|
60 | TEST_END(); |
---|
61 | rtems_test_exit( 0 ); |
---|
62 | |
---|
63 | return NULL; /* just so the compiler thinks we returned something */ |
---|
64 | } |
---|