jlong bytes_read = 0;
jlong bytes_written = 0;
while (bytes_read < current_filesize) {
bytes_read += (jlong)os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read);
assert(bytes_read - bytes_written <= (jlong)size_of_file_copy_block, "invariant");
bytes_written += (jlong)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written);
assert(bytes_read == bytes_written, "invariant");
}
read_at() will return -1 on error. It is currently defined to return a size_t, which is unsigned and incorrect - meaning on error bytes_written would appear huge. UnderJDK-8214816 os::read_at is being changed to return the correct ssize_t.
jlong bytes_written = 0;
while (bytes_read < current_filesize) {
bytes_read += (jlong)os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read);
assert(bytes_read - bytes_written <= (jlong)size_of_file_copy_block, "invariant");
bytes_written += (jlong)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written);
assert(bytes_read == bytes_written, "invariant");
}
read_at() will return -1 on error. It is currently defined to return a size_t, which is unsigned and incorrect - meaning on error bytes_written would appear huge. Under
- relates to
-
JDK-8214816 os::read() should not transition to _thread_blocked with safepoint check on Solaris
-
- Resolved
-