/*******************************************************************************1* Copyright (c) 1991, 2017 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#ifndef _IBM_JVMRAS_H_23#define _IBM_JVMRAS_H_2425/* @ddr_namespace: default */26/*27* ======================================================================28* Allow for inclusion in C++29* ======================================================================30*/31#ifdef __cplusplus32extern "C" {33#endif3435#include "jni.h"36#include "stdarg.h"3738/*39* ======================================================================40* Forward declarations41* ======================================================================42*/43typedef void (JNICALL *TraceListener)(JNIEnv *env, void **thrLocal, int traceId,44const char * format, va_list varargs);45typedef void (JNICALL *TraceListener50)(JNIEnv *env, void **thrLocal, const char *moduleName,46int traceId, const char * format, va_list varargs);47typedef void (*DgRasOutOfMemoryHook)(void);4849/*50* ======================================================================51* RasInfo structures52* ======================================================================53*/54typedef struct RasInfo {55int type;56union {57struct {58int number;59char **names;60} query;61struct {62int number;63char **names;64} trace_components;65struct {66char *name;67int first;68int last;69unsigned char *bitMap;70} trace_component;71} info;72} RasInfo;7374#define RASINFO_TYPES 075#define RASINFO_TRACE_COMPONENTS 176#define RASINFO_TRACE_COMPONENT 277#define RASINFO_MAX_TYPES 27879/*80* ======================================================================81* External access facade82* ======================================================================83*/84#define JVMRAS_VERSION_1_1 0x7F00000185#define JVMRAS_VERSION_1_3 0x7F00000386#define JVMRAS_VERSION_1_5 0x7F0000058788typedef struct DgRasInterface {89char eyecatcher[4];90int length;91int version;92int modification;93/* Interface level 1_1 */94int (JNICALL *TraceRegister)(JNIEnv *env, TraceListener func);95int (JNICALL *TraceDeregister)(JNIEnv *env, TraceListener func);96int (JNICALL *TraceSet)(JNIEnv *env, const char *);97void (JNICALL *TraceSnap)(JNIEnv *env, char *);98void (JNICALL *TraceSuspend)(JNIEnv *env);99void (JNICALL *TraceResume)(JNIEnv *env);100int (JNICALL *GetRasInfo)(JNIEnv * env, RasInfo * info_ptr);101int (JNICALL *ReleaseRasInfo)(JNIEnv * env, RasInfo * info_ptr);102int (JNICALL *DumpRegister)(JNIEnv *env,103int (JNICALL *func)(JNIEnv *env2,104void **threadLocal,105int reason));106int (JNICALL *DumpDeregister)(JNIEnv *env,107int (JNICALL *func)(JNIEnv *env2,108void **threadLocal,109int reason));110void (JNICALL *NotifySignal)(JNIEnv *env, int signal);111int (JNICALL *CreateThread)( JNIEnv *env, void (JNICALL *startFunc)(void*),112void *args, int GCSuspend );113int (JNICALL *GenerateJavacore)( JNIEnv *env );114int (JNICALL *RunDumpRoutine)( JNIEnv *env, int componentID, int level,115void (*printrtn)(void *env, const char *tagName,116const char *fmt, ...) );117int (JNICALL *InjectSigsegv)( JNIEnv *env );118int (JNICALL *InjectOutOfMemory)( JNIEnv *env );119int (JNICALL *SetOutOfMemoryHook)( JNIEnv *env, void (*OutOfMemoryFunc)(void) );120int (JNICALL *GetComponentDataArea)( JNIEnv *env, char *componentName,121void **dataArea, int *dataSize );122int (JNICALL *InitiateSystemDump)( JNIEnv *env );123/* Interface level 1_3 follows */124void (JNICALL *DynamicVerbosegc) (JNIEnv *env, int vgc_switch,125int vgccon, char* file_path,126int number_of_files,127int number_of_cycles);128void (JNICALL *TraceSuspendThis)(JNIEnv *env);129void (JNICALL *TraceResumeThis)(JNIEnv *env);130int (JNICALL *GenerateHeapdump)( JNIEnv *env );131/* Interface level 1_5 */132int (JNICALL *TraceRegister50)(JNIEnv *env, TraceListener50 func);133int (JNICALL *TraceDeregister50)(JNIEnv *env, TraceListener50 func);134} DgRasInterface;135136/*137* ======================================================================138* Dump exit return codes139* ======================================================================140*/141#define RAS_DUMP_CONTINUE 0 /* Continue with diagnostic collection */142#define RAS_DUMP_ABORT 1 /* No more diagnostics should be taken */143144/*145* ======================================================================146* Thread Creation types147* ======================================================================148*/149#define NO_GC_THREAD_SUSPEND 0 /* Do not suspend thread during CG. */150#define GC_THREAD_SUSPEND 1 /* Suspend thread during CG. */151#define RAS_THREAD_NAME_SIZE 50 /* Size of Ras Thread Name. */152153/*154* ======================================================================155* Dump Handler types156* ======================================================================157*/158enum dumpType {159NODUMPS = 0,160JAVADUMP = 0x01,161SYSDUMP = 0x02,162CEEDUMP = 0x04,163HEAPDUMP = 0x08,164MAXDUMPTYPES = 6,165166/* ensure 4-byte enum */167dumpTypeEnsureWideEnum = 0x1000000168};169170#define ALLDUMPS (JAVADUMP | SYSDUMP | CEEDUMP | HEAPDUMP)171#define OSDUMP (ALLDUMPS + 1)172173#ifdef __cplusplus174} /* extern "C" */175#endif176177#endif /* !_IBM_JVMRAS_H_ */178179180