Fetch the repository succeeded.
This action will force synchronization from src-openEuler/openjdk-17, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
From bc5f9fe895849d80d69ef273703e17d2e3ffc968 Mon Sep 17 00:00:00 2001
Subject: Fix JBooster file issue caused by os::write change
---
.../share/jbooster/net/serializationWrappers.cpp | 15 +++++++++------
.../share/jbooster/net/serializationWrappers.hpp | 2 +-
test/hotspot/gtest/jbooster/test_net.cpp | 6 +-----
test/hotspot/gtest/jbooster/test_util.cpp | 4 ++--
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/hotspot/share/jbooster/net/serializationWrappers.cpp b/src/hotspot/share/jbooster/net/serializationWrappers.cpp
index 13db948f6..58310e976 100644
--- a/src/hotspot/share/jbooster/net/serializationWrappers.cpp
+++ b/src/hotspot/share/jbooster/net/serializationWrappers.cpp
@@ -385,12 +385,15 @@ int FileWrapper::deserialize(MessageBuffer& buf) {
JB_RETURN(buf.deserialize_ref_no_meta(size_to_recv));
// content (use low-level APIs to save a memcpy)
- uint32_t left = size_to_recv;
- do {
- uint32_t write_size = (uint32_t) os::write(_fd, buf.cur_buf_ptr(), left);
- buf.skip_cur_offset(write_size);
- left -= write_size;
- } while (left > 0);
+ if (!os::write(_fd, buf.cur_buf_ptr(), size_to_recv)) {
+ int e = errno;
+ errno = 0;
+ guarantee(e != 0, "sanity");
+ log_warning(jbooster, serialization)("Fail to write file \"%s\": errno=%s(\"%s\") .",
+ _file_path, os::errno_name(e), os::strerror(e));
+ JB_RETURN(e);
+ }
+ buf.skip_cur_offset(size_to_recv);
// update status
_handled_file_size += size_to_recv;
diff --git a/src/hotspot/share/jbooster/net/serializationWrappers.hpp b/src/hotspot/share/jbooster/net/serializationWrappers.hpp
index cc7f96c15..02816fcc5 100644
--- a/src/hotspot/share/jbooster/net/serializationWrappers.hpp
+++ b/src/hotspot/share/jbooster/net/serializationWrappers.hpp
@@ -253,7 +253,7 @@ public:
bool is_null() const { return _file_size == MessageConst::NULL_PTR; }
bool is_file_all_handled() const {
- assert(_file_size >= _handled_file_size, "sanity");
+ guarantee(_file_size >= _handled_file_size, "sanity");
return _handled_once && _file_size == _handled_file_size;
}
diff --git a/test/hotspot/gtest/jbooster/test_net.cpp b/test/hotspot/gtest/jbooster/test_net.cpp
index a2c45be5e..9eb29fc3a 100644
--- a/test/hotspot/gtest/jbooster/test_net.cpp
+++ b/test/hotspot/gtest/jbooster/test_net.cpp
@@ -348,11 +348,7 @@ static void create_test_file_for_file_wrapper(const char* file_name) {
int fd = os::open(file_name, O_BINARY | O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, 0666);
ASSERT_TRUE(fd >= 0);
ASSERT_EQ(errno, 0);
- uint32_t left = mem_size;
- do {
- uint32_t write_size = (uint32_t) os::write(fd, mem + mem_size - left, left);
- left -= write_size;
- } while (left > 0);
+ ASSERT_TRUE(os::write(fd, mem, mem_size));
os::close(fd);
FREE_C_HEAP_ARRAY(char, mem);
}
diff --git a/test/hotspot/gtest/jbooster/test_util.cpp b/test/hotspot/gtest/jbooster/test_util.cpp
index ab7fd9b39..cd65804be 100644
--- a/test/hotspot/gtest/jbooster/test_util.cpp
+++ b/test/hotspot/gtest/jbooster/test_util.cpp
@@ -46,8 +46,8 @@ static const char* get_type_name(T t) {
}
static void write_file(const char* file_path, const char* content) {
- int fd = os::open(file_path, O_BINARY | O_WRONLY | O_CREAT, 0666);;
- os::write(fd, content, strlen(content) + 1);
+ int fd = os::open(file_path, O_BINARY | O_WRONLY | O_CREAT, 0666);
+ ASSERT_TRUE(os::write(fd, content, strlen(content) + 1));
os::close(fd);
}
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。