1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2008. |
---|
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 | #define CONFIGURE_INIT |
---|
13 | #include "system.h" |
---|
14 | #include <rtems.h> |
---|
15 | #include "tmacros.h" |
---|
16 | |
---|
17 | /* HACK: API visibility violation */ |
---|
18 | extern uint32_t rtems_object_api_minimum_class(uint32_t api); |
---|
19 | extern unsigned int rtems_object_api_maximum_class(uint32_t api); |
---|
20 | |
---|
21 | void *POSIX_Init( |
---|
22 | void *argument |
---|
23 | ) |
---|
24 | { |
---|
25 | char name[128]; |
---|
26 | char *ptr; |
---|
27 | rtems_status_code status; |
---|
28 | |
---|
29 | puts( "\n\n*** POSIX TEST 14 ***" ); |
---|
30 | |
---|
31 | ptr = rtems_object_get_name( pthread_self(), 128, name ); |
---|
32 | printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); |
---|
33 | |
---|
34 | /* Set my name to Justin */ |
---|
35 | puts( "Setting current thread name to Justin" ); |
---|
36 | status = rtems_object_set_name( pthread_self(), "Justin" ); |
---|
37 | directive_failed( status, "rtems_object_set_name" ); |
---|
38 | |
---|
39 | ptr = rtems_object_get_name( pthread_self(), 128, name ); |
---|
40 | printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); |
---|
41 | |
---|
42 | /* Set my name to Jordan */ |
---|
43 | puts( "Setting current thread name to Jordan" ); |
---|
44 | status = rtems_object_set_name( pthread_self(), "Jordan" ); |
---|
45 | directive_failed( status, "rtems_object_set_name" ); |
---|
46 | |
---|
47 | ptr = rtems_object_get_name( pthread_self(), 128, name ); |
---|
48 | printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); |
---|
49 | |
---|
50 | /* exercise the POSIX path through some routines */ |
---|
51 | printf( "rtems_object_api_minimum_class(OBJECTS_POSIX_API) returned %" PRId32 "\n", |
---|
52 | rtems_object_api_minimum_class(OBJECTS_POSIX_API) ); |
---|
53 | printf( "rtems_object_api_maximum_class(OBJECTS_POSIX_API) returned %d\n", |
---|
54 | rtems_object_api_maximum_class(OBJECTS_POSIX_API) ); |
---|
55 | |
---|
56 | printf( "rtems_object_get_api_name(POSIX_API) = %s\n", |
---|
57 | rtems_object_get_api_name(OBJECTS_POSIX_API) ); |
---|
58 | |
---|
59 | printf("rtems_object_get_api_class_name(POSIX_API, POSIX_KEYS) = %s\n", |
---|
60 | rtems_object_get_api_class_name( OBJECTS_POSIX_API, OBJECTS_POSIX_KEYS) |
---|
61 | ); |
---|
62 | |
---|
63 | |
---|
64 | puts( "*** END OF POSIX TEST 14 ***" ); |
---|
65 | rtems_test_exit( 0 ); |
---|
66 | |
---|
67 | return NULL; |
---|
68 | |
---|
69 | } |
---|