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.com/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 | |
---|
19 | /* forward declarations to avoid warnings */ |
---|
20 | void *POSIX_Init(void *argument); |
---|
21 | void Key_destructor(void *key_data); |
---|
22 | |
---|
23 | void Key_destructor(void *key_data) |
---|
24 | { |
---|
25 | } |
---|
26 | |
---|
27 | void *POSIX_Init( |
---|
28 | void *argument |
---|
29 | ) |
---|
30 | { |
---|
31 | int status; |
---|
32 | |
---|
33 | puts( "\n\n*** POSIX KEY 01 TEST ***" ); |
---|
34 | |
---|
35 | /* set the time of day, and print our buffer in multiple ways */ |
---|
36 | |
---|
37 | set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 ); |
---|
38 | |
---|
39 | /* get id of this thread */ |
---|
40 | |
---|
41 | Init_id = pthread_self(); |
---|
42 | printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id ); |
---|
43 | |
---|
44 | rtems_workspace_greedy_allocate( NULL, 0 ); |
---|
45 | |
---|
46 | puts("Init: pthread_key_create - ENOMEM (Workspace not available)"); |
---|
47 | empty_line(); |
---|
48 | status = pthread_key_create( &Key_id[0], Key_destructor ); |
---|
49 | fatal_directive_check_status_only( status, ENOMEM, "no workspace available" ); |
---|
50 | |
---|
51 | puts( "*** END OF POSIX KEY 01 TEST ***" ); |
---|
52 | rtems_test_exit( 0 ); |
---|
53 | |
---|
54 | return NULL; /* just so the compiler thinks we returned something */ |
---|
55 | } |
---|