8212612: Add documentation about Arguments::_exit_hook
authoriklam
Wed, 17 Oct 2018 21:51:00 -0700
changeset 52185 c657b5b0e666
parent 52184 672bc2213cef
child 52186 0dac3131b0fd
8212612: Add documentation about Arguments::_exit_hook Reviewed-by: hseigel, dlong, dholmes
src/hotspot/share/runtime/arguments.cpp
src/hotspot/share/runtime/arguments.hpp
src/java.base/share/native/include/jni.h
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Oct 17 21:28:11 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Wed Oct 17 21:51:00 2018 -0700
@@ -106,6 +106,9 @@
 AgentLibraryList Arguments::_libraryList;
 AgentLibraryList Arguments::_agentList;
 
+// These are not set by the JDK's built-in launchers, but they can be set by
+// programs that embed the JVM using JNI_CreateJavaVM. See comments around
+// JavaVMOption in jni.h.
 abort_hook_t     Arguments::_abort_hook         = NULL;
 exit_hook_t      Arguments::_exit_hook          = NULL;
 vfprintf_hook_t  Arguments::_vfprintf_hook      = NULL;
--- a/src/hotspot/share/runtime/arguments.hpp	Wed Oct 17 21:28:11 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.hpp	Wed Oct 17 21:51:00 2018 -0700
@@ -36,7 +36,7 @@
 
 // Arguments parses the command line and recognizes options
 
-// Invocation API hook typedefs (these should really be defined in jni.hpp)
+// Invocation API hook typedefs (these should really be defined in jni.h)
 extern "C" {
   typedef void (JNICALL *abort_hook_t)(void);
   typedef void (JNICALL *exit_hook_t)(jint code);
--- a/src/java.base/share/native/include/jni.h	Wed Oct 17 21:28:11 2018 -0700
+++ b/src/java.base/share/native/include/jni.h	Wed Oct 17 21:51:00 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1871,6 +1871,20 @@
 #endif /* __cplusplus */
 };
 
+/*
+ * optionString may be any option accepted by the JVM, or one of the
+ * following:
+ *
+ * -D<name>=<value>          Set a system property.
+ * -verbose[:class|gc|jni]   Enable verbose output, comma-separated. E.g.
+ *                           "-verbose:class" or "-verbose:gc,class"
+ *                           Standard names include: gc, class, and jni.
+ *                           All nonstandard (VM-specific) names must begin
+ *                           with "X".
+ * vfprintf                  extraInfo is a pointer to the vfprintf hook.
+ * exit                      extraInfo is a pointer to the exit hook.
+ * abort                     extraInfo is a pointer to the abort hook.
+ */
 typedef struct JavaVMOption {
     char *optionString;
     void *extraInfo;