5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License (the "License").
7 * You may not use this file except in compliance with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * sendfilev is the native interface : 32 bit app on 32 bit kernel
31 * and 64 bit app on 64 bit kernel. sendfilev64() is used by
32 * 32 bit apps on a 64 bit kernel or 32 bit kernel for large
33 * file offsets. Similar things apply to sendfile.
36 #pragma weak sendfilev = _sendfilev
37 #pragma weak sendfile = _sendfile
39 #include <sys/types.h>
40 #include <sys/syscall.h>
41 #include <sys/sendfile.h>
45 _sendfilev(int sock
, const struct sendfilevec
*vec
, int sfvcnt
, size_t *xferred
)
50 error
= __systemcall(&rval
, SYS_sendfilev
, SENDFILEV
, sock
, vec
,
53 if (error
== EINTR
&& *xferred
!= 0) {
54 rval
.sys_rval1
= *xferred
;
56 (void) __set_errno(error
);
59 return ((ssize_t
)rval
.sys_rval1
);
63 _sendfile(int sock
, int fd
, off_t
*off
, size_t len
)
67 struct sendfilevec sfv
;
74 error
= __systemcall(&rval
, SYS_sendfilev
, SENDFILEV
, sock
, &sfv
,
78 if (error
== EINTR
&& xferred
!= 0) {
79 rval
.sys_rval1
= xferred
;
81 (void) __set_errno(error
);
84 return ((ssize_t
)rval
.sys_rval1
);
89 #pragma weak sendfilev64 = _sendfilev64
90 #pragma weak sendfile64 = _sendfile64
93 _sendfilev64(int sock
, const struct sendfilevec64
*vec
, int sfvcnt
,
99 error
= __systemcall(&rval
, SYS_sendfilev
, SENDFILEV64
, sock
, vec
,
102 if (error
== EINTR
&& *xferred
!= 0) {
103 rval
.sys_rval1
= *xferred
;
105 (void) __set_errno(error
);
108 return ((ssize_t
)rval
.sys_rval1
);
112 _sendfile64(int sock
, int fd
, off64_t
*off
, size_t len
)
116 struct sendfilevec64 sfv
;
123 error
= __systemcall(&rval
, SYS_sendfilev
, SENDFILEV64
, sock
, &sfv
,
127 if (error
== EINTR
&& xferred
!= 0) {
128 rval
.sys_rval1
= xferred
;
130 (void) __set_errno(error
);
133 return ((ssize_t
)rval
.sys_rval1
);