home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / jahea131.zip / jvmras.h < prev   
C/C++ Source or Header  |  2003-01-18  |  9KB  |  243 lines

  1. /*
  2.  * @(#)src/contract/ras/sov/jvmras.h, core, xs131, 20030107 1.2
  3.  * ===========================================================================
  4.  * Licensed Materials - Property of IBM
  5.  * "Restricted Materials of IBM"
  6.  *
  7.  * IBM Java(tm)2 SDK, Standard Edition, v 1.3.1
  8.  * (C) Copyright IBM Corp. 1998, 2001. All Rights Reserved
  9.  * US Government Users Restricted Rights - Use, duplication or disclosure
  10.  * restricted by GSA ADP Schedule Contract with IBM Corp.
  11.  * ===========================================================================
  12.  * Module Information:
  13.  *
  14.  * DESCRIPTION:
  15.  * RAS header file for use in all core libraries that use any of the facilities
  16.  * provided by the Diagnostics subcomponent of the JVM.
  17.  * ===========================================================================
  18.  */
  19. #ifndef _IBM_JVMRAS_H_
  20. #define _IBM_JVMRAS_H_
  21.  
  22. #include <jni.h>
  23.  
  24. /*
  25.  * ======================================================================
  26.  * Allow for inclusion in C++
  27.  * ======================================================================
  28.  */
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. /*
  34.  * ======================================================================
  35.  * Forward declarations
  36.  * ======================================================================
  37.  */
  38.  
  39. struct DgTrcExecStruct;
  40. typedef struct DgTrcExecStruct DgTrcExec;
  41. struct rasHpiInterface;
  42. typedef struct rasHpiInterface RasHpiInterface;
  43. struct rasJniInterface;
  44. typedef struct rasJniInterface RasJniInterface;
  45.  
  46. /*
  47.  * ======================================================================
  48.  * RasInfo structures
  49.  * ======================================================================
  50.  */
  51. typedef struct RasInfo {
  52.     int  type;
  53.     union {
  54.  
  55.         struct {
  56.             int    number;
  57.             char **names;
  58.         } query;
  59.  
  60.         struct {
  61.             int    number;
  62.             char **names;
  63.         } trace_components;
  64.  
  65.         struct {
  66.             char          *name;
  67.             int            first;
  68.             int            last;
  69.             unsigned char *bitMap;
  70.         } trace_component;
  71.     } info;
  72. } RasInfo;
  73.  
  74. #define RASINFO_TYPES               0
  75. #define RASINFO_TRACE_COMPONENTS    1
  76. #define RASINFO_TRACE_COMPONENT     2
  77. #define RASINFO_MAX_TYPES           2
  78.  
  79. /*
  80.  * ======================================================================
  81.  *  Macro to initialise the values of JvmRasHeader
  82.  * ======================================================================
  83.  */
  84.  
  85. #define RasHdrInit(ptr, name, size) \
  86.         memcpy(((JvmRasHeader *)ptr)->eyecatcher, name, 4); \
  87.         ((JvmRasHeader *)ptr)->length = size;
  88.  
  89. /*
  90.  * ======================================================================
  91.  * External access facade
  92.  * ======================================================================
  93.  */
  94. #define JVMRAS_VERSION_1_1      0x7F000001
  95.  
  96. typedef struct DgRasInterface {
  97.     char    eyecatcher[4];
  98.     int     length;
  99.     int     version;
  100.     int     modification;
  101.     int     (JNICALL *TraceRegister)(JNIEnv *env,
  102.                                      void (JNICALL *func)(JNIEnv *env2,
  103.                              void **threadLocal, int traceId,
  104.                              const char * format, va_list var));
  105.     int     (JNICALL *TraceDeregister)(JNIEnv *env,
  106.                                        void (JNICALL *func)(JNIEnv *env2,
  107.                                void **threadLocal, int traceId,
  108.                                const char * format, va_list var));
  109.     int     (JNICALL *TraceSet)(JNIEnv *env, const char *);
  110.     void    (JNICALL *TraceSnap)(JNIEnv *env, char *);
  111.     void    (JNICALL *TraceSuspend)(JNIEnv *env);
  112.     void    (JNICALL *TraceResume)(JNIEnv *env);
  113.     int     (JNICALL *GetRasInfo)(JNIEnv * env, RasInfo * info_ptr);
  114.     int     (JNICALL *ReleaseRasInfo)(JNIEnv * env, RasInfo * info_ptr);
  115.     int     (JNICALL *DumpRegister)(JNIEnv *env,
  116.                                     int (JNICALL *func)(JNIEnv *env2,
  117.                                                         void **threadLocal,
  118.                                                         int reason));
  119.     int     (JNICALL *DumpDeregister)(JNIEnv *env,
  120.                                       int (JNICALL *func)(JNIEnv *env2,
  121.                                                           void **threadLocal,
  122.                                                           int reason));
  123.     void    (JNICALL *NotifySignal)(JNIEnv *env, int signal);
  124.     /*start ibm@36537*/
  125.     int     (JNICALL *CreateThread)( JNIEnv *env, void (JNICALL *startFunc)(void*),
  126.                                         void *args, int GCSuspend );
  127.     int     (JNICALL *GenerateJavacore)( JNIEnv *env );
  128.     int     (JNICALL *RunDumpRoutine)( JNIEnv *env, int componentID, int level,
  129.                                        void (*printrtn)(void *env, const char *tagName,
  130.                                                         const char *fmt, ...) );
  131.     int     (JNICALL *InjectSigsegv)( JNIEnv *env );
  132.     int     (JNICALL *InjectOutOfMemory)( JNIEnv *env );
  133.     int     (JNICALL *SetOutOfMemoryHook)( JNIEnv *env, void (*OutOfMemoryFunc)(void) );
  134.     int     (JNICALL *GetComponentDataArea)( JNIEnv *env, char *componentName,
  135.                                                void **dataArea, int *dataSize );
  136.     int     (JNICALL *InitiateSystemDump)( JNIEnv *env );
  137.     /*end ibm@36537*/
  138. } DgRasInterface;
  139.  
  140. /*
  141.  * ======================================================================
  142.  *    Dump exit return codes
  143.  * ======================================================================
  144.  */
  145.  
  146. #define RAS_DUMP_CONTINUE   0         /* Continue with diagnostic collection */
  147. #define RAS_DUMP_ABORT      1         /* No more diagnostics should be taken */
  148.  
  149. /*
  150.  * ======================================================================
  151.  *    Thread Creation types
  152.  * ======================================================================
  153.  */
  154.  
  155. /*start ibm@36537*/
  156. #define NO_GC_THREAD_SUSPEND    0       /* Do not suspend thread during CG. */
  157. #define GC_THREAD_SUSPEND       1       /* Suspend thread during CG. */
  158.  
  159. #define RAS_THREAD_NAME_SIZE    50      /* Size of Ras Thread Name. */
  160. /*end ibm@36537*/
  161.  
  162. /*
  163.  * ======================================================================
  164.  *    Dump Handler types                                        ibm@36540
  165.  * ======================================================================
  166.  */
  167.  
  168. enum dumpType {
  169.      NODUMPS      = 0,
  170.      JAVADUMP     = 0x01,
  171.      SYSDUMP      = 0x02,
  172.      CEEDUMP      = 0x04,
  173.      HEAPDUMP     = 0x08,                                      /*ibm@56721*/
  174.      MAXDUMPTYPES = 6                                          /*ibm@56721*/
  175. };
  176.  
  177. #define ALLDUMPS (JAVADUMP | SYSDUMP | CEEDUMP | HEAPDUMP)     /*ibm@56721*/
  178. #define OSDUMP    ALLDUMPS + 1
  179.  
  180. /*
  181.  * ======================================================================
  182.  *    RAS structure header
  183.  * ======================================================================
  184.  */
  185.  
  186. typedef struct RasDataHeader {
  187.     char eyecatcher[4];
  188.     int length;
  189.     int version;
  190.     int modification;
  191. } RasDataHeader;
  192.  
  193.  
  194. typedef void (*DgRasOutOfMemoryHook)(void);                 /*ibm@42314*/
  195.  
  196. /*
  197.  * ======================================================================
  198.  * Function prototypes
  199.  * ======================================================================
  200.  */
  201.  
  202. int  JNICALL rasTraceRegister(JNIEnv *env , void (JNICALL *func)(JNIEnv *env2,
  203.                         void **threadLocal, int traceId,
  204.                         const char * format, va_list varargs));
  205. int  JNICALL rasTraceDeregister(JNIEnv *env ,
  206.                                    void (JNICALL *func)(JNIEnv *env2,
  207.                           void **threadLocal, int traceId,
  208.                           const char * format, va_list varargs));
  209. int  JNICALL rasGetRasInfo(JNIEnv * env, RasInfo * info_ptr);
  210. int  JNICALL rasReleaseRasInfo(JNIEnv * env, RasInfo * info_ptr);
  211. /*start ibm@36537*/
  212. int  JNICALL rasCreateThread( JNIEnv *env, void (JNICALL *startFunc)(void*),
  213.                               void *args, int GCSuspend );
  214. int  JNICALL rasGenerateJavacore( JNIEnv *env );
  215. int  JNICALL rasRunDumpRoutine( JNIEnv *env, int componentID, int level,
  216.                                 void (*printrtn)(void *env, const char *tagName,
  217.                                                  const char *fmt, ...) );
  218. int  JNICALL rasInjectSigsegv( JNIEnv *env );
  219. int  JNICALL rasInjectOutOfMemory( JNIEnv *env );
  220. int  JNICALL rasSetOutOfMemoryHook( JNIEnv *env, void (*OutOfMemoryFunc)(void) );
  221. int  JNICALL rasGetComponentDataArea( JNIEnv *env, char *componentName,
  222.                                       void **dataArea, int *dataSize );
  223. int  JNICALL rasInitiateSystemDump( JNIEnv *env );
  224. DgRasOutOfMemoryHook dgGetOutOfMemoryHook(void);            /*ibm@42314*/
  225. /*end ibm@36537*/
  226.  
  227. /*
  228.  * ======================================================================
  229.  * Facade access macros
  230.  * ======================================================================
  231.  */
  232.  
  233. #define RAS_FACADE(env) dgTrcExec.rasTrcIntf->
  234.  
  235. #ifdef __cplusplus
  236. } /* extern "C" */
  237. #endif
  238. #endif /* !_IBM_JVMRAS_H_ */
  239.  
  240. /*
  241.  * End of file
  242.  */
  243.