Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Apr 2024 17:33:30 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 271675] cp: Interrupted system call
Message-ID:  <bug-271675-227-hSBMTPgqE5@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-271675-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

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.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271675-227-hSBMTPgqE5>