diff options
author | blu <none@none> | 2006-05-23 09:24:17 -0700 |
---|---|---|
committer | blu <none@none> | 2006-05-23 09:24:17 -0700 |
commit | 9760e1c48d45ca95f530c947bf07c62061b86c18 (patch) | |
tree | 9cfc6a0f7b9615671aee4c02bb4a86bf7bef6679 /usr/src/lib/libsendfile/common | |
parent | fd93bfc32e86a61b0e7f02057aac2979479364e3 (diff) | |
download | illumos-joyent-9760e1c48d45ca95f530c947bf07c62061b86c18.tar.gz |
6381275 rcp hanging when sendfile() gets EINTR
6408517 sendfile should only return EINTR if no bytes have been transferred.
Diffstat (limited to 'usr/src/lib/libsendfile/common')
-rw-r--r-- | usr/src/lib/libsendfile/common/sendfile.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/usr/src/lib/libsendfile/common/sendfile.c b/usr/src/lib/libsendfile/common/sendfile.c index b7ed7fdca5..f4f7724843 100644 --- a/usr/src/lib/libsendfile/common/sendfile.c +++ b/usr/src/lib/libsendfile/common/sendfile.c @@ -1,10 +1,10 @@ + /* * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +20,7 @@ * CDDL HEADER END */ /* - * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,8 +49,13 @@ _sendfilev(int sock, const struct sendfilevec *vec, int sfvcnt, size_t *xferred) error = __systemcall(&rval, SYS_sendfilev, SENDFILEV, sock, vec, sfvcnt, xferred); - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && *xferred != 0) { + rval.sys_rval1 = *xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } @@ -69,8 +74,13 @@ _sendfile(int sock, int fd, off_t *off, size_t len) error = __systemcall(&rval, SYS_sendfilev, SENDFILEV, sock, &sfv, 1, &xferred); *off += xferred; - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && xferred != 0) { + rval.sys_rval1 = xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } @@ -88,8 +98,13 @@ _sendfilev64(int sock, const struct sendfilevec64 *vec, int sfvcnt, error = __systemcall(&rval, SYS_sendfilev, SENDFILEV64, sock, vec, sfvcnt, xferred); - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && *xferred != 0) { + rval.sys_rval1 = *xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } @@ -108,8 +123,13 @@ _sendfile64(int sock, int fd, off64_t *off, size_t len) error = __systemcall(&rval, SYS_sendfilev, SENDFILEV64, sock, &sfv, 1, &xferred); *off += xferred; - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && xferred != 0) { + rval.sys_rval1 = xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } #endif |