提交 4bcfb77b 编写于 作者: 云矅

[Misc] Build fails after rebasing 8u232, fix it by porting 8202353 from upstream

Summary:
Port 8202353 from lastest jdk, in order to fix compatibility of 8u232 api change instead of the origin openjdk8 patch
Buglist ref: https://bugs.openjdk.java.net/browse/JDK-8202353
Fix ref: http://hg.openjdk.java.net/jdk/jdk/rev/f605c91e5219

Test Plan:
Successfully build Dragonwell8, and pass jfr tests.

Reviewed-by: D-D-H,luchsh,sanhong

Issue: https://github.com/alibaba/dragonwell8/issues/73
上级 7a01e5e2
......@@ -904,21 +904,14 @@ int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProc
}
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;
}
......@@ -935,11 +928,8 @@ SystemProcessInterface::SystemProcesses::ProcessIterator::ProcessIterator() {
}
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();
......@@ -947,11 +937,8 @@ bool SystemProcessInterface::SystemProcesses::ProcessIterator::initialize() {
}
SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() {
if (_entry != NULL) {
FREE_C_HEAP_ARRAY(char, _entry, mtInternal);
}
if (_dir != NULL) {
closedir(_dir);
os::closedir(_dir);
}
}
......
......@@ -241,11 +241,7 @@ RepositoryIterator::RepositoryIterator(const char* repository, size_t repository
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册