summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/boot/sys/boot/forth/beadm.4th32
-rw-r--r--usr/src/boot/sys/boot/zfs/zfs.c2
-rw-r--r--usr/src/man/man3c/Makefile14
-rw-r--r--usr/src/man/man3c/byteorder.3c86
-rw-r--r--usr/src/man/man3c/endian.3c6
-rw-r--r--usr/src/man/man3head/endian.h.3head5
-rw-r--r--usr/src/man/man3head/inet.h.3head2
-rw-r--r--usr/src/man/man3lib/libsocket.3lib15
-rw-r--r--usr/src/man/man3nsl/gethostbyname.3nsl13
-rw-r--r--usr/src/man/man3socket/Makefile14
-rw-r--r--usr/src/man/man3socket/byteorder.3socket77
-rw-r--r--usr/src/man/man3socket/getaddrinfo.3socket2
-rw-r--r--usr/src/man/man3socket/getipnodebyname.3socket2
-rw-r--r--usr/src/man/man3socket/getservbyname.3socket15
-rw-r--r--usr/src/man/man3socket/rexec.3socket8
-rw-r--r--usr/src/man/man3socket/sockaddr.3socket12
-rw-r--r--usr/src/man/man5/byteorder.524
-rw-r--r--usr/src/man/man7p/inet.7p4
-rw-r--r--usr/src/pkg/manifests/system-library.man3c.inc7
-rw-r--r--usr/src/pkg/manifests/system-library.man3socket.inc7
-rw-r--r--usr/src/uts/common/fs/sockfs/socksyscalls.c53
-rw-r--r--usr/src/uts/common/syscall/sendfile.c16
22 files changed, 208 insertions, 208 deletions
diff --git a/usr/src/boot/sys/boot/forth/beadm.4th b/usr/src/boot/sys/boot/forth/beadm.4th
index 31b1fe5db1..3a31841145 100644
--- a/usr/src/boot/sys/boot/forth/beadm.4th
+++ b/usr/src/boot/sys/boot/forth/beadm.4th
@@ -217,7 +217,8 @@ variable page_remainder
exit
then
drop free-memory \ free type
- 2dup [char] : strchr nip 0= if
+ \ check last char in the name
+ 2dup + c@ [char] : <> if
\ have dataset and need to get zfs:pool/ROOT/be:
dup 5 + allocate if ENOMEM throw then
0 s" zfs:" strcat
@@ -288,10 +289,25 @@ variable page_remainder
argc 2 = if ( activate be )
\ need to set arg list into proper order
1+ >R \ save argc+1 to return stack
- \ if we have : in name, its device, inject
- \ empty be name
- 2dup [char] : strchr nip
- if ( its : in name )
+
+ \ if the prefix is fd, cd, net or disk and we have :
+ \ in the name, it is device and inject empty be name
+ over 2 s" fd" compare 0= >R
+ over 2 s" cd" compare 0= R> or >R
+ over 3 s" net" compare 0= R> or >R
+ over 4 s" disk" compare 0= R> or
+ if ( prefix is fd or cd or net or disk )
+ 2dup [char] : strchr nip
+ if ( its : in name )
+ true
+ else
+ false
+ then
+ else
+ false
+ then
+
+ if ( it is device name )
0 0 R>
else
\ add device, swap with be and receive argc
@@ -439,9 +455,9 @@ builtin: beadm
\ for chain, use the value as is
value_buffer strget
else
- value_buffer strget 2dup
- [char] : strchr nip
- 0= if
+ \ check last char in the name
+ value_buffer strget 2dup + c@
+ [char] : <> if
\ make zfs device name
swap drop
5 + allocate if
diff --git a/usr/src/boot/sys/boot/zfs/zfs.c b/usr/src/boot/sys/boot/zfs/zfs.c
index 493ebd7e57..60da09a441 100644
--- a/usr/src/boot/sys/boot/zfs/zfs.c
+++ b/usr/src/boot/sys/boot/zfs/zfs.c
@@ -666,7 +666,7 @@ zfs_parsedev(struct zfs_devdesc *dev, const char *devspec, const char **path)
if (*np != ':')
return (EINVAL);
np++;
- end = strchr(np, ':');
+ end = strrchr(np, ':');
if (end == NULL)
return (EINVAL);
sep = strchr(np, '/');
diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile
index af8d381e02..295eb6ffa5 100644
--- a/usr/src/man/man3c/Makefile
+++ b/usr/src/man/man3c/Makefile
@@ -59,6 +59,7 @@ MANFILES= __fbufsize.3c \
bsearch.3c \
bstring.3c \
btowc.3c \
+ byteorder.3c \
call_once.3c \
catgets.3c \
catopen.3c \
@@ -888,6 +889,9 @@ MANLINKS= FD_CLR.3c \
htole16.3c \
htole32.3c \
htole64.3c \
+ htonl.3c \
+ htonll.3c \
+ htons.3c \
inet6.3c \
inet_addr.3c \
inet_aton.3c \
@@ -1035,6 +1039,9 @@ MANLINKS= FD_CLR.3c \
ngettext.3c \
nl_langinfo_l.3c \
nrand48.3c \
+ ntohl.3c \
+ ntohll.3c \
+ ntohs.3c \
openlog.3c \
pclose.3c \
port_dissociate.3c \
@@ -1566,6 +1573,13 @@ explicit_bzero.3c := LINKSRC = bstring.3c
btowc_l.3c := LINKSRC = btowc.3c
+htonl.3c := LINKSRC = byteorder.3c
+htonll.3c := LINKSRC = byteorder.3c
+htons.3c := LINKSRC = byteorder.3c
+ntohl.3c := LINKSRC = byteorder.3c
+ntohll.3c := LINKSRC = byteorder.3c
+ntohs.3c := LINKSRC = byteorder.3c
+
canonicalize_file_name.3c := LINKSRC = realpath.3c
catclose.3c := LINKSRC = catopen.3c
diff --git a/usr/src/man/man3c/byteorder.3c b/usr/src/man/man3c/byteorder.3c
new file mode 100644
index 0000000000..16de6b983e
--- /dev/null
+++ b/usr/src/man/man3c/byteorder.3c
@@ -0,0 +1,86 @@
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" 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.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd August 2, 2018
+.Dt BYTEORDER 3C
+.Os
+.Sh NAME
+.Nm byteorder ,
+.Nm htonl ,
+.Nm htonll ,
+.Nm htons ,
+.Nm ntohl ,
+.Nm ntohll ,
+.Nm ntohs
+.Nd convert values between host and network byte order
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.In inttypes.h
+.Ft uint32_t
+.Fo htonl
+.Fa "uint32_t hostlong"
+.Fc
+.Ft uint64_t
+.Fo htonll
+.Fa "uint64_t hostlonglong"
+.Fc
+.Ft uint16_t
+.Fo htons
+.Fa "uint16_t hostshort"
+.Fc
+.Ft uint32_t
+.Fo ntohl
+.Fa "uint32_t netlong"
+.Fc
+.Ft uint64_t
+.Fo ntohll
+.Fa "uint64_t netlonglong"
+.Fc
+.Ft uint16_t
+.Fo ntohs
+.Fa "uint16_t netshort"
+.Fc
+.Sh DESCRIPTION
+These functions convert 16-bit, 32-bit, and 64-bit quantities between network
+byte order and host byte order.
+On some architectures these routines are defined as
+.Dv NULL
+macros in the include file
+.In netinet/in.h .
+On other architectures, the routines are functional when the host byte order is
+different from network byte order.
+.Pp
+These functions are most often used in conjunction with Internet addresses and
+ports as returned by
+.Xr gethostent 3NSL
+and
+.Xr getservent 3NSL .
+.Sh MT-LEVEL
+.Sy Safe
+.Sh SEE ALSO
+.Xr inet.h 3HEAD ,
+.Xr gethostent 3NSL ,
+.Xr getservent 3NSL ,
+.Xr attributes 5 ,
+.Xr byteorder 5
diff --git a/usr/src/man/man3c/endian.3c b/usr/src/man/man3c/endian.3c
index 658d47ba58..65c07323bb 100644
--- a/usr/src/man/man3c/endian.3c
+++ b/usr/src/man/man3c/endian.3c
@@ -11,7 +11,7 @@
.\"
.\" Copyright 2016 Joyent, Inc.
.\"
-.Dd January 30, 2016
+.Dd August 2, 2018
.Dt ENDIAN 3C
.Os
.Sh NAME
@@ -177,7 +177,7 @@ To better support extant software, both are provided.
While these functions are common across multiple platforms, they have
not been standardized.
Portable applications should instead use the functions defined in
-.Xr byteorder 3SOCKET .
+.Xr byteorder 3C .
.Sh RETURN VALUES
The functions always succeed and return a value that has been properly
converted.
@@ -186,7 +186,7 @@ converted.
.Sh MT-LEVEL
.Sy MT-Safe
.Sh SEE ALSO
+.Xr byteorder 3C ,
.Xr endian.h 3HEAD ,
-.Xr byteorder 3SOCKET ,
.Xr attributes 5 ,
.Xr byteorder 5
diff --git a/usr/src/man/man3head/endian.h.3head b/usr/src/man/man3head/endian.h.3head
index 1e133e6fb6..82a195c9bd 100644
--- a/usr/src/man/man3head/endian.h.3head
+++ b/usr/src/man/man3head/endian.h.3head
@@ -11,7 +11,7 @@
.\"
.\" Copyright 2016 Joyent, Inc.
.\"
-.Dd January 30, 2016
+.Dd August 2, 2018
.Dt ENDIAN.H 3HEAD
.Os
.Sh NAME
@@ -77,7 +77,7 @@ to one of the aforementioned macros.
.Pp
In addition to the routines provided by this header, standardized
functions may be found in
-.Xr byteorder 3SOCKET .
+.Xr byteorder 3C .
The header
.Xr types.h 3HEAD
also defines additional pre-processor symbols to determine the current
@@ -85,6 +85,7 @@ endianness of the system.
.Sh INTERFACE STABILITY
.Sy Committed
.Sh SEE ALSO
+.Xr byteorder 3C ,
.Xr endian 3C ,
.Xr types.h 3HEAD ,
.Xr attributes 5 ,
diff --git a/usr/src/man/man3head/inet.h.3head b/usr/src/man/man3head/inet.h.3head
index b0f2e257bd..8e48664781 100644
--- a/usr/src/man/man3head/inet.h.3head
+++ b/usr/src/man/man3head/inet.h.3head
@@ -125,6 +125,6 @@ Interface Stability Standard
.SH SEE ALSO
.LP
-\fBIntro\fR(3), \fBhtonl\fR(3C), \fBhtonl\fR(3XNET),
+\fBIntro\fR(3), \fBhtonl\fR(3C),
\fBinet_addr\fR(3C), \fBinet_addr\fR(3XNET), \fBin.h\fR(3HEAD),
\fBattributes\fR(5), \fBstandards\fR(5)
diff --git a/usr/src/man/man3lib/libsocket.3lib b/usr/src/man/man3lib/libsocket.3lib
index 58666187e1..7d22c95840 100644
--- a/usr/src/man/man3lib/libsocket.3lib
+++ b/usr/src/man/man3lib/libsocket.3lib
@@ -3,7 +3,7 @@
.\" The contents of this file are subject to the terms of the 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. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH LIBSOCKET 3LIB "Nov 2, 2004"
+.TH LIBSOCKET 3LIB "Aug 2, 2018"
.SH NAME
libsocket \- sockets library
.SH SYNOPSIS
@@ -13,12 +13,10 @@ cc [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR [ \fIlibrary\fR... ]
.fi
.SH DESCRIPTION
-.sp
.LP
Functions in this library provide the socket internetworking interface,
primarily used with the TCP/IP protocol suite.
.SH INTERFACES
-.sp
.LP
The shared object \fBlibsocket.so.1\fR provides the public interfaces defined
below. See \fBIntro\fR(3) for additional information on shared object
@@ -51,14 +49,12 @@ l l .
\fBgetservbyname_r\fR \fBgetservbyport\fR
\fBgetservbyport_r\fR \fBgetservent\fR
\fBgetservent_r\fR \fBgetsockname\fR
-\fBgetsockopt\fR \fBhtonl\fR
-\fBhtons\fR \fBif_freenameindex\fR
+\fBgetsockopt\fR \fBif_freenameindex\fR
\fBif_indextoname\fR \fBif_nameindex\fR
\fBif_nametoindex\fR \fBin6addr_any\fR
\fBin6addr_loopback\fR \fBinet_lnaof\fR
\fBinet_makeaddr\fR \fBinet_network\fR
-\fBlisten\fR \fBntohl\fR
-\fBntohs\fR \fBrcmd\fR
+\fBlisten\fR \fBrcmd\fR
\fBrcmd_af\fR \fBrecv\fR
\fBrecvfrom\fR \fBrecvmsg\fR
\fBrexec\fR \fBrexec_af\fR
@@ -68,11 +64,10 @@ l l .
\fBsetnetent\fR \fBsetprotoent\fR
\fBsetservent\fR \fBsetsockopt\fR
\fBshutdown\fR \fBsocket\fR
-\fBsocketpair\fR
+\fBsocketpair\fR
.TE
.SH FILES
-.sp
.ne 2
.na
\fB\fB/lib/libsocket.so.1\fR\fR
@@ -91,7 +86,6 @@ shared object
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -107,7 +101,6 @@ MT-Level See the manual page for each interface.
.TE
.SH SEE ALSO
-.sp
.LP
\fBpvs\fR(1), \fBIntro\fR(2), \fBIntro\fR(3), \fBsocket.h\fR(3HEAD),
\fBattributes\fR(5)
diff --git a/usr/src/man/man3nsl/gethostbyname.3nsl b/usr/src/man/man3nsl/gethostbyname.3nsl
index 4b0e9ed867..925f3ebb85 100644
--- a/usr/src/man/man3nsl/gethostbyname.3nsl
+++ b/usr/src/man/man3nsl/gethostbyname.3nsl
@@ -99,7 +99,6 @@ gethostent_r, sethostent, endhostent \- get network host entry
.fi
.SH DESCRIPTION
-.sp
.LP
These functions are used to obtain entries describing hosts. An entry can come
from any of the sources for \fBhosts\fR specified in the
@@ -126,7 +125,7 @@ by \fIaddr\fR.
.sp
.LP
All addresses are returned in network order. In order to interpret the
-addresses, \fBbyteorder\fR(3SOCKET) must be used for byte order conversion.
+addresses, \fBbyteorder\fR(3C) must be used for byte order conversion.
.sp
.LP
The \fBsethostent()\fR, \fBgethostent()\fR, and \fBendhostent()\fR functions
@@ -151,7 +150,6 @@ deallocate resources it was using. It is still allowed, but possibly less
efficient, for the process to call more host retrieval functions after calling
\fBendhostent()\fR.
.SS "Reentrant Interfaces"
-.sp
.LP
The \fBgethostbyname()\fR, \fBgethostbyaddr()\fR, and \fBgethostent()\fR
functions use static storage that is reused in each call, making these
@@ -196,7 +194,6 @@ Like their non-reentrant counterparts, \fBgethostbyname_r()\fR and
\fBgethostbyaddr_r()\fR leave the enumeration position in an indeterminate
state.
.SH RETURN VALUES
-.sp
.LP
Host entries are represented by the \fBstruct hostent\fR structure defined in
\fB<netdb.h>\fR:
@@ -244,7 +241,6 @@ always equal to the \fIresult\fR pointer that was supplied by the caller.
The \fBsethostent()\fR and \fBendhostent()\fR functions return \fB0\fR on
success.
.SH ERRORS
-.sp
.LP
The reentrant functions \fBgethostbyname_r()\fR, \fBgethostbyaddr_r()\fR, and
\fBgethostent_r()\fR will return \fINULL\fR and set \fIerrno\fR to \fBERANGE\fR
@@ -329,7 +325,6 @@ Note that the preceding sample program is unsafe for use in multithreaded
applications.
.SH FILES
-.sp
.ne 2
.na
\fB\fB/etc/hosts\fR\fR
@@ -358,7 +353,6 @@ configuration file for the name service switch
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -376,19 +370,16 @@ T}
.TE
.SH SEE ALSO
-.sp
.LP
-\fBIntro\fR(2), \fBIntro\fR(3), \fBbyteorder\fR(3SOCKET), \fBinet\fR(3SOCKET),
+\fBIntro\fR(2), \fBIntro\fR(3), \fBbyteorder\fR(3C), \fBinet\fR(3SOCKET),
\fBnetdb.h\fR(3HEAD), \fBnetdir\fR(3NSL), \fBhosts\fR(4), \fBnetconfig\fR(4),
\fBnss\fR(4), \fBnsswitch.conf\fR(4), \fBattributes\fR(5)
.SH WARNINGS
-.sp
.LP
The reentrant interfaces \fBgethostbyname_r()\fR, \fBgethostbyaddr_r()\fR, and
\fBgethostent_r()\fR are included in this release on an uncommitted basis only
and are subject to change or removal in future minor releases.
.SH NOTES
-.sp
.LP
To ensure that they all return consistent results, \fBgethostbyname()\fR,
\fBgethostbyname_r()\fR, and \fBnetdir_getbyname()\fR are implemented in terms
diff --git a/usr/src/man/man3socket/Makefile b/usr/src/man/man3socket/Makefile
index 3422782a2a..d700951ae1 100644
--- a/usr/src/man/man3socket/Makefile
+++ b/usr/src/man/man3socket/Makefile
@@ -21,7 +21,6 @@ MANSECT= 3socket
MANFILES= accept.3socket \
bind.3socket \
- byteorder.3socket \
connect.3socket \
ethers.3socket \
getaddrinfo.3socket \
@@ -90,9 +89,6 @@ MANLINKS= accept4.3socket \
getservbyport_r.3socket \
getservent.3socket \
getservent_r.3socket \
- htonl.3socket \
- htonll.3socket \
- htons.3socket \
if_freenameindex.3socket \
if_indextoname.3socket \
if_nameindex.3socket \
@@ -109,9 +105,6 @@ MANLINKS= accept4.3socket \
inet6_rth_reverse.3socket \
inet6_rth_segments.3socket \
inet6_rth_space.3socket \
- ntohl.3socket \
- ntohll.3socket \
- ntohs.3socket \
rcmd_af.3socket \
recvfrom.3socket \
recvmsg.3socket \
@@ -138,13 +131,6 @@ MANLINKS= accept4.3socket \
accept4.3socket := LINKSRC = accept.3socket
-htonl.3socket := LINKSRC = byteorder.3socket
-htonll.3socket := LINKSRC = byteorder.3socket
-htons.3socket := LINKSRC = byteorder.3socket
-ntohl.3socket := LINKSRC = byteorder.3socket
-ntohll.3socket := LINKSRC = byteorder.3socket
-ntohs.3socket := LINKSRC = byteorder.3socket
-
ether_aton.3socket := LINKSRC = ethers.3socket
ether_aton_r.3socket := LINKSRC = ethers.3socket
ether_hostton.3socket := LINKSRC = ethers.3socket
diff --git a/usr/src/man/man3socket/byteorder.3socket b/usr/src/man/man3socket/byteorder.3socket
deleted file mode 100644
index 1d08cd8204..0000000000
--- a/usr/src/man/man3socket/byteorder.3socket
+++ /dev/null
@@ -1,77 +0,0 @@
-'\" te
-.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
-.\" Copyright 1989 AT&T
-.\" The contents of this file are subject to the terms of the 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. See the License for the specific language governing permissions and limitations under the License.
-.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH BYTEORDER 3SOCKET "Mar 10, 2016"
-.SH NAME
-byteorder, htonl, htonll, htons, ntohl, ntohll, ntohs \- convert values between
-host and network byte order
-.SH SYNOPSIS
-.LP
-.nf
-\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR... ]
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <inttypes.h>
-
-\fBuint32_t\fR \fBhtonl\fR(\fBuint32_t\fR \fIhostlong\fR);
-.fi
-
-.LP
-.nf
-\fBuint64_t\fR \fBhtonll\fR(\fBuint64_t\fR \fIhostlonglong\fR);
-.fi
-
-.LP
-.nf
-\fBuint16_t\fR \fBhtons\fR(\fBuint16_t\fR \fIhostshort\fR);
-.fi
-
-.LP
-.nf
-\fBuint32_t\fR \fBntohl\fR(\fBuint32_t\fR \fInetlong\fR);
-.fi
-
-.LP
-.nf
-\fBuint64_t\fR \fBntohll\fR(\fBuint64_t\fR \fIhostlonglong\fR);
-.fi
-
-.LP
-.nf
-\fBuint16_t\fR \fBntohs\fR(\fBuint16_t\fR \fInetshort\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-These functions convert 16-bit, 32-bit, and 64-bit quantities between network
-byte order and host byte order. On some architectures these routines are
-defined as \fINULL\fR macros in the include file <\fBnetinet/in.h\fR>. On other
-architectures, the routines are functional when the host byte order is
-different from network byte order.
-.sp
-.LP
-These functions are most often used in conjunction with Internet addresses and
-ports as returned by \fBgethostent()\fR and \fBgetservent()\fR. See
-\fBgethostbyname\fR(3NSL) and \fBgetservbyname\fR(3SOCKET).
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-MT-Level Safe
-.TE
-
-.SH SEE ALSO
-.LP
-\fBgethostbyname\fR(3NSL), \fBgetservbyname\fR(3SOCKET), \fBinet.h\fR(3HEAD),
-\fBattributes\fR(5), \fBbyteorder\fR(5)
diff --git a/usr/src/man/man3socket/getaddrinfo.3socket b/usr/src/man/man3socket/getaddrinfo.3socket
index 8d43f9641b..6e24126b66 100644
--- a/usr/src/man/man3socket/getaddrinfo.3socket
+++ b/usr/src/man/man3socket/getaddrinfo.3socket
@@ -532,7 +532,7 @@ Standard See \fBstandards\fR(5).
.SH SEE ALSO
.LP
\fBipaddrsel\fR(1M), \fBgethostbyname\fR(3NSL), \fBgetipnodebyname\fR(3SOCKET),
-\fBhtonl\fR(3SOCKET), \fBinet\fR(3SOCKET), \fBsockaddr\fR(3SOCKET),
+\fBhtonl\fR(3C), \fBinet\fR(3SOCKET), \fBsockaddr\fR(3SOCKET),
\fBnetdb.h\fR(3HEAD), \fBsocket\fR(3SOCKET), \fBhosts\fR(4),
\fBnsswitch.conf\fR(4), \fBattributes\fR(5), \fBstandards\fR(5), \fBinet6\fR(7P)
.sp
diff --git a/usr/src/man/man3socket/getipnodebyname.3socket b/usr/src/man/man3socket/getipnodebyname.3socket
index 7eca1e3892..89e6100e03 100644
--- a/usr/src/man/man3socket/getipnodebyname.3socket
+++ b/usr/src/man/man3socket/getipnodebyname.3socket
@@ -504,7 +504,7 @@ MT-Level Safe
.SH SEE ALSO
.LP
-\fBgetaddrinfo\fR(3SOCKET), \fBgethostbyname\fR(3NSL), \fBhtonl\fR(3SOCKET),
+\fBgetaddrinfo\fR(3SOCKET), \fBgethostbyname\fR(3NSL), \fBhtonl\fR(3C),
\fBinet\fR(3SOCKET), \fBnetdb.h\fR(3HEAD), \fBhosts\fR(4),
\fBnsswitch.conf\fR(4), \fBattributes\fR(5)
.SH NOTES
diff --git a/usr/src/man/man3socket/getservbyname.3socket b/usr/src/man/man3socket/getservbyname.3socket
index cc251a2252..b9b2f1a98b 100644
--- a/usr/src/man/man3socket/getservbyname.3socket
+++ b/usr/src/man/man3socket/getservbyname.3socket
@@ -53,7 +53,6 @@ getservent_r, setservent, endservent \- get service entry
.fi
.SH DESCRIPTION
-.sp
.LP
These functions are used to obtain entries for Internet services. An entry may
come from any of the sources for \fBservices\fR specified in the
@@ -75,7 +74,7 @@ number \fIport\fR.
.sp
.LP
All addresses are returned in network order. In order to interpret the
-addresses, \fBbyteorder\fR(3SOCKET) must be used for byte order conversion. The
+addresses, \fBbyteorder\fR(3C) must be used for byte order conversion. The
string \fIproto\fR is used by both \fBgetservbyname()\fR and
\fBgetservbyport()\fR to restrict the search to entries with the specified
protocol. If \fIproto\fR is \fINULL\fR, entries with any protocol can be
@@ -113,7 +112,6 @@ was using. It is still allowed, but possibly less efficient, for the process
to call more service entry retrieval functions after calling
\fBendservent()\fR.
.SS "Reentrant Interfaces"
-.sp
.LP
The functions \fBgetservbyname()\fR, \fBgetservbyport()\fR, and
\fBgetservent()\fR use static storage that is re-used in each call, making
@@ -156,7 +154,6 @@ Like their non-reentrant counterparts, \fBgetservbyname_r()\fR and
\fBgetservbyport_r()\fR leave the enumeration position in an indeterminate
state.
.SH RETURN VALUES
-.sp
.LP
Service entries are represented by the \fBstruct servent\fR structure defined
in <\fBnetdb.h\fR>:
@@ -234,7 +231,6 @@ When the pointer returned by the reentrant functions \fBgetservbyname_r()\fR,
\fBgetservbyport_r()\fR, and \fBgetservent_r()\fR is non-null, it is always
equal to the \fIresult\fR pointer that was supplied by the caller.
.SH ERRORS
-.sp
.LP
The reentrant functions \fBgetservbyname_r()\fR, \fBgetservbyport_r()\fR, and
\fBgetservent_r()\fR return \fINULL\fR and set \fBerrno\fR to \fBERANGE\fR if
@@ -242,7 +238,6 @@ the length of the buffer supplied by caller is not large enough to store the
result. See \fBIntro\fR(2) for the proper usage and interpretation of
\fBerrno\fR in multithreaded applications.
.SH FILES
-.sp
.ne 2
.na
\fB\fB/etc/services\fR\fR
@@ -270,7 +265,6 @@ configuration file for the name-service switch
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -288,24 +282,21 @@ T}
.TE
.SH SEE ALSO
-.sp
.LP
-\fBIntro\fR(2), \fBIntro\fR(3), \fBbyteorder\fR(3SOCKET), \fBnetdir\fR(3NSL),
+\fBIntro\fR(2), \fBIntro\fR(3), \fBbyteorder\fR(3C), \fBnetdir\fR(3NSL),
\fBnetconfig\fR(4), \fBnsswitch.conf\fR(4), \fBservices\fR(4),
\fBattributes\fR(5), \fBnetdb.h\fR(3HEAD)
.SH WARNINGS
-.sp
.LP
The reentrant interfaces \fBgetservbyname_r()\fR, \fBgetservbyport_r()\fR, and
\fBgetservent_r()\fR are included in this release on an uncommitted basis only,
and are subject to change or removal in future minor releases.
.SH NOTES
-.sp
.LP
The functions that return \fBstruct servent\fR return the least significant
16-bits of the \fIs_port\fR field in \fInetwork byte order\fR.
\fBgetservbyport()\fR and \fBgetservbyport_r()\fR also expect the input
-parameter \fIport\fR in the \fInetwork byte order\fR. See \fBhtons\fR(3SOCKET)
+parameter \fIport\fR in the \fInetwork byte order\fR. See \fBhtons\fR(3C)
for more details on converting between host and network byte orders.
.sp
.LP
diff --git a/usr/src/man/man3socket/rexec.3socket b/usr/src/man/man3socket/rexec.3socket
index 34163c2d80..99461eb178 100644
--- a/usr/src/man/man3socket/rexec.3socket
+++ b/usr/src/man/man3socket/rexec.3socket
@@ -25,7 +25,6 @@ rexec, rexec_af \- return stream to a remote command
.fi
.SH DESCRIPTION
-.sp
.LP
The \fBrexec()\fR and \fBrexec_af()\fR functions look up the host \fIahost\fR
using \fBgetaddrinfo\fR(3SOCKET) and return \fB\(mi1\fR if the host does not
@@ -47,7 +46,7 @@ connectivity to the remote host.
.LP
The port \fIinport\fR specifies which \fBDARPA\fR Internet port to use for the
connection. The port number used must be in network byte order, as supplied by
-a call to \fBhtons\fR(3XNET). The protocol for connection is described in
+a call to \fBhtons\fR(3C). The protocol for connection is described in
detail in \fBin.rexecd\fR(1M).
.sp
.LP
@@ -67,7 +66,6 @@ out-of-band data.
There is no way to specify options to the \fBsocket()\fR call made by the
\fBrexec()\fR or \fBrexec_af()\fRfunctions.
.SH RETURN VALUES
-.sp
.LP
If \fBrexec()\fR succeeds, a file descriptor number is returned of the socket
type \fBSOCK_STREAM\fR and the address family \fBAF_INET\fR. The parameter
@@ -83,7 +81,6 @@ the socket type \fBSOCK_STREAM\fR in the address family \fBAF_INET\fR or
.LP
If either \fBrexec()\fR or \fBrexec_af()\fR fails, \fB\(mi1\fR is returned.
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -103,8 +100,7 @@ MT-Level Unsafe
This interface is Unsafe in multithreaded applications. Unsafe interfaces
should be called only from the main thread.
.SH SEE ALSO
-.sp
.LP
\fBin.rexecd\fR(1M), \fBgetaddrinfo\fR(3SOCKET), \fBgethostbyname\fR(3NSL),
-\fBgetservbyname\fR(3SOCKET), \fBhtonl\fR(3XNET), \fBsocket\fR(3SOCKET),
+\fBgetservbyname\fR(3SOCKET), \fBhtonl\fR(3C), \fBsocket\fR(3SOCKET),
\fBattributes\fR(5)
diff --git a/usr/src/man/man3socket/sockaddr.3socket b/usr/src/man/man3socket/sockaddr.3socket
index 740b80e4dd..3d5af60020 100644
--- a/usr/src/man/man3socket/sockaddr.3socket
+++ b/usr/src/man/man3socket/sockaddr.3socket
@@ -198,9 +198,9 @@ is always stored in
.Sy Network Byte Order .
On many systems, this differs from the native host byte order.
Applications should read from the member with the function
-.Xr ntohs 3SOCKET
+.Xr ntohs 3C
and write to the member with the function
-.Xr htons 3SOCKET .
+.Xr htons 3C .
The member
.Em sin_addr
is the four byte IPv4 address.
@@ -264,9 +264,9 @@ byte order.
The member
.Em sin6_port
describes the IPv6 port and should be manipulated with the functions
-.Xr ntohs 3SOCKET
+.Xr ntohs 3C
and
-.Xr htons 3SOCKET .
+.Xr htons 3C .
The member
.Em sin6_addr
describes the 16-byte IPv6 address.
@@ -426,9 +426,9 @@ For example, when capturing Ethernet frames the value of
.Em sll_protocol
is the Ethertype.
This member is written in network byte order and applications should use
-.Xr htons 3SOCKET
+.Xr htons 3C
and
-.Xr ntohs 3SOCKET
+.Xr ntohs 3C
to read and write the member.
.Lp
The member
diff --git a/usr/src/man/man5/byteorder.5 b/usr/src/man/man5/byteorder.5
index 4b33ac411b..88470e101c 100644
--- a/usr/src/man/man5/byteorder.5
+++ b/usr/src/man/man5/byteorder.5
@@ -11,7 +11,7 @@
.\"
.\" Copyright 2016 Joyent, Inc.
.\"
-.Dd January 31, 2016
+.Dd August 2, 2018
.Dt BYTEORDER 5
.Os
.Sh NAME
@@ -202,12 +202,12 @@ check the byte order and convert it appropriately.
The system provides two different sets of functions to convert values
between big-endian and little-endian.
They are defined in
-.Xr byteorder 3SOCKET
+.Xr byteorder 3C
and
.Xr endian 3C .
.Pp
The
-.Xr byteorder 3SOCKET
+.Xr byteorder 3C
family of functions convert data between the host's native byte order
and big- or little-endian.
The functions operate on either 16-bit, 32-bit, or 64-bit values.
@@ -219,23 +219,23 @@ order, begin with
.Sy hton .
For example, to convert a 32-bit value, a long, from network byte order
to the host's, one would use the function
-.Xr ntohl 3SOCKET .
+.Xr ntohl 3C .
.Pp
These functions have been standardized by POSIX.
However, the 64-bit variants,
-.Xr ntohll 3SOCKET
+.Xr ntohll 3C
and
-.Xr htonll 3SOCKET
+.Xr htonll 3C
are not standardized and may not be found on other systems.
For more information on these functions, see
-.Xr byteorder 3SOCKET .
+.Xr byteorder 3C .
.Pp
The second family of functions,
.Xr endian 3C ,
provide a means to convert between the host's byte order
and big-endian and little-endian specifically.
While these functions are similar to those in
-.Xr byteorder 3SOCKET ,
+.Xr byteorder 3C ,
they more explicitly cover different data conversions.
Like them, these functions operate on either 16-bit, 32-bit, or 64-bit values.
When converting from big-endian, to the host's endianness, the functions
@@ -254,17 +254,17 @@ to little-endian respectively.
These functions are not standardized and the header they appear in varies
between the BSDs and GNU/Linux.
Applications that wish to be portable, shoulda instead use the
-.Xr byteorder 3SOCKET
+.Xr byteorder 3C
functions.
.Pp
All of these functions in both families simply return their input when
the host's native byte order is the same as the desired order.
For example, when calling
-.Xr htonl 3SOCKET
+.Xr htonl 3C
on a big-endian system the original data is returned with no conversion
or modification.
.Sh SEE ALSO
+.Xr byteorder 3C ,
.Xr endian 3C ,
.Xr endian.h 3HEAD ,
-.Xr inet 3HEAD ,
-.Xr byteorder 3SOCKET
+.Xr inet 3HEAD
diff --git a/usr/src/man/man7p/inet.7p b/usr/src/man/man7p/inet.7p
index 385fcdfa72..541892768b 100644
--- a/usr/src/man/man7p/inet.7p
+++ b/usr/src/man/man7p/inet.7p
@@ -84,7 +84,7 @@ Get interface network mask.
.LP
\fBIP\fR addresses are four byte quantities, stored in network byte order.
\fBIP\fR addresses should be manipulated using the byte order conversion
-routines. See \fBbyteorder\fR(3SOCKET).
+routines. See \fBbyteorder\fR(3C).
.sp
.LP
Addresses in the Internet protocol family use the \fBsockaddr_in\fR structure,
@@ -153,7 +153,7 @@ numbers. These semantics apply when Internet family protocols are used using
the \fBTLI\fR.
.SH SEE ALSO
.LP
-\fBioctl\fR(2), \fBbind\fR(3SOCKET), \fBbyteorder\fR(3SOCKET),
+\fBioctl\fR(2), \fBbind\fR(3SOCKET), \fBbyteorder\fR(3C),
\fBconnect\fR(3SOCKET), \fBgethostbyname\fR(3NSL), \fBgetnetbyname\fR(3SOCKET),
\fBgetprotobyname\fR(3SOCKET), \fBgetservbyname\fR(3SOCKET),
\fBgetsockopt\fR(3SOCKET), \fBsend\fR(3SOCKET), \fBsockaddr\fR(3SOCKET),
diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc
index f5a26a2072..26ae074cb8 100644
--- a/usr/src/pkg/manifests/system-library.man3c.inc
+++ b/usr/src/pkg/manifests/system-library.man3c.inc
@@ -54,6 +54,7 @@ file path=usr/share/man/man3c/bsd_signal.3c
file path=usr/share/man/man3c/bsearch.3c
file path=usr/share/man/man3c/bstring.3c
file path=usr/share/man/man3c/btowc.3c
+file path=usr/share/man/man3c/byteorder.3c
file path=usr/share/man/man3c/call_once.3c
file path=usr/share/man/man3c/catgets.3c
file path=usr/share/man/man3c/catopen.3c
@@ -885,6 +886,9 @@ link path=usr/share/man/man3c/htobe64.3c target=endian.3c
link path=usr/share/man/man3c/htole16.3c target=endian.3c
link path=usr/share/man/man3c/htole32.3c target=endian.3c
link path=usr/share/man/man3c/htole64.3c target=endian.3c
+link path=usr/share/man/man3c/htonl.3c target=byteorder.3c
+link path=usr/share/man/man3c/htonll.3c target=byteorder.3c
+link path=usr/share/man/man3c/htons.3c target=byteorder.3c
link path=usr/share/man/man3c/inet6.3c target=inet.3c
link path=usr/share/man/man3c/inet_addr.3c target=inet.3c
link path=usr/share/man/man3c/inet_aton.3c target=inet.3c
@@ -1032,6 +1036,9 @@ link path=usr/share/man/man3c/nftw.3c target=ftw.3c
link path=usr/share/man/man3c/ngettext.3c target=gettext.3c
link path=usr/share/man/man3c/nl_langinfo_l.3c target=nl_langinfo.3c
link path=usr/share/man/man3c/nrand48.3c target=drand48.3c
+link path=usr/share/man/man3c/ntohl.3c target=byteorder.3c
+link path=usr/share/man/man3c/ntohll.3c target=byteorder.3c
+link path=usr/share/man/man3c/ntohs.3c target=byteorder.3c
link path=usr/share/man/man3c/openlog.3c target=syslog.3c
link path=usr/share/man/man3c/pclose.3c target=popen.3c
link path=usr/share/man/man3c/port_dissociate.3c target=port_associate.3c
diff --git a/usr/src/pkg/manifests/system-library.man3socket.inc b/usr/src/pkg/manifests/system-library.man3socket.inc
index 20a32905cb..b1db6325cd 100644
--- a/usr/src/pkg/manifests/system-library.man3socket.inc
+++ b/usr/src/pkg/manifests/system-library.man3socket.inc
@@ -17,7 +17,6 @@
file path=usr/share/man/man3socket/accept.3socket
file path=usr/share/man/man3socket/bind.3socket
-file path=usr/share/man/man3socket/byteorder.3socket
file path=usr/share/man/man3socket/connect.3socket
file path=usr/share/man/man3socket/ethers.3socket
file path=usr/share/man/man3socket/getaddrinfo.3socket
@@ -110,9 +109,6 @@ link path=usr/share/man/man3socket/getservent.3socket \
target=getservbyname.3socket
link path=usr/share/man/man3socket/getservent_r.3socket \
target=getservbyname.3socket
-link path=usr/share/man/man3socket/htonl.3socket target=byteorder.3socket
-link path=usr/share/man/man3socket/htonll.3socket target=byteorder.3socket
-link path=usr/share/man/man3socket/htons.3socket target=byteorder.3socket
link path=usr/share/man/man3socket/if_freenameindex.3socket \
target=if_nametoindex.3socket
link path=usr/share/man/man3socket/if_indextoname.3socket \
@@ -145,9 +141,6 @@ link path=usr/share/man/man3socket/inet6_rth_segments.3socket \
target=inet6_rth.3socket
link path=usr/share/man/man3socket/inet6_rth_space.3socket \
target=inet6_rth.3socket
-link path=usr/share/man/man3socket/ntohl.3socket target=byteorder.3socket
-link path=usr/share/man/man3socket/ntohll.3socket target=byteorder.3socket
-link path=usr/share/man/man3socket/ntohs.3socket target=byteorder.3socket
link path=usr/share/man/man3socket/rcmd_af.3socket target=rcmd.3socket
link path=usr/share/man/man3socket/recvfrom.3socket target=recv.3socket
link path=usr/share/man/man3socket/recvmsg.3socket target=recv.3socket
diff --git a/usr/src/uts/common/fs/sockfs/socksyscalls.c b/usr/src/uts/common/fs/sockfs/socksyscalls.c
index 854dd040b5..e0b6b5de43 100644
--- a/usr/src/uts/common/fs/sockfs/socksyscalls.c
+++ b/usr/src/uts/common/fs/sockfs/socksyscalls.c
@@ -83,7 +83,7 @@ int do_useracc = 1; /* Controlled by setting SO_DEBUG to 4 */
#define do_useracc 1
#endif /* SOCK_TEST */
-extern int xnet_truncate_print;
+extern int xnet_truncate_print;
extern void nl7c_init(void);
extern int sockfs_defer_nl7c_init;
@@ -218,7 +218,7 @@ getsonode(int sock, int *errorp, file_t **fpp)
*/
static struct sockaddr *
copyin_name(struct sonode *so, struct sockaddr *name, socklen_t *namelenp,
- int *errorp)
+ int *errorp)
{
char *faddr;
size_t namelen = (size_t)*namelenp;
@@ -276,8 +276,8 @@ copyin_name(struct sonode *so, struct sockaddr *name, socklen_t *namelenp,
* Copy from kaddr/klen to uaddr/ulen. Updates ulenp if non-NULL.
*/
static int
-copyout_arg(void *uaddr, socklen_t ulen, void *ulenp,
- void *kaddr, socklen_t klen)
+copyout_arg(void *uaddr, socklen_t ulen, void *ulenp, void *kaddr,
+ socklen_t klen)
{
if (uaddr != NULL) {
if (ulen > klen)
@@ -303,8 +303,8 @@ copyout_arg(void *uaddr, socklen_t ulen, void *ulenp,
* klen to update ulenp.
*/
static int
-copyout_name(void *uaddr, socklen_t ulen, void *ulenp,
- void *kaddr, socklen_t klen)
+copyout_name(void *uaddr, socklen_t ulen, void *ulenp, void *kaddr,
+ socklen_t klen)
{
if (uaddr != NULL) {
if (ulen >= klen)
@@ -827,13 +827,8 @@ shutdown(int sock, int how, int version)
* Common receive routine.
*/
static ssize_t
-recvit(int sock,
- struct nmsghdr *msg,
- struct uio *uiop,
- int flags,
- socklen_t *namelenp,
- socklen_t *controllenp,
- int *flagsp)
+recvit(int sock, struct nmsghdr *msg, struct uio *uiop, int flags,
+ socklen_t *namelenp, socklen_t *controllenp, int *flagsp)
{
struct sonode *so;
file_t *fp;
@@ -975,8 +970,8 @@ recv(int sock, void *buffer, size_t len, int flags)
}
ssize_t
-recvfrom(int sock, void *buffer, size_t len, int flags,
- struct sockaddr *name, socklen_t *namelenp)
+recvfrom(int sock, void *buffer, size_t len, int flags, struct sockaddr *name,
+ socklen_t *namelenp)
{
struct nmsghdr lmsg;
struct uio auio;
@@ -1522,8 +1517,7 @@ bad: return (error != 0 ? set_errno(error) : 0);
/*ARGSUSED3*/
int
-getsockname(int sock, struct sockaddr *name,
- socklen_t *namelenp, int version)
+getsockname(int sock, struct sockaddr *name, socklen_t *namelenp, int version)
{
struct sonode *so;
int error;
@@ -1560,12 +1554,8 @@ bad: return (error != 0 ? set_errno(error) : 0);
/*ARGSUSED5*/
int
-getsockopt(int sock,
- int level,
- int option_name,
- void *option_value,
- socklen_t *option_lenp,
- int version)
+getsockopt(int sock, int level, int option_name, void *option_value,
+ socklen_t *option_lenp, int version)
{
struct sonode *so;
socklen_t optlen, optlen_res;
@@ -1612,12 +1602,8 @@ getsockopt(int sock,
/*ARGSUSED5*/
int
-setsockopt(int sock,
- int level,
- int option_name,
- void *option_value,
- socklen_t option_len,
- int version)
+setsockopt(int sock, int level, int option_name, void *option_value,
+ socklen_t option_len, int version)
{
struct sonode *so;
intptr_t buffer[2];
@@ -2017,7 +2003,7 @@ sockconfig(int cmd, void *arg1, void *arg2, void *arg3, void *arg4)
* the application as that's what would have happened if the operations
* were done sequentially. With this in mind, following should work :
*
- * - Check for errors before read or write.
+ * - Check for errors before read or write.
* - If the reader encounters error, set the error in sr_read_error.
* Check sr_write_error, if it is set, send cv_signal as it is
* waiting for reader to complete. If it is not set, the writer
@@ -2531,6 +2517,9 @@ snf_smap_desbfree(snf_smap_desbinfo *snfi)
* At the end of the whole sendfile() operation, we wait till the data from
* the last mblk is ack'ed by the transport before returning so that the
* caller of sendfile() can safely modify the file content.
+ *
+ * The caller of this function should make sure that total_size does not exceed
+ * the actual file size of fvp.
*/
int
snf_segmap(file_t *fp, vnode_t *fvp, u_offset_t fileoff, u_offset_t total_size,
@@ -3047,7 +3036,7 @@ recv32(int32_t sock, caddr32_t buffer, size32_t len, int32_t flags)
ssize_t
recvfrom32(int32_t sock, caddr32_t buffer, size32_t len, int32_t flags,
- caddr32_t name, caddr32_t namelenp)
+ caddr32_t name, caddr32_t namelenp)
{
return (recvfrom(sock, (void *)(uintptr_t)buffer, (ssize32_t)len, flags,
(void *)(uintptr_t)name, (void *)(uintptr_t)namelenp));
@@ -3061,7 +3050,7 @@ send32(int32_t sock, caddr32_t buffer, size32_t len, int32_t flags)
ssize_t
sendto32(int32_t sock, caddr32_t buffer, size32_t len, int32_t flags,
- caddr32_t name, socklen_t namelen)
+ caddr32_t name, socklen_t namelen)
{
return (sendto(sock, (void *)(uintptr_t)buffer, (ssize32_t)len, flags,
(void *)(uintptr_t)name, namelen));
diff --git a/usr/src/uts/common/syscall/sendfile.c b/usr/src/uts/common/syscall/sendfile.c
index f42c907cf3..16c6fdd27e 100644
--- a/usr/src/uts/common/syscall/sendfile.c
+++ b/usr/src/uts/common/syscall/sendfile.c
@@ -953,13 +953,27 @@ sendvec_chunk(file_t *fp, u_offset_t *fileoff, struct sendfilevec *sfv,
if (socket_setsockopt(VTOSO(vp),
SOL_SOCKET, SO_SND_COPYAVOID,
&on, sizeof (on), CRED()) == 0)
- segmapit = 1;
+ segmapit = 1;
}
}
if (segmapit) {
+ struct vattr va;
boolean_t nowait;
+ va.va_mask = AT_SIZE;
+ error = VOP_GETATTR(readvp, &va, 0, kcred,
+ NULL);
+ if (error != 0 || sfv_off >= va.va_size) {
+ VOP_RWUNLOCK(readvp, V_WRITELOCK_FALSE,
+ NULL);
+ releasef(sfv->sfv_fd);
+ return (error);
+ }
+ /* Read as much as possible. */
+ if (sfv_off + sfv_len > va.va_size)
+ sfv_len = va.va_size - sfv_off;
+
nowait = (sfv->sfv_flag & SFV_NOWAIT) != 0;
error = snf_segmap(fp, readvp, sfv_off,
(u_offset_t)sfv_len, (ssize_t *)&cnt,