--- old/src/hotspot/os/bsd/os_bsd.inline.hpp 2018-10-03 10:36:06.000000000 -0500 +++ new/src/hotspot/os/bsd/os_bsd.inline.hpp 2018-10-03 10:36:06.000000000 -0500 @@ -34,11 +34,44 @@ #include #include -// File names are case-insensitive on windows only +#ifdef __APPLE__ + +#include +#include +#include + +// File names could be case-insensitive on Mac OS X, +// depending on the filesystem's capabilities +static bool is_filesystem_case_insensitive(const char* path) { + if (path[0] != '/') { + // The path is relative, so use the current working directory + char cwd[PATH_MAX]; + os::get_current_directory(cwd, PATH_MAX); + return (pathconf(cwd, _PC_CASE_SENSITIVE) != 1); + } else { + // The path is absolute, so use it + return (pathconf(path, _PC_CASE_SENSITIVE) != 1); + } +} + +inline int os::file_name_strncmp(const char* s1, const char* s2, size_t num) { + int result = strncmp(s1, s2, num); + if ((result != 0) && (strlen(s1) == strlen(s2))) { + if (is_filesystem_case_insensitive(s1)) { + result = strncasecmp(s1, s2, num); + } + } + return result; +} + +#else + inline int os::file_name_strncmp(const char* s1, const char* s2, size_t num) { return strncmp(s1, s2, num); } +#endif // __APPLE__ + inline bool os::obsolete_option(const JavaVMOption *option) { return false; }