harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r480885 - in /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux: hysignal.c hysignal_context.c hysignal_context.h
Date Thu, 30 Nov 2006 10:12:42 GMT
Author: hindessm
Date: Thu Nov 30 02:12:41 2006
New Revision: 480885

URL: http://svn.apache.org/viewvc?view=rev&rev=480885
Log:
Refactor signal info struct to two - one generic and one platform specific.
Rename 'linux386' variables to 'unix' to reflect usage.
Rename 'hyinfo' to 'hyInfo' to be more consistent with other variable names.
Removed unused trace comments.

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal.c
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.c
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.h

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal.c?view=diff&rev=480885&r1=480884&r2=480885
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal.c
Thu Nov 30 02:12:41 2006
@@ -32,7 +32,7 @@
 
 #define MAX_PORTLIB_SIGNAL_TYPES  8
 
-typedef void (*linux386_sigaction) (int, siginfo_t *, void *);
+typedef void (*unix_sigaction) (int, siginfo_t *, void *);
 
 /* Store the previous signal handlers, we need to restore them when we're done */
 static struct
@@ -48,19 +48,19 @@
 
 static U_32 attachedPortLibraries;
 
-typedef struct HyLinux386AsyncHandlerRecord
+typedef struct HyUnixAsyncHandlerRecord
 {
   HyPortLibrary *portLib;
   hysig_handler_fn handler;
   void *handler_arg;
   U_32 flags;
-  struct HyLinux386AsyncHandlerRecord *next;
-} HyLinux386AsyncHandlerRecord;
+  struct HyUnixAsyncHandlerRecord *next;
+} HyUnixAsyncHandlerRecord;
 
 /* holds the options set by hysig_set_options */
 static U_32 signalOptions;
 
-static HyLinux386AsyncHandlerRecord *asyncHandlerList;
+static HyUnixAsyncHandlerRecord *asyncHandlerList;
 
 static sem_t wakeUpASynchReporter;
 static sem_t sigQuitPendingSem;
@@ -152,7 +152,7 @@
 
 static U_32 registerSignalHandlerWithOS (HyPortLibrary * portLibrary,
                                          U_32 portLibrarySignalNo,
-                                         linux386_sigaction handler);
+                                         unix_sigaction handler);
 
 
 I_32 VMCALL
@@ -269,14 +269,12 @@
               /* the handler had long jumped back here -- reset the signal handler stack
and return */
               hythread_tls_set (thisThread, tlsKey, thisRecord.previous);
               *result = 0;
-              /* Trc_PRT_signal_hysignal_sigProtect_Exit_exception(); */
               return HYPORT_SIG_EXCEPTION_OCCURRED;
             }
         }
 
       if (hythread_tls_set (thisThread, tlsKey, &thisRecord))
         {
-          /* Trc_PRT_signal_hysignal_sigProtect_Exit2_error(); */
           return HYPORT_SIG_ERROR;
         }
 
@@ -299,8 +297,8 @@
 
   U_32 rc = 0;
   U_32 signalsRegisteredWithOS = 0;
-  HyLinux386AsyncHandlerRecord *cursor;
-  HyLinux386AsyncHandlerRecord **previousLink;
+  HyUnixAsyncHandlerRecord *cursor;
+  HyUnixAsyncHandlerRecord **previousLink;
 
   hythread_monitor_enter (masterHandlerMonitor);
   if (HYPORT_SIG_OPTIONS_REDUCED_SIGNALS & signalOptions)
@@ -361,7 +359,7 @@
       /* cursor will only be NULL if we failed to find it in the list */
       if (flags != 0)
         {
-          HyLinux386AsyncHandlerRecord *record =
+          HyUnixAsyncHandlerRecord *record =
             portLibrary->mem_allocate_memory (portLibrary, sizeof (*record));
 
           if (record == NULL)
@@ -466,12 +464,10 @@
 asynchSignalReporter (void *userData)
 {
   U_32 type;
-  HyLinux386AsyncHandlerRecord *cursor;
+  HyUnixAsyncHandlerRecord *cursor;
   U_32 result = FALSE;
   U_32 asyncSignalFlag = 0;
 
-  /* Trc_PRT_signal_hysignal_asynchSignalReporter_Entry(signal); */
-
   /* Need an exit condition... */
   for (;;)
     {
@@ -561,7 +557,6 @@
 
   thisRecord = NULL;
 
-  /* Trc_PRT_signal_hysignal_masterHandler_Entry(signal, sigInfo, contextInfo); */
   portLibType = mapUnixSignalToPortLib (signal, sigInfo);
 
   /* record this signal in tls so that jsig_handler can be called if any of the handlers
decide we should be shutting down */
@@ -580,28 +575,30 @@
     {
       if (thisRecord->flags & portLibType)
         {
-          struct HyLinux386SignalInfo hyinfo;
+          struct HyUnixSignalInfo hyInfo;
+          struct HyPlatformSignalInfo platformSignalInfo;
           U_32 result;
 
-          memset (&hyinfo, 0, sizeof(hyinfo));
-
-          hyinfo.portLibrarySignalType = portLibType;
-          hyinfo.handlerAddress = (void *) thisRecord->handler;
-          hyinfo.handlerAddress2 = (void *) masterSynchSignalHandler;
+          memset(&hyInfo, 0, sizeof(hyInfo));
+          memset(&platformSignalInfo, 0, sizeof(platformSignalInfo));
 
-          hyinfo.sigInfo = sigInfo;
+          hyInfo.portLibrarySignalType = portLibType;
+          hyInfo.handlerAddress = (void *) thisRecord->handler;
+          hyInfo.handlerAddress2 = (void *) masterSynchSignalHandler;
+          hyInfo.sigInfo = sigInfo;
+          hyInfo.platformSignalInfo = platformSignalInfo;
 
           /* found a suitable handler */
           /* what signal type do we want to pass on here? port or platform based ? */
-          fillInLinux386SignalInfo (thisRecord->portLibrary, contextInfo,
-                                    &hyinfo);
+          fillInUnixSignalInfo (thisRecord->portLibrary, contextInfo,
+                                &hyInfo);
 
           /* remove the handler we are about to invoke, now, in case the handler crashes
*/
           hythread_tls_set (thisThread, tlsKey, thisRecord->previous);
 
           result =
             thisRecord->handler (thisRecord->portLibrary, portLibType,
-                                 &hyinfo, thisRecord->handler_arg);
+                                 &hyInfo, thisRecord->handler_arg);
 
           /* The only case in which we don't want the previous handler back on top is if
it just returned HYPORT_SIG_EXCEPTION_RETURN
            *              In this case we will remove it from the top after executing the
siglongjmp */
@@ -676,7 +673,6 @@
       break;
     }
 
-  /* Trc_PRT_signal_hysignal_AsynchSignalHandler_Entry(signal, sigInfo, contextInfo); */
   sem_post (&wakeUpASynchReporter);
 
   return;
@@ -699,7 +695,7 @@
 static U_32
 registerSignalHandlerWithOS (HyPortLibrary * portLibrary,
                              U_32 portLibrarySignalNo,
-                             linux386_sigaction handler)
+                             unix_sigaction handler)
 {
   struct sigaction newAction;
   U_32 unixSignalNo;
@@ -831,7 +827,7 @@
                         U_32 allowedSubsetOfFlags)
 {
   U_32 flagsSignalsOnly, flagsWithoutHandlers;
-  linux386_sigaction handler;
+  unix_sigaction handler;
 
   if (allowedSubsetOfFlags == HYPORT_SIG_FLAG_SIGALLSYNC)
     {
@@ -1046,8 +1042,8 @@
 removeAsyncHandlers (HyPortLibrary * portLibrary)
 {
   /* clean up the list of async handlers */
-  HyLinux386AsyncHandlerRecord *cursor;
-  HyLinux386AsyncHandlerRecord **previousLink;
+  HyUnixAsyncHandlerRecord *cursor;
+  HyUnixAsyncHandlerRecord **previousLink;
 
   hythread_monitor_enter (asyncMonitor);
 

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.c?view=diff&rev=480885&r1=480884&r2=480885
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.c
Thu Nov 30 02:12:41 2006
@@ -20,11 +20,11 @@
 #include <string.h>
 #include <sys/ucontext.h>
 #include "hysignal_context.h"
-
+#include <assert.h>
 
 void
-fillInLinux386SignalInfo (struct HyPortLibrary *portLibrary, void *contextInfo,
-                          struct HyLinux386SignalInfo *hyinfo)
+fillInUnixSignalInfo (struct HyPortLibrary *portLibrary, void *contextInfo,
+                          struct HyUnixSignalInfo *hyInfo)
 {
   struct sigcontext *sigContext;
   ucontext_t *uContext;
@@ -36,14 +36,14 @@
   uContext = (ucontext_t *) contextInfo;
   sigContext = (struct sigcontext *) &uContext->uc_mcontext;
 
-  hyinfo->sigContext = sigContext;
+  hyInfo->platformSignalInfo.sigContext = sigContext;
   /* module info is filled on demand */
 }
 
 
 U_32
 infoForSignal (struct HyPortLibrary *portLibrary,
-               struct HyLinux386SignalInfo *info, I_32 index,
+               struct HyUnixSignalInfo *info, I_32 index,
                const char **name, void **value)
 {
   *name = "";
@@ -109,7 +109,7 @@
 
 U_32
 infoForFPR (struct HyPortLibrary *portLibrary,
-            struct HyLinux386SignalInfo *info, I_32 index, const char **name,
+            struct HyUnixSignalInfo *info, I_32 index, const char **name,
             void **value)
 {
   static const char *n_xmm[] = {
@@ -137,7 +137,7 @@
 
 U_32
 infoForGPR (struct HyPortLibrary *portLibrary,
-            struct HyLinux386SignalInfo *info, I_32 index, const char **name,
+            struct HyUnixSignalInfo *info, I_32 index, const char **name,
             void **value)
 {
   *name = "";
@@ -153,11 +153,11 @@
     case 0:
 #ifdef HYX86_64
       *name = "RDI";
-      *value = &info->sigContext->rdi;
+      *value = &info->platformSignalInfo.sigContext->rdi;
 #endif
 #ifdef HYX86
       *name = "EDI";
-      *value = &info->sigContext->edi;
+      *value = &info->platformSignalInfo.sigContext->edi;
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
     case HYPORT_SIG_GPR_X86_ESI:
@@ -165,11 +165,11 @@
     case 1:
 #ifdef HYX86
       *name = "ESI";
-      *value = &info->sigContext->esi;
+      *value = &info->platformSignalInfo.sigContext->esi;
 #endif
 #ifdef HYX86_64
       *name = "RSI";
-      *value = &info->sigContext->rsi;
+      *value = &info->platformSignalInfo.sigContext->rsi;
 #endif
       return HYPORT_SIG_VALUE_ADDRESS;
     case HYPORT_SIG_GPR_X86_EAX:
@@ -177,11 +177,11 @@
     case 2:
 #ifdef HYX86
       *name = "EAX";
-      *value = &info->sigContext->eax;
+      *value = &info->platformSignalInfo.sigContext->eax;
 #endif
 #ifdef HYX86_64
       *name = "RAX";
-      *value = &info->sigContext->rax;
+      *value = &info->platformSignalInfo.sigContext->rax;
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
     case HYPORT_SIG_GPR_X86_EBX:
@@ -189,11 +189,11 @@
     case 3:
 #ifdef HYX86
       *name = "EBX";
-      *value = &info->sigContext->ebx;
+      *value = &info->platformSignalInfo.sigContext->ebx;
 #endif
 #ifdef HYX86_64
       *name = "RBX";
-      *value = &info->sigContext->rbx;
+      *value = &info->platformSignalInfo.sigContext->rbx;
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
     case HYPORT_SIG_GPR_X86_ECX:
@@ -201,11 +201,11 @@
     case 4:
 #ifdef HYX86
       *name = "ECX";
-      *value = &info->sigContext->ecx;
+      *value = &info->platformSignalInfo.sigContext->ecx;
 #endif
 #ifdef HYX86_64
       *name = "RCX";
-      *value = &info->sigContext->rcx;
+      *value = &info->platformSignalInfo.sigContext->rcx;
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
     case HYPORT_SIG_GPR_X86_EDX:
@@ -213,11 +213,11 @@
     case 5:
 #ifdef HYX86
       *name = "EDX";
-      *value = &info->sigContext->edx;
+      *value = &info->platformSignalInfo.sigContext->edx;
 #endif
 #ifdef HYX86_64
       *name = "RDX";
-      *value = &info->sigContext->rdx;
+      *value = &info->platformSignalInfo.sigContext->rdx;
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
     default:
@@ -229,7 +229,7 @@
 
 U_32
 infoForControl (struct HyPortLibrary *portLibrary,
-                struct HyLinux386SignalInfo *info, I_32 index,
+                struct HyUnixSignalInfo *info, I_32 index,
                 const char **name, void **value)
 {
   *name = "";
@@ -245,59 +245,59 @@
     case 0:
 #ifdef HYX86
       *name = "EIP";
-      *value = (void *) &(info->sigContext->eip);
+      *value = (void *) &(info->platformSignalInfo.sigContext->eip);
 #endif
 #ifdef HYX86_64
       *name = "RIP";
-      *value = (void *) &(info->sigContext->rip);
+      *value = (void *) &(info->platformSignalInfo.sigContext->rip);
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
 #ifdef HYX86
     case 1:
       *name = "ES";
-      *value = (void *) &(info->sigContext->es);
+      *value = (void *) &(info->platformSignalInfo.sigContext->es);
       return HYPORT_SIG_VALUE_ADDRESS;
     case 2:
       *name = "DS";
-      *value = (void *) &(info->sigContext->ds);
+      *value = (void *) &(info->platformSignalInfo.sigContext->ds);
       return HYPORT_SIG_VALUE_ADDRESS;
 #endif
     case HYPORT_SIG_CONTROL_SP:
     case 3:
 #ifdef HYX86
       *name = "ESP";
-      *value = (void *) &(info->sigContext->esp);
+      *value = (void *) &(info->platformSignalInfo.sigContext->esp);
 #endif
 #ifdef HYX86_64
       *name = "RSP";
-      *value = (void *) &(info->sigContext->rsp);
+      *value = (void *) &(info->platformSignalInfo.sigContext->rsp);
 #endif
       return HYPORT_SIG_VALUE_ADDRESS;
     case 4:
 #ifndef HYIA64
       *name = "EFlags";
-      *value = (void *) &(info->sigContext->eflags);
+      *value = (void *) &(info->platformSignalInfo.sigContext->eflags);
       return HYPORT_SIG_VALUE_ADDRESS;
     case 5:
       *name = "CS";
-      *value = (void *) &(info->sigContext->cs);
+      *value = (void *) &(info->platformSignalInfo.sigContext->cs);
 #endif
       return HYPORT_SIG_VALUE_ADDRESS;
 #ifdef HYX86
     case 6:
       *name = "SS";
-      *value = (void *) &(info->sigContext->ss);
+      *value = (void *) &(info->platformSignalInfo.sigContext->ss);
       return HYPORT_SIG_VALUE_ADDRESS;
 #endif
 	case HYPORT_SIG_CONTROL_BP:
     case 7:
 #ifdef HYX86
       *name = "EBP";
-      *value = &info->sigContext->ebp;
+      *value = &info->platformSignalInfo.sigContext->ebp;
 #endif
 #ifdef HYX86_64
       *name = "RBP";
-      *value = &info->sigContext->rbp;
+      *value = &info->platformSignalInfo.sigContext->rbp;
 #endif
 	  return HYPORT_SIG_VALUE_ADDRESS;
     default:
@@ -308,11 +308,11 @@
 
 U_32
 infoForModule (struct HyPortLibrary *portLibrary,
-               struct HyLinux386SignalInfo *info, I_32 index,
+               struct HyUnixSignalInfo *info, I_32 index,
                const char **name, void **value)
 {
   void *address;
-  Dl_info *dl_info = &(info->dl_info);
+  Dl_info *dl_info = &(info->platformSignalInfo.dl_info);
   *name = "";
 
 #ifdef HYIA64
@@ -320,16 +320,19 @@
 #endif
 
 #ifdef HYX86
-  address = (void *) info->sigContext->eip;
-  int dl_result = dladdr ((void *) info->sigContext->eip, dl_info);
+  address = (void *) info->platformSignalInfo.sigContext->eip;
+  int dl_result =
+    dladdr ((void *) info->platformSignalInfo.sigContext->eip, dl_info);
 #endif
 #ifdef HYX86_64
-  address = (void *) info->sigContext->rip;
-  int dl_result = dladdr ((void *) info->sigContext->rip, dl_info);
+  address = (void *) info->platformSignalInfo.sigContext->rip;
+  int dl_result =
+    dladdr ((void *) info->platformSignalInfo.sigContext->rip, dl_info);
 #endif
 #ifdef HYIA64
   int dl_result = 0;
 #endif
+
   switch (index)
     {
     case HYPORT_SIG_MODULE_NAME:

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.h?view=diff&rev=480885&r1=480884&r2=480885
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.h
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/linux/hysignal_context.h
Thu Nov 30 02:12:41 2006
@@ -23,36 +23,41 @@
 #include <dlfcn.h>
 #undef __USE_GNU
 
-typedef struct HyLinux386SignalInfo
+typedef struct HyPlatformSignalInfo
+{
+  struct sigcontext *sigContext;
+  Dl_info dl_info;
+} HyPlatformSignalInfo;
+
+typedef struct HyUnixSignalInfo
 {
   U_32 portLibrarySignalType;
   void *handlerAddress;
   void *handlerAddress2;
-  struct sigcontext *sigContext;
   siginfo_t *sigInfo;
-  Dl_info dl_info;
-} HyLinux386SignalInfo;
+  struct HyPlatformSignalInfo platformSignalInfo;
+} HyUnixSignalInfo;
 
 U_32 infoForFPR (struct HyPortLibrary *portLibrary,
-                 struct HyLinux386SignalInfo *info, I_32 index,
+                 struct HyUnixSignalInfo *info, I_32 index,
                  const char **name, void **value);
 
 U_32 infoForGPR (struct HyPortLibrary *portLibrary,
-                 struct HyLinux386SignalInfo *info, I_32 index,
+                 struct HyUnixSignalInfo *info, I_32 index,
                  const char **name, void **value);
 
 U_32 infoForModule (struct HyPortLibrary *portLibrary,
-                    struct HyLinux386SignalInfo *info, I_32 index,
+                    struct HyUnixSignalInfo *info, I_32 index,
                     const char **name, void **value);
 
 U_32 infoForControl (struct HyPortLibrary *portLibrary,
-                     struct HyLinux386SignalInfo *info, I_32 index,
+                     struct HyUnixSignalInfo *info, I_32 index,
                      const char **name, void **value);
 
 U_32 infoForSignal (struct HyPortLibrary *portLibrary,
-                    struct HyLinux386SignalInfo *info, I_32 index,
+                    struct HyUnixSignalInfo *info, I_32 index,
                     const char **name, void **value);
 
-void fillInLinux386SignalInfo (struct HyPortLibrary *portLibrary,
-                               void *contextInfo,
-                               struct HyLinux386SignalInfo *hyinfo);
+void fillInUnixSignalInfo (struct HyPortLibrary *portLibrary,
+                           void *contextInfo,
+                           struct HyUnixSignalInfo *hyInfo);



Mime
View raw message