Skip to content

Commit

Permalink
Revert "FIX(jfr): JFR build failed for JDK-8202353"
Browse files Browse the repository at this point in the history
This reverts commit 86196db.
  • Loading branch information
bobpengxie authored and linzang committed Nov 6, 2020
1 parent 027ccfa commit 7ecf8f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion hotspot/src/os/linux/vm/os_perf_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,20 +912,24 @@ int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProc
}

int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() {
char* dbuf = NULL;
if (!is_valid()) {
return OS_ERR;
}
dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(NULL), mtInternal);

do {
_entry = os::readdir(_dir);
_entry = os::readdir(_dir, (struct dirent *)dbuf);
if (_entry == NULL) {
// Error or reached end. Could use errno to distinguish those cases.
_valid = false;
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
return OS_ERR;
}
} while(!is_valid_entry(_entry));

_valid = true;
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
return OS_OK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,16 @@ RepositoryIterator::RepositoryIterator(const char* repository, size_t repository
if (true) tty->print_cr("Unable to open repository %s", _repo);
return;
}
char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(NULL), mtInternal);
struct dirent* dentry;
while ((dentry = os::readdir(dirp)) != NULL) {
while ((dentry = os::readdir(dirp, (dirent *)dbuf)) != NULL) {
const char* const entry_path = filter(dentry->d_name);
if (NULL != entry_path) {
_files->append(entry_path);
}
}
os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
if (_files->length() > 1) {
_files->sort(file_sort);
}
Expand Down

0 comments on commit 7ecf8f7

Please sign in to comment.