src/os/linux/vm/os_linux.cpp

Print this page

        

*** 1158,1168 **** // Skip blank chars do s++; while (isspace(*s)); /* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */ /* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */ ! i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu", &state, /* 3 %c */ &ppid, /* 4 %d */ &pgrp, /* 5 %d */ &session, /* 6 %d */ &nr, /* 7 %d */ --- 1158,1171 ---- // Skip blank chars do s++; while (isspace(*s)); /* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */ /* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */ ! i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " ! UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT ! " %lu " ! UINTX_FORMAT UINTX_FORMAT UINTX_FORMAT, &state, /* 3 %c */ &ppid, /* 4 %d */ &pgrp, /* 5 %d */ &session, /* 6 %d */ &nr, /* 7 %d */
*** 1178,1194 **** &cstime, /* 17 %ld */ &prio, /* 18 %ld */ &nice, /* 19 %ld */ &junk, /* 20 %ld */ &it_real, /* 21 %ld */ ! &start, /* 22 %lu */ ! &vsize, /* 23 %lu */ ! &rss, /* 24 %ld */ &rsslim, /* 25 %lu */ ! &scodes, /* 26 %lu */ ! &ecode, /* 27 %lu */ ! &stack_start); /* 28 %lu */ } if (i != 28 - 2) { assert(false, "Bad conversion from /proc/self/stat"); // product mode - assume we are the initial thread, good luck in the --- 1181,1197 ---- &cstime, /* 17 %ld */ &prio, /* 18 %ld */ &nice, /* 19 %ld */ &junk, /* 20 %ld */ &it_real, /* 21 %ld */ ! &start, /* 22 UINTX_FORMAT */ ! &vsize, /* 23 UINTX_FORMAT */ ! &rss, /* 24 UINTX_FORMAT */ &rsslim, /* 25 %lu */ ! &scodes, /* 26 UINTX_FORMAT */ ! &ecode, /* 27 UINTX_FORMAT */ ! &stack_start); /* 28 UINTX_FORMAT */ } if (i != 28 - 2) { assert(false, "Bad conversion from /proc/self/stat"); // product mode - assume we are the initial thread, good luck in the
*** 2022,2032 **** char dli_fname[MAXPATHLEN]; bool ret = dll_address_to_library_name( CAST_FROM_FN_PTR(address, os::jvm_path), dli_fname, sizeof(dli_fname), NULL); assert(ret != 0, "cannot locate libjvm"); ! realpath(dli_fname, buf); if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) { // Support for the gamma launcher. Typical value for buf is // "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so". If "/jre/lib/" appears at // the right place in the string, then assume we are installed in a JDK and --- 2025,2036 ---- char dli_fname[MAXPATHLEN]; bool ret = dll_address_to_library_name( CAST_FROM_FN_PTR(address, os::jvm_path), dli_fname, sizeof(dli_fname), NULL); assert(ret != 0, "cannot locate libjvm"); ! if (realpath(dli_fname, buf) == NULL) ! return; if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) { // Support for the gamma launcher. Typical value for buf is // "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so". If "/jre/lib/" appears at // the right place in the string, then assume we are installed in a JDK and
*** 2046,2056 **** // Check the current module name "libjvm.so" or "libjvm_g.so". p = strrchr(buf, '/'); assert(strstr(p, "/libjvm") == p, "invalid library name"); p = strstr(p, "_g") ? "_g" : ""; ! realpath(java_home_var, buf); sprintf(buf + strlen(buf), "/jre/lib/%s", cpu_arch); if (0 == access(buf, F_OK)) { // Use current module name "libjvm[_g].so" instead of // "libjvm"debug_only("_g")".so" since for fastdebug version // we should have "libjvm.so" but debug_only("_g") adds "_g"! --- 2050,2061 ---- // Check the current module name "libjvm.so" or "libjvm_g.so". p = strrchr(buf, '/'); assert(strstr(p, "/libjvm") == p, "invalid library name"); p = strstr(p, "_g") ? "_g" : ""; ! if (realpath(java_home_var, buf) == NULL) ! return; sprintf(buf + strlen(buf), "/jre/lib/%s", cpu_arch); if (0 == access(buf, F_OK)) { // Use current module name "libjvm[_g].so" instead of // "libjvm"debug_only("_g")".so" since for fastdebug version // we should have "libjvm.so" but debug_only("_g") adds "_g"!
*** 2057,2067 **** // It is used when we are choosing the HPI library's name // "libhpi[_g].so" in hpi::initialize_get_interface(). sprintf(buf + strlen(buf), "/hotspot/libjvm%s.so", p); } else { // Go back to path of .so ! realpath(dli_fname, buf); } } } } --- 2062,2073 ---- // It is used when we are choosing the HPI library's name // "libhpi[_g].so" in hpi::initialize_get_interface(). sprintf(buf + strlen(buf), "/hotspot/libjvm%s.so", p); } else { // Go back to path of .so ! if (realpath(dli_fname, buf) == NULL) ! return; } } } }
*** 4182,4196 **** if (s == NULL ) return -1; // Skip blank chars do s++; while (isspace(*s)); ! count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu", ! &idummy, &idummy, &idummy, &idummy, &idummy, &idummy, &ldummy, &ldummy, &ldummy, &ldummy, &ldummy, &user_time, &sys_time); ! if ( count != 13 ) return -1; if (user_sys_cpu_time) { return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec); } else { return (jlong)user_time * (1000000000 / clock_tics_per_sec); } --- 4188,4202 ---- if (s == NULL ) return -1; // Skip blank chars do s++; while (isspace(*s)); ! count = sscanf(s,"%*c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu", ! &idummy, &idummy, &idummy, &idummy, &idummy, &ldummy, &ldummy, &ldummy, &ldummy, &ldummy, &user_time, &sys_time); ! if ( count != 12 ) return -1; if (user_sys_cpu_time) { return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec); } else { return (jlong)user_time * (1000000000 / clock_tics_per_sec); }