Ticket #1364: gxxPatch

File gxxPatch, 2.4 KB (added by Eric Norum, on 01/28/09 at 14:54:03)

Patch

Line 
1Index: cpukit/libcsupport/src/gxx_wrappers.c
2===================================================================
3RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/gxx_wrappers.c,v
4retrieving revision 1.17
5diff -u -r1.17 gxx_wrappers.c
6--- cpukit/libcsupport/src/gxx_wrappers.c       5 Jan 2009 20:26:01 -0000       1.17
7+++ cpukit/libcsupport/src/gxx_wrappers.c       28 Jan 2009 15:47:13 -0000
8@@ -52,14 +52,11 @@
9 typedef void *__gthread_recursive_mutex_t;
10 
11 /* uncomment this if you need to debug this interface */
12-
13-/*
14-#define DEBUG_GXX_WRAPPERS 1
15-*/
16+/*#define DEBUG_GXX_WRAPPERS 1*/
17 
18 #ifdef DEBUG_GXX_WRAPPERS
19 /* local function to return the ID of the calling thread */
20-static rtems_id get_tid( void )
21+static rtems_id gxx_get_tid( void )
22 {
23    rtems_id id = 0;
24    rtems_task_ident( RTEMS_SELF, 0, &id );
25@@ -160,7 +157,7 @@
26   }
27 
28 #ifdef DEBUG_GXX_WRAPPERS
29-   printk( "gxx_wrappers: getspecific key=%x, ptr=%x, id=%x\n", key, p, get_tid() );
30+   printk( "gxx_wrappers: getspecific key=%x, ptr=%x, id=%x\n", key, p, gxx_get_tid() );
31 #endif
32    return p;
33 }
34@@ -169,7 +166,7 @@
35 int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr)
36 {
37 #ifdef DEBUG_GXX_WRAPPERS
38-  printk( "gxx_wrappers: setspecific key=%x, ptr=%x, id=%x\n", key, ptr, get_tid() );
39+  printk( "gxx_wrappers: setspecific key=%x, ptr=%x, id=%x\n", key, ptr, gxx_get_tid() );
40 #endif
41   /* register with RTEMS the buffer that will hold the key values */
42   if( rtems_task_variable_add( RTEMS_SELF, (void **)key, key->dtor ) == RTEMS_SUCCESSFUL )
43@@ -187,16 +184,20 @@
44  */
45 void rtems_gxx_mutex_init (__gthread_mutex_t *mutex)
46 {
47+  rtems_status_code s;
48 #ifdef DEBUG_GXX_WRAPPERS
49   printk( "gxx_wrappers: mutex init =%X\n", *mutex );
50 #endif
51-  if( rtems_semaphore_create( rtems_build_name ('G', 'C', 'C', '2'),
52+  if( (s = rtems_semaphore_create( rtems_build_name ('G', 'C', 'C', '2'),
53                               1,
54                              RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE
55                              |RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL,
56                              0,
57-                             (rtems_id *)mutex ) != RTEMS_SUCCESSFUL )
58+                             (rtems_id *)mutex )) != RTEMS_SUCCESSFUL )
59   {
60+#ifdef DEBUG_GXX_WRAPPERS
61+      printk( "gxx_wrappers: mutex init failed %s (%d)\n", rtems_status_text(s), s );
62+#endif
63       rtems_panic ("rtems_gxx_mutex_init");
64   }
65 #ifdef DEBUG_GXX_WRAPPERS