mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 10:38:06 +00:00
Currently the code contains multiple places where callers expect the errno to be valid (implied by calling pr_perror to log file IO errors) after calling open_img_file(), read_fp() and write_fp() helpers. Problem there is that those helpers can destroy the errno courtesy of themselves emitting log messages via fprintf. Furthermore, the callers then sometimes invent the errors to return back to the caller, or even outside of the plugin. On top of that there is no benefit to buffered file IO given the plugin reads and writes in buffer object size chunks, so it it preferrable to just go direct and avoid any possibility of extra copying to and from libc temporary buffers. So lets just convert it all in one swoop to POSIX IO and make sure correct errnos are always propagated to the caller (including to CRIU core). Hopefully this removes all instances of incorrect pr_perror log messages. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-By: David Francis <David.Francis@amd.com> # v1 --- v2: * Handle short reads and writes. * Add O_TRUNC. v3: * Handle EINTR and EAGAIN. * Set errno on len == 0. * Use %zu for size_t printing. v4: * Drop shadowed ret. * Drop needless casts. |
||
|---|---|---|
| .. | ||
| amdgpu | ||
| cuda | ||