RFR: 8303942: os::write should write completely [v2]

Afshin Zafari duke at openjdk.org
Fri May 5 08:59:44 UTC 2023


On Wed, 3 May 2023 15:13:16 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Can you update os.hpp to indicate that the buffer will be fully written?
> 
> I would also request that the input size to be changed to size_t, to be consistent with the C library. There are too many dubious casting of size_t to int in the code.

Comment is added including the possible return values of 0 and -1. Parameter type is changed to `size_t` and all invocations changed.

> For failures, I think returning the number of partially written bytes is not useful. The failure would be caused by an unrecoverable error, so you can't try to write the remaining bytes again (or else we are back to the original loop!). For simplicity, this function can simply return -1 to indicate failure, and 0 to indicate success.

The return values are changed as suggested. All the calls to `os::write` are changed accordingly.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13750#issuecomment-1535938739


More information about the hotspot-dev mailing list