src/hotspot/os/posix/os_posix.cpp
changeset 55524 b279ae9843b8
parent 54195 4b6a629d0615
child 57738 807d192fb7dd
--- a/src/hotspot/os/posix/os_posix.cpp	Fri Jun 28 18:01:36 2019 +0200
+++ b/src/hotspot/os/posix/os_posix.cpp	Fri Jun 28 09:49:10 2019 -0700
@@ -1450,6 +1450,30 @@
   return path;
 }
 
+bool os::same_files(const char* file1, const char* file2) {
+  if (strcmp(file1, file2) == 0) {
+    return true;
+  }
+
+  bool is_same = false;
+  struct stat st1;
+  struct stat st2;
+
+  if (os::stat(file1, &st1) < 0) {
+    return false;
+  }
+
+  if (os::stat(file2, &st2) < 0) {
+    return false;
+  }
+
+  if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) {
+    // same files
+    is_same = true;
+  }
+  return is_same;
+}
+
 // Check minimum allowable stack sizes for thread creation and to initialize
 // the java system classes, including StackOverflowError - depends on page
 // size.