--- old/src/hotspot/os/aix/os_aix.cpp 2018-07-10 15:42:48.509899732 -0400 +++ new/src/hotspot/os/aix/os_aix.cpp 2018-07-10 15:42:48.321889375 -0400 @@ -3731,8 +3731,7 @@ /* Scan the directory */ bool result = true; - char buf[sizeof(struct dirent) + MAX_PATH]; - while (result && (ptr = ::readdir(dir)) != NULL) { + while (result && (ptr = readdir(dir)) != NULL) { if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) { result = false; } --- old/src/hotspot/os/aix/os_aix.inline.hpp 2018-07-10 15:42:49.285942479 -0400 +++ new/src/hotspot/os/aix/os_aix.inline.hpp 2018-07-10 15:42:49.101932343 -0400 @@ -74,17 +74,6 @@ inline const int os::default_file_open_flags() { return 0;} -inline DIR* os::opendir(const char* dirname) { - assert(dirname != NULL, "just checking"); - return ::opendir(dirname); -} - -inline int os::readdir_buf_size(const char *path) { - // According to aix sys/limits, NAME_MAX must be retrieved at runtime. - const long my_NAME_MAX = pathconf(path, _PC_NAME_MAX); - return my_NAME_MAX + sizeof(dirent) + 1; -} - inline jlong os::lseek(int fd, jlong offset, int whence) { return (jlong) ::lseek64(fd, offset, whence); } @@ -97,23 +86,6 @@ return ::ftruncate64(fd, length); } -inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) { - dirent* p = NULL; - assert(dirp != NULL, "just checking"); - - // AIX: slightly different from POSIX. - // On AIX, readdir_r returns 0 or != 0 and error details in errno. - if (::readdir_r(dirp, dbuf, &p) != 0) { - return NULL; - } - return p; -} - -inline int os::closedir(DIR *dirp) { - assert(dirp != NULL, "argument is NULL"); - return ::closedir(dirp); -} - // macros for restartable system calls #define RESTARTABLE(_cmd, _result) do { \ --- old/src/hotspot/os/aix/os_perf_aix.cpp 2018-07-10 15:42:50.093986989 -0400 +++ new/src/hotspot/os/aix/os_perf_aix.cpp 2018-07-10 15:42:49.873974870 -0400 @@ -893,21 +893,14 @@ } int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() { - struct dirent* entry; - if (!is_valid()) { return OS_ERR; } do { - entry = os::readdir(_dir, _entry); - if (entry == NULL) { - // error - _valid = false; - return OS_ERR; - } + _entry = os::readdir(_dir); if (_entry == NULL) { - // reached end + // Error or reached end. Could use errno to distinguish those cases. _valid = false; return OS_ERR; } @@ -929,11 +922,8 @@ } SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() { - if (_entry != NULL) { - FREE_C_HEAP_ARRAY(char, _entry); - } if (_dir != NULL) { - closedir(_dir); + os::closedir(_dir); } } --- old/src/hotspot/os/aix/perfMemory_aix.cpp 2018-07-10 15:42:50.930033041 -0400 +++ new/src/hotspot/os/aix/perfMemory_aix.cpp 2018-07-10 15:42:50.706020701 -0400 @@ -617,9 +617,8 @@ // to determine the user name for the process id. // struct dirent* dentry; - char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal); errno = 0; - while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) { + while ((dentry = os::readdir(tmpdirp)) != NULL) { // check if the directory entry is a hsperfdata file if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) { @@ -653,9 +652,8 @@ } struct dirent* udentry; - char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal); errno = 0; - while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) { + while ((udentry = os::readdir(subdirp)) != NULL) { if (filename_to_pid(udentry->d_name) == vmid) { struct stat statbuf; @@ -699,11 +697,9 @@ } } os::closedir(subdirp); - FREE_C_HEAP_ARRAY(char, udbuf); FREE_C_HEAP_ARRAY(char, usrdir_name); } os::closedir(tmpdirp); - FREE_C_HEAP_ARRAY(char, tdbuf); return(oldest_user); } @@ -779,10 +775,8 @@ // loop under these conditions is dependent upon the implementation of // opendir/readdir. struct dirent* entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal); - errno = 0; - while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) { + while ((entry = os::readdir(dirp)) != NULL) { pid_t pid = filename_to_pid(entry->d_name); @@ -820,8 +814,6 @@ // Close the directory and reset the current working directory. close_directory_secure_cwd(dirp, saved_cwd_fd); - - FREE_C_HEAP_ARRAY(char, dbuf); } // Make the user specific temporary directory. Returns true if --- old/src/hotspot/os/bsd/os_bsd.cpp 2018-07-10 15:42:51.774079533 -0400 +++ new/src/hotspot/os/bsd/os_bsd.cpp 2018-07-10 15:42:51.554067414 -0400 @@ -3504,8 +3504,7 @@ // Scan the directory bool result = true; - char buf[sizeof(struct dirent) + MAX_PATH]; - while (result && (ptr = ::readdir(dir)) != NULL) { + while (result && (ptr = readdir(dir)) != NULL) { if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) { result = false; } --- old/src/hotspot/os/bsd/os_bsd.inline.hpp 2018-07-10 15:42:52.630126686 -0400 +++ new/src/hotspot/os/bsd/os_bsd.inline.hpp 2018-07-10 15:42:52.414114788 -0400 @@ -77,17 +77,6 @@ inline const int os::default_file_open_flags() { return 0;} -inline DIR* os::opendir(const char* dirname) -{ - assert(dirname != NULL, "just checking"); - return ::opendir(dirname); -} - -inline int os::readdir_buf_size(const char *path) -{ - return NAME_MAX + sizeof(dirent) + 1; -} - inline jlong os::lseek(int fd, jlong offset, int whence) { return (jlong) ::lseek(fd, offset, whence); } @@ -100,28 +89,6 @@ return ::ftruncate(fd, length); } -inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) -{ - dirent* p; - int status; - assert(dirp != NULL, "just checking"); - - // NOTE: Bsd readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX - // version. Here is the doc for this function: - // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html - - if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { - errno = status; - return NULL; - } else - return p; -} - -inline int os::closedir(DIR *dirp) { - assert(dirp != NULL, "argument is NULL"); - return ::closedir(dirp); -} - // macros for restartable system calls #define RESTARTABLE(_cmd, _result) do { \ --- old/src/hotspot/os/bsd/perfMemory_bsd.cpp 2018-07-10 15:42:53.446171636 -0400 +++ new/src/hotspot/os/bsd/perfMemory_bsd.cpp 2018-07-10 15:42:53.230159737 -0400 @@ -535,9 +535,8 @@ // to determine the user name for the process id. // struct dirent* dentry; - char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal); errno = 0; - while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) { + while ((dentry = os::readdir(tmpdirp)) != NULL) { // check if the directory entry is a hsperfdata file if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) { @@ -559,9 +558,8 @@ } struct dirent* udentry; - char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal); errno = 0; - while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) { + while ((udentry = os::readdir(subdirp)) != NULL) { if (filename_to_pid(udentry->d_name) == vmid) { struct stat statbuf; @@ -605,11 +603,9 @@ } } os::closedir(subdirp); - FREE_C_HEAP_ARRAY(char, udbuf); FREE_C_HEAP_ARRAY(char, usrdir_name); } os::closedir(tmpdirp); - FREE_C_HEAP_ARRAY(char, tdbuf); return(oldest_user); } @@ -688,10 +684,8 @@ // opendir/readdir. // struct dirent* entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal); - errno = 0; - while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) { + while ((entry = os::readdir(dirp)) != NULL) { pid_t pid = filename_to_pid(entry->d_name); @@ -730,8 +724,6 @@ // close the directory and reset the current working directory close_directory_secure_cwd(dirp, saved_cwd_fd); - - FREE_C_HEAP_ARRAY(char, dbuf); } // make the user specific temporary directory. Returns true if --- old/src/hotspot/os/linux/os_linux.cpp 2018-07-10 15:42:54.282217687 -0400 +++ new/src/hotspot/os/linux/os_linux.cpp 2018-07-10 15:42:54.066205789 -0400 @@ -5371,8 +5371,7 @@ // Scan the directory bool result = true; - char buf[sizeof(struct dirent) + MAX_PATH]; - while (result && (ptr = ::readdir(dir)) != NULL) { + while (result && (ptr = readdir(dir)) != NULL) { if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) { result = false; } --- old/src/hotspot/os/linux/os_linux.inline.hpp 2018-07-10 15:42:55.166266382 -0400 +++ new/src/hotspot/os/linux/os_linux.inline.hpp 2018-07-10 15:42:54.946254263 -0400 @@ -69,17 +69,6 @@ inline const int os::default_file_open_flags() { return 0;} -inline DIR* os::opendir(const char* dirname) -{ - assert(dirname != NULL, "just checking"); - return ::opendir(dirname); -} - -inline int os::readdir_buf_size(const char *path) -{ - return NAME_MAX + sizeof(dirent) + 1; -} - inline jlong os::lseek(int fd, jlong offset, int whence) { return (jlong) ::lseek64(fd, offset, whence); } @@ -92,17 +81,6 @@ return ::ftruncate64(fd, length); } -inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) -{ - assert(dirp != NULL, "just checking"); - return ::readdir(dirp); -} - -inline int os::closedir(DIR *dirp) { - assert(dirp != NULL, "argument is NULL"); - return ::closedir(dirp); -} - // macros for restartable system calls #define RESTARTABLE(_cmd, _result) do { \ --- old/src/hotspot/os/linux/os_perf_linux.cpp 2018-07-10 15:42:55.986311551 -0400 +++ new/src/hotspot/os/linux/os_perf_linux.cpp 2018-07-10 15:42:55.766299432 -0400 @@ -895,21 +895,14 @@ } int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() { - struct dirent* entry; - if (!is_valid()) { return OS_ERR; } do { - entry = os::readdir(_dir, _entry); - if (entry == NULL) { - // error - _valid = false; - return OS_ERR; - } + _entry = os::readdir(_dir); if (_entry == NULL) { - // reached end + // Error or reached end. Could use errno to distinguish those cases. _valid = false; return OS_ERR; } @@ -926,11 +919,8 @@ } bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() { - _dir = opendir("/proc"); - _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, sizeof(struct dirent) + NAME_MAX + 1, mtInternal); - if (NULL == _entry) { - return false; - } + _dir = os::opendir("/proc"); + _entry = NULL; _valid = true; next_process(); @@ -938,11 +928,8 @@ } SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() { - if (_entry != NULL) { - FREE_C_HEAP_ARRAY(char, _entry); - } if (_dir != NULL) { - closedir(_dir); + os::closedir(_dir); } } --- old/src/hotspot/os/linux/perfMemory_linux.cpp 2018-07-10 15:42:56.810356940 -0400 +++ new/src/hotspot/os/linux/perfMemory_linux.cpp 2018-07-10 15:42:56.590344822 -0400 @@ -562,9 +562,8 @@ // to determine the user name for the process id. // struct dirent* dentry; - char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal); errno = 0; - while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) { + while ((dentry = os::readdir(tmpdirp)) != NULL) { // check if the directory entry is a hsperfdata file if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) { @@ -598,9 +597,8 @@ } struct dirent* udentry; - char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal); errno = 0; - while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) { + while ((udentry = os::readdir(subdirp)) != NULL) { if (filename_to_pid(udentry->d_name) == searchpid) { struct stat statbuf; @@ -644,11 +642,9 @@ } } os::closedir(subdirp); - FREE_C_HEAP_ARRAY(char, udbuf); FREE_C_HEAP_ARRAY(char, usrdir_name); } os::closedir(tmpdirp); - FREE_C_HEAP_ARRAY(char, tdbuf); return(oldest_user); } @@ -770,10 +766,8 @@ // opendir/readdir. // struct dirent* entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal); - errno = 0; - while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) { + while ((entry = os::readdir(dirp)) != NULL) { pid_t pid = filename_to_pid(entry->d_name); @@ -810,8 +804,6 @@ // close the directory and reset the current working directory close_directory_secure_cwd(dirp, saved_cwd_fd); - - FREE_C_HEAP_ARRAY(char, dbuf); } // make the user specific temporary directory. Returns true if --- old/src/hotspot/os/posix/os_posix.cpp 2018-07-10 15:42:57.642402770 -0400 +++ new/src/hotspot/os/posix/os_posix.cpp 2018-07-10 15:42:57.426390872 -0400 @@ -35,6 +35,7 @@ #include "utilities/macros.hpp" #include "utilities/vmError.hpp" +#include #include #include #include @@ -527,6 +528,21 @@ ::funlockfile(fp); } +DIR* os::opendir(const char* dirname) { + assert(dirname != NULL, "just checking"); + return ::opendir(dirname); +} + +struct dirent* os::readdir(DIR* dirp) { + assert(dirp != NULL, "just checking"); + return ::readdir(dirp); +} + +int os::closedir(DIR *dirp) { + assert(dirp != NULL, "just checking"); + return ::closedir(dirp); +} + // Builds a platform dependent Agent_OnLoad_ function name // which is used to find statically linked in agents. // Parameters: --- old/src/hotspot/os/solaris/os_perf_solaris.cpp 2018-07-10 15:42:58.494449701 -0400 +++ new/src/hotspot/os/solaris/os_perf_solaris.cpp 2018-07-10 15:42:58.274437582 -0400 @@ -604,15 +604,14 @@ } int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() { - struct dirent* entry; - if (!is_valid()) { return OS_ERR; } do { - if ((entry = os::readdir(_dir, _entry)) == NULL) { - // error + _entry = os::readdir(_dir); + if (_entry == NULL) { + // Error or reached end. Could use errno to distinguish those cases. _valid = false; return OS_ERR; } @@ -629,11 +628,8 @@ } bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() { - _dir = opendir("/proc"); - _entry = (struct dirent*)NEW_C_HEAP_ARRAY(char, sizeof(struct dirent) + _PC_NAME_MAX + 1, mtInternal); - if (NULL == _entry) { - return false; - } + _dir = os::opendir("/proc"); + _entry = NULL; _valid = true; next_process(); @@ -641,12 +637,8 @@ } SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() { - if (_entry != NULL) { - FREE_C_HEAP_ARRAY(char, _entry); - } - if (_dir != NULL) { - closedir(_dir); + os::closedir(_dir); } } --- old/src/hotspot/os/solaris/os_solaris.cpp 2018-07-10 15:42:59.322495310 -0400 +++ new/src/hotspot/os/solaris/os_solaris.cpp 2018-07-10 15:42:59.102483191 -0400 @@ -4306,9 +4306,7 @@ // Scan the directory bool result = true; - char buf[sizeof(struct dirent) + MAX_PATH]; - struct dirent *dbuf = (struct dirent *) buf; - while (result && (ptr = readdir(dir, dbuf)) != NULL) { + while (result && (ptr = readdir(dir)) != NULL) { if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) { result = false; } --- old/src/hotspot/os/solaris/os_solaris.inline.hpp 2018-07-10 15:43:00.198543562 -0400 +++ new/src/hotspot/os/solaris/os_solaris.inline.hpp 2018-07-10 15:42:59.978531444 -0400 @@ -68,34 +68,6 @@ inline const int os::default_file_open_flags() { return 0;} -inline DIR* os::opendir(const char* dirname) { - assert(dirname != NULL, "just checking"); - return ::opendir(dirname); -} - -inline int os::readdir_buf_size(const char *path) { - int size = pathconf(path, _PC_NAME_MAX); - return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1; -} - -inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) { - assert(dirp != NULL, "just checking"); - dirent* p; - int status; - - if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { - errno = status; - return NULL; - } else { - return p; - } -} - -inline int os::closedir(DIR *dirp) { - assert(dirp != NULL, "argument is NULL"); - return ::closedir(dirp); -} - ////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// --- old/src/hotspot/os/solaris/perfMemory_solaris.cpp 2018-07-10 15:43:01.026589171 -0400 +++ new/src/hotspot/os/solaris/perfMemory_solaris.cpp 2018-07-10 15:43:00.802576832 -0400 @@ -523,9 +523,8 @@ // to determine the user name for the process id. // struct dirent* dentry; - char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal); errno = 0; - while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) { + while ((dentry = os::readdir(tmpdirp)) != NULL) { // check if the directory entry is a hsperfdata file if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) { @@ -559,9 +558,8 @@ } struct dirent* udentry; - char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal); errno = 0; - while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) { + while ((udentry = os::readdir(subdirp)) != NULL) { if (filename_to_pid(udentry->d_name) == vmid) { struct stat statbuf; @@ -605,11 +603,9 @@ } } os::closedir(subdirp); - FREE_C_HEAP_ARRAY(char, udbuf); FREE_C_HEAP_ARRAY(char, usrdir_name); } os::closedir(tmpdirp); - FREE_C_HEAP_ARRAY(char, tdbuf); return(oldest_user); } @@ -736,10 +732,8 @@ // opendir/readdir. // struct dirent* entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal); - errno = 0; - while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) { + while ((entry = os::readdir(dirp)) != NULL) { pid_t pid = filename_to_pid(entry->d_name); @@ -778,8 +772,6 @@ // close the directory and reset the current working directory close_directory_secure_cwd(dirp, saved_cwd_fd); - - FREE_C_HEAP_ARRAY(char, dbuf); } // make the user specific temporary directory. Returns true if --- old/src/hotspot/os/windows/os_windows.cpp 2018-07-10 15:43:01.850634559 -0400 +++ new/src/hotspot/os/windows/os_windows.cpp 2018-07-10 15:43:01.634622661 -0400 @@ -1170,11 +1170,10 @@ return dirp; } -// parameter dbuf unused on Windows -struct dirent * os::readdir(DIR *dirp, dirent *dbuf) { +struct dirent * os::readdir(DIR *dirp) { assert(dirp != NULL, "just checking"); // hotspot change if (dirp->handle == INVALID_HANDLE_VALUE) { - return 0; + return NULL; } strcpy(dirp->dirent.d_name, dirp->find_data.cFileName); @@ -1182,7 +1181,7 @@ if (!FindNextFile(dirp->handle, &dirp->find_data)) { if (GetLastError() == ERROR_INVALID_HANDLE) { errno = EBADF; - return 0; + return NULL; } FindClose(dirp->handle); dirp->handle = INVALID_HANDLE_VALUE; --- old/src/hotspot/os/windows/os_windows.inline.hpp 2018-07-10 15:43:02.718682370 -0400 +++ new/src/hotspot/os/windows/os_windows.inline.hpp 2018-07-10 15:43:02.502670472 -0400 @@ -57,14 +57,6 @@ return true; } -inline int os::readdir_buf_size(const char *path) -{ - /* As Windows doesn't use the directory entry buffer passed to - os::readdir() this can be as short as possible */ - - return 1; -} - // Bang the shadow pages if they need to be touched to be mapped. inline void os::map_stack_shadow_pages(address sp) { // Write to each page of our new frame to force OS mapping. --- old/src/hotspot/os/windows/perfMemory_windows.cpp 2018-07-10 15:43:03.538727537 -0400 +++ new/src/hotspot/os/windows/perfMemory_windows.cpp 2018-07-10 15:43:03.322715639 -0400 @@ -318,9 +318,8 @@ // to determine the user name for the process id. // struct dirent* dentry; - char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal); errno = 0; - while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) { + while ((dentry = os::readdir(tmpdirp)) != NULL) { // check if the directory entry is a hsperfdata file if (strncmp(dentry->d_name, PERFDATA_NAME, strlen(PERFDATA_NAME)) != 0) { @@ -353,9 +352,8 @@ } struct dirent* udentry; - char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal); errno = 0; - while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) { + while ((udentry = os::readdir(subdirp)) != NULL) { if (filename_to_pid(udentry->d_name) == vmid) { struct stat statbuf; @@ -407,11 +405,9 @@ } } os::closedir(subdirp); - FREE_C_HEAP_ARRAY(char, udbuf); FREE_C_HEAP_ARRAY(char, usrdir_name); } os::closedir(tmpdirp); - FREE_C_HEAP_ARRAY(char, tdbuf); return(latest_user); } @@ -642,9 +638,8 @@ // opendir/readdir. // struct dirent* entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal); errno = 0; - while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) { + while ((entry = os::readdir(dirp)) != NULL) { int pid = filename_to_pid(entry->d_name); @@ -685,7 +680,6 @@ errno = 0; } os::closedir(dirp); - FREE_C_HEAP_ARRAY(char, dbuf); } // create a file mapping object with the requested name, and size --- old/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp 2018-07-10 15:43:04.378773805 -0400 +++ new/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp 2018-07-10 15:43:04.158761687 -0400 @@ -241,11 +241,7 @@ return; } struct dirent* dentry; - char* dir_buffer = NEW_RESOURCE_ARRAY_RETURN_NULL(char, os::readdir_buf_size(_repo)); - if (dir_buffer == NULL) { - return; - } - while ((dentry = os::readdir(dirp, (struct dirent*)dir_buffer)) != NULL) { + while ((dentry = os::readdir(dirp)) != NULL) { const char* const entry_path = filter(dentry->d_name); if (NULL != entry_path) { _files->append(entry_path); --- old/src/hotspot/share/runtime/os.hpp 2018-07-10 15:43:05.198818972 -0400 +++ new/src/hotspot/share/runtime/os.hpp 2018-07-10 15:43:04.978806854 -0400 @@ -580,8 +580,7 @@ // Reading directories. static DIR* opendir(const char* dirname); - static int readdir_buf_size(const char *path); - static struct dirent* readdir(DIR* dirp, dirent* dbuf); + static struct dirent* readdir(DIR* dirp); static int closedir(DIR* dirp); // Dynamic library extension --- old/test/jdk/ProblemList.txt 2018-07-10 15:43:06.030864799 -0400 +++ new/test/jdk/ProblemList.txt 2018-07-10 15:43:05.810852681 -0400 @@ -881,4 +881,3 @@ jdk/jfr/event/io/TestInstrumentation.java 8202142 generic-all jdk/jfr/event/sampling/TestNative.java 8202142 generic-all -jdk/jfr/event/os/TestSystemProcess.java 8202835 linux-all