50 lines
2.2 KiB
Diff
50 lines
2.2 KiB
Diff
From 06fb55216b96c8c9341265dbc4d441cbabd0a66d Mon Sep 17 00:00:00 2001
|
|
Date: Fri, 31 Jul 2020 15:50:08 +0800
|
|
Subject: [PATCH] 8240360:NativeLibraryEvent has wrong library name on Linux
|
|
|
|
Summary: <jtreg>: <NativeLibraryEvent has wrong library name on Linux>
|
|
LLT: jdk11u/test/jdk/jdk/jfr/event/runtime/TestNativeLibrariesEvent.java
|
|
Bug url: https://bugs.openjdk.java.net/browse/JDK-8240360
|
|
---
|
|
src/hotspot/os/linux/os_linux.cpp | 20 +++++++++-----------
|
|
1 file changed, 9 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
|
|
index 6ee57c1..a101d26 100644
|
|
--- a/src/hotspot/os/linux/os_linux.cpp
|
|
+++ b/src/hotspot/os/linux/os_linux.cpp
|
|
@@ -2045,20 +2045,18 @@ int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *pa
|
|
|
|
// Read line by line from 'file'
|
|
while (fgets(line, sizeof(line), procmapsFile) != NULL) {
|
|
- u8 base, top, offset, inode;
|
|
- char permissions[5];
|
|
- char device[6];
|
|
+ u8 base, top, inode;
|
|
char name[sizeof(line)];
|
|
|
|
- // Parse fields from line
|
|
- int matches = sscanf(line, UINT64_FORMAT_X "-" UINT64_FORMAT_X " %4s " UINT64_FORMAT_X " %5s " INT64_FORMAT " %s",
|
|
- &base, &top, permissions, &offset, device, &inode, name);
|
|
- // the last entry 'name' is empty for some entries, so we might have 6 matches instead of 7 for some lines
|
|
- if (matches < 6) continue;
|
|
- if (matches == 6) name[0] = '\0';
|
|
+ // Parse fields from line, discard perms, offset and device
|
|
+ int matches = sscanf(line, UINT64_FORMAT_X "-" UINT64_FORMAT_X " %*s %*s %*s " INT64_FORMAT " %s",
|
|
+ &base, &top, &inode, name);
|
|
+ // the last entry 'name' is empty for some entries, so we might have 3 matches instead of 4 for some lines
|
|
+ if (matches < 3) continue;
|
|
+ if (matches == 3) name[0] = '\0';
|
|
|
|
- // Filter by device id '00:00' so that we only get file system mapped files.
|
|
- if (strcmp(device, "00:00") != 0) {
|
|
+ // Filter by inode 0 so that we only get file system mapped files.
|
|
+ if (inode != 0) {
|
|
|
|
// Call callback with the fields of interest
|
|
if(callback(name, (address)base, (address)top, param)) {
|
|
--
|
|
1.8.3.1
|
|
|
|
|