14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #include <stdlib.h> 27 #include <string.h> 28 #include <ctype.h> 29 #include <assert.h> 30 31 #include "jvm.h" 32 #include "jdk_util.h" 33 34 #ifndef JDK_UPDATE_VERSION 35 /* if not defined set to 00 */ 36 #define JDK_UPDATE_VERSION "00" 37 #endif 38 39 JNIEXPORT void 40 JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) { 41 /* These JDK_* macros are set at Makefile or the command line */ 42 const unsigned int jdk_major_version = 43 (unsigned int) atoi(JDK_MAJOR_VERSION); 44 const unsigned int jdk_minor_version = 45 (unsigned int) atoi(JDK_MINOR_VERSION); 46 const unsigned int jdk_micro_version = 47 (unsigned int) atoi(JDK_MICRO_VERSION); 48 49 const char* jdk_build_string = JDK_BUILD_NUMBER; 50 char build_number[4]; 51 unsigned int jdk_build_number = 0; 52 53 const char* jdk_update_string = JDK_UPDATE_VERSION; 54 unsigned int jdk_update_version = 0; 55 char update_ver[3]; 56 char jdk_special_version = '\0'; 57 58 /* If the JDK_BUILD_NUMBER is of format bXX and XX is an integer 59 * XX is the jdk_build_number. 60 */ 61 size_t len = strlen(jdk_build_string); 62 if (jdk_build_string[0] == 'b' && len >= 2) { 63 size_t i = 0; 64 for (i = 1; i < len; i++) { 65 if (isdigit(jdk_build_string[i])) { 66 build_number[i-1] = jdk_build_string[i]; 67 } else { 68 // invalid build number 69 i = -1; 70 break; 71 } 72 } 73 if (i == len) { 74 build_number[len-1] = '\0'; 75 jdk_build_number = (unsigned int) atoi(build_number) ; 76 } 77 } 78 79 assert(jdk_build_number <= 255); 80 81 if (strlen(jdk_update_string) == 2 || strlen(jdk_update_string) == 3) { 82 if (isdigit(jdk_update_string[0]) && isdigit(jdk_update_string[1])) { 83 update_ver[0] = jdk_update_string[0]; 84 update_ver[1] = jdk_update_string[1]; 85 update_ver[2] = '\0'; 86 jdk_update_version = (unsigned int) atoi(update_ver); 87 if (strlen(jdk_update_string) == 3) { 88 jdk_special_version = jdk_update_string[2]; 89 } 90 } 91 } 92 93 memset(info, 0, info_size); 94 info->jdk_version = ((jdk_major_version & 0xFF) << 24) | 95 ((jdk_minor_version & 0xFF) << 16) | 96 ((jdk_micro_version & 0xFF) << 8) | 97 (jdk_build_number & 0xFF); 98 info->update_version = jdk_update_version; 99 info->special_update_version = (unsigned int) jdk_special_version; 100 info->thread_park_blocker = 1; 101 // Advertise presence of sun.misc.PostVMInitHook: 102 // future optimization: detect if this is enabled. 103 info->post_vm_init_hook_enabled = 1; 104 info->pending_list_uses_discovered_field = 1; 105 } | 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #include <stdlib.h> 27 #include <string.h> 28 #include <ctype.h> 29 #include <assert.h> 30 31 #include "jvm.h" 32 #include "jdk_util.h" 33 34 JNIEXPORT void 35 JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) { 36 /* These VERSION_* macros are given by the build system */ 37 const unsigned int version_major = VERSION_MAJOR; 38 const unsigned int version_minor = VERSION_MINOR; 39 const unsigned int version_security = VERSION_SECURITY; 40 const unsigned int version_build = VERSION_BUILD; 41 42 memset(info, 0, info_size); 43 info->jdk_version = ((version_major & 0xFF) << 24) | 44 ((version_minor & 0xFF) << 16) | 45 ((version_security & 0xFF) << 8) | 46 (version_build & 0xFF); 47 // FIXME: update_version and special_update_version does not make sense anymore. 48 info->update_version = 0; 49 info->special_update_version = 0; 50 info->thread_park_blocker = 1; 51 // Advertise presence of sun.misc.PostVMInitHook: 52 // future optimization: detect if this is enabled. 53 info->post_vm_init_hook_enabled = 1; 54 info->pending_list_uses_discovered_field = 1; 55 } |