Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp
40951 views
/*1* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223#include <string.h>24#include "jvmti.h"25#include "agent_common.h"26#include "jni_tools.h"27#include "jvmti_tools.h"2829extern "C" {3031/* ============================================================================= */3233/** Agent library initialization. */34#ifdef STATIC_BUILD35JNIEXPORT jint JNICALL Agent_OnLoad_disposeenv001(JavaVM *jvm, char *options, void *reserved) {36return Agent_Initialize(jvm, options, reserved);37}38JNIEXPORT jint JNICALL Agent_OnAttach_disposeenv001(JavaVM *jvm, char *options, void *reserved) {39return Agent_Initialize(jvm, options, reserved);40}41JNIEXPORT jint JNI_OnLoad_disposeenv001(JavaVM *jvm, char *options, void *reserved) {42return JNI_VERSION_1_8;43}44#endif45jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {46jvmtiEnv* jvmti = NULL;4748if (!NSK_VERIFY(nsk_jvmti_parseOptions(options)))49return JNI_ERR;5051if (!NSK_VERIFY((jvmti =52nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))53return JNI_ERR;5455NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in Agent_OnLoad()\n");56if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {57return JNI_ERR;58}59NSK_DISPLAY0(" ... disposed\n");6061return JNI_OK;62}6364/* ============================================================================= */6566}676869