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.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 <rtems.h> |
---|
17 | #include <rtems/score/objectimpl.h> |
---|
18 | #include "tmacros.h" |
---|
19 | |
---|
20 | const char rtems_test_name[] = "PSX 14"; |
---|
21 | |
---|
22 | void *POSIX_Init( |
---|
23 | void *argument |
---|
24 | ) |
---|
25 | { |
---|
26 | char name[128]; |
---|
27 | char *ptr; |
---|
28 | rtems_status_code status; |
---|
29 | |
---|
30 | TEST_BEGIN(); |
---|
31 | |
---|
32 | ptr = rtems_object_get_name( pthread_self(), 128, name ); |
---|
33 | printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); |
---|
34 | |
---|
35 | /* Set my name to Justin */ |
---|
36 | puts( "Setting current thread name to Justin" ); |
---|
37 | status = rtems_object_set_name( pthread_self(), "Justin" ); |
---|
38 | directive_failed( status, "rtems_object_set_name" ); |
---|
39 | |
---|
40 | ptr = rtems_object_get_name( pthread_self(), 128, name ); |
---|
41 | printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); |
---|
42 | |
---|
43 | /* Set my name to Jordan */ |
---|
44 | puts( "Setting current thread name to Jordan" ); |
---|
45 | status = rtems_object_set_name( pthread_self(), "Jordan" ); |
---|
46 | directive_failed( status, "rtems_object_set_name" ); |
---|
47 | |
---|
48 | ptr = rtems_object_get_name( pthread_self(), 128, name ); |
---|
49 | printf( "rtems_object_get_name returned (%s) for init thread\n", ptr ); |
---|
50 | |
---|
51 | /* exercise the POSIX path through some routines */ |
---|
52 | printf( "rtems_object_api_minimum_class(OBJECTS_POSIX_API) returned %d\n", |
---|
53 | rtems_object_api_minimum_class(OBJECTS_POSIX_API) ); |
---|
54 | printf( "rtems_object_api_maximum_class(OBJECTS_POSIX_API) returned %d\n", |
---|
55 | rtems_object_api_maximum_class(OBJECTS_POSIX_API) ); |
---|
56 | |
---|
57 | printf( "rtems_object_get_api_name(POSIX_API) = %s\n", |
---|
58 | rtems_object_get_api_name(OBJECTS_POSIX_API) ); |
---|
59 | |
---|
60 | printf("rtems_object_get_api_class_name(POSIX_API, POSIX_KEYS) = %s\n", |
---|
61 | rtems_object_get_api_class_name( OBJECTS_POSIX_API, OBJECTS_POSIX_KEYS) |
---|
62 | ); |
---|
63 | |
---|
64 | |
---|
65 | TEST_END(); |
---|
66 | rtems_test_exit( 0 ); |
---|
67 | |
---|
68 | return NULL; |
---|
69 | |
---|
70 | } |
---|