[Bug 271675] cp: Interrupted system call
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 271675] cp: Interrupted system call"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Apr 2024 17:33:30 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271675 --- Comment #9 from Ivan Rozhuk <rozhuk.im@gmail.com> --- I suspect that more correct is ignore EINTR error limited times and only then fallback to generic copy. So IMHO usage pattern must be one of: size_t ntry; const size_t max_ntry = 5; for (ntry = 0; ntry < max_ntry;) { int ret = copy_file_range(...); if (0 < ret) { ntry = 0; continue; } if (0 == ret) break; /* Err handle. */ if (EINTR != errno) break; ntry ++; /* Probably nanosleep() here. */ } if (ntry == max_ntry) { /* Fail, do fallback code. */ } Or int ret; for (;;) { ret = copy_file_range(...); if (0 == ret || /* Ok, EOF. */ (0 > ret && EINTR != errno)) /* Unhandled error. */ break; } if (0 != ret) { /* Fail, do fallback code. */ } -- You are receiving this mail because: You are the assignee for the bug.