[Midnightbsd-cvs] src [10224] trunk/cddl/lib: el sync o
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jun 2 11:58:17 EDT 2018
Revision: 10224
http://svnweb.midnightbsd.org/src/?rev=10224
Author: laffer1
Date: 2018-06-02 11:58:17 -0400 (Sat, 02 Jun 2018)
Log Message:
-----------
el sync o
Modified Paths:
--------------
trunk/cddl/lib/Makefile
trunk/cddl/lib/Makefile.inc
trunk/cddl/lib/drti/Makefile
trunk/cddl/lib/libavl/Makefile
trunk/cddl/lib/libctf/Makefile
trunk/cddl/lib/libdtrace/Makefile
trunk/cddl/lib/libdtrace/errno.d
trunk/cddl/lib/libdtrace/io.d
trunk/cddl/lib/libdtrace/libproc_compat.h
trunk/cddl/lib/libdtrace/net.d
trunk/cddl/lib/libdtrace/nfs.d
trunk/cddl/lib/libdtrace/nfssrv.d
trunk/cddl/lib/libdtrace/psinfo.d
trunk/cddl/lib/libdtrace/regs_x86.d
trunk/cddl/lib/libdtrace/sched.d
trunk/cddl/lib/libdtrace/signal.d
trunk/cddl/lib/libdtrace/unistd.d
trunk/cddl/lib/libnvpair/Makefile
trunk/cddl/lib/libumem/Makefile
trunk/cddl/lib/libuutil/Makefile
trunk/cddl/lib/libzfs/Makefile
trunk/cddl/lib/libzfs_core/Makefile
trunk/cddl/lib/libzpool/Makefile
Added Paths:
-----------
trunk/cddl/lib/libdtrace/ip.d
trunk/cddl/lib/libdtrace/tcp.d
trunk/cddl/lib/libdtrace/udp.d
trunk/cddl/lib/tests/
trunk/cddl/lib/tests/Makefile
Removed Paths:
-------------
trunk/cddl/lib/libzfs_core/libzfs_core.c
trunk/cddl/lib/libzfs_core/libzfs_core.h
trunk/cddl/lib/libzfs_core/libzfs_core_compat.c
trunk/cddl/lib/libzfs_core/libzfs_core_compat.h
Property Changed:
----------------
trunk/cddl/lib/Makefile.inc
trunk/cddl/lib/libdtrace/errno.d
trunk/cddl/lib/libdtrace/net.d
trunk/cddl/lib/libdtrace/nfs.d
trunk/cddl/lib/libdtrace/psinfo.d
trunk/cddl/lib/libdtrace/regs_x86.d
trunk/cddl/lib/libdtrace/sched.d
trunk/cddl/lib/libdtrace/signal.d
trunk/cddl/lib/libdtrace/unistd.d
Modified: trunk/cddl/lib/Makefile
===================================================================
--- trunk/cddl/lib/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,4 +1,5 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/Makefile 289956 2015-10-25 22:34:49Z ngie $
.include <bsd.own.mk>
@@ -11,8 +12,13 @@
libuutil \
${_libzfs_core} \
${_libzfs} \
- ${_libzpool}
+ ${_libzpool} \
+ ${_tests}
+.if ${MK_TESTS} != "no"
+_tests= tests
+.endif
+
.if ${MK_ZFS} != "no"
_libzfs_core= libzfs_core
_libzfs= libzfs
@@ -21,9 +27,15 @@
.endif
.endif
-.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
+ ${MACHINE_CPUARCH} == "mips" || ${MACHINE_CPUARCH} == "powerpc"
_drti= drti
_libdtrace= libdtrace
.endif
+SUBDIR_DEPEND_libdtrace= libctf
+SUBDIR_DEPEND_libzfs= libavl libnvpair libumem libuutil libzfs_core
+
+SUBDIR_PARALLEL=
+
.include <bsd.subdir.mk>
Modified: trunk/cddl/lib/Makefile.inc
===================================================================
--- trunk/cddl/lib/Makefile.inc 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/Makefile.inc 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,4 +1,5 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/Makefile.inc 195767 2009-07-19 17:25:24Z kensmith $
SHLIBDIR?= /lib
SHLIB_MAJOR?= 2
Property changes on: trunk/cddl/lib/Makefile.inc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/drti/Makefile
===================================================================
--- trunk/cddl/lib/drti/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/drti/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,7 +1,7 @@
# $MidnightBSD$
-# $FreeBSD: release/9.2.0/cddl/lib/drti/Makefile 250534 2013-05-12 00:35:57Z brooks $
+# $FreeBSD: stable/10/cddl/lib/drti/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/common
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common
SRCS= drti.c
FILES= ${SRCS:R:S/$/.o/g}
@@ -13,8 +13,8 @@
LIB= drti-dummy
INTERNALLIB=
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
- -I${.CURDIR}/../../../cddl/compat/opensolaris/include \
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
+ -I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
Modified: trunk/cddl/lib/libavl/Makefile
===================================================================
--- trunk/cddl/lib/libavl/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libavl/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,12 +1,12 @@
-# $MidnightBSD: src/cddl/lib/libavl/Makefile,v 1.2 2008/10/15 19:10:19 laffer1 Exp $
-# $FreeBSD: src/cddl/lib/libavl/Makefile,v 1.2 2007/04/16 21:20:24 ru Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libavl/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/avl
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/avl
LIB= avl
SRCS= avl.c
-WARNS?= 0
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
+WARNS?= 3
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
.include <bsd.lib.mk>
Modified: trunk/cddl/lib/libctf/Makefile
===================================================================
--- trunk/cddl/lib/libctf/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libctf/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,8 +1,9 @@
-# $MidnightBSD: src/cddl/lib/libctf/Makefile,v 1.1 2012/04/06 02:23:54 laffer1 Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libctf/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/common/ctf
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libctf/common
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/ctf
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/common/ctf
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libctf/common
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/ctf
LIB= ctf
SRCS= ctf_create.c \
@@ -17,11 +18,11 @@
ctf_types.c \
ctf_util.c
-WARNS?= 0
+WARNS?= 2
CFLAGS+= -DCTF_OLD_VERSIONS
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
- -I${.CURDIR}/../../../cddl/compat/opensolaris/include \
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \
+ -I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
-I${OPENSOLARIS_USR_DISTDIR}/common/ctf \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
Modified: trunk/cddl/lib/libdtrace/Makefile
===================================================================
--- trunk/cddl/lib/libdtrace/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,8 +1,8 @@
# $MidnightBSD$
-# $FreeBSD: release/9.2.0/cddl/lib/libdtrace/Makefile 249856 2013-04-24 20:10:52Z pfg $
+# $FreeBSD: stable/10/cddl/lib/libdtrace/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/common
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libgen/common
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libgen/common
LIB= dtrace
SRCS= dt_aggregate.c \
@@ -32,6 +32,7 @@
dt_parser.c \
dt_pcb.c \
dt_pid.c \
+ dt_pq.c \
dt_pragma.c \
dt_print.c \
dt_printf.c \
@@ -44,21 +45,23 @@
dt_subr.c \
dt_work.c \
dt_xlator.c \
- gmatch.c \
- dis_tables.c
+ gmatch.c
DSRCS= errno.d \
io.d \
+ ip.d \
psinfo.d \
signal.d \
+ tcp.d \
+ udp.d \
unistd.d
WARNS?= 1
CFLAGS+= -I${.OBJDIR} -I${.CURDIR} \
- -I${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH} \
- -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
- -I${.CURDIR}/../../../cddl/compat/opensolaris/include \
+ -I${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH} \
+ -I${SRCTOP}/sys/cddl/compat/opensolaris \
+ -I${SRCTOP}/cddl/compat/opensolaris/include \
-I${OPENSOLARIS_USR_DISTDIR}/head \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
@@ -67,12 +70,22 @@
#CFLAGS+= -DYYDEBUG
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+= -I${SRCTOP}/sys/cddl/dev/dtrace/x86
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/i386
-.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH}
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/i386
+.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH}
+.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/x86
.elif ${MACHINE_CPUARCH} == "sparc64"
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/sparc
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/sparc
+.elif ${MACHINE_CPUARCH} == "mips"
+CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/mips
+.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/mips
+.elif ${MACHINE_CPUARCH} == "powerpc"
+CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/powerpc
+.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/powerpc
.else
# temporary hack
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
@@ -79,6 +92,7 @@
.endif
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
+SRCS+= dis_tables.c
DSRCS+= regs_x86.d
.endif
Modified: trunk/cddl/lib/libdtrace/errno.d
===================================================================
--- trunk/cddl/lib/libdtrace/errno.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/errno.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -21,7 +22,7 @@
*
* Portions Copyright 2006-2008 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/errno.d 179189 2008-05-22 04:26:42Z jb $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/errno.d 179189 2008-05-22 04:26:42Z jb $
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Property changes on: trunk/cddl/lib/libdtrace/errno.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/io.d
===================================================================
--- trunk/cddl/lib/libdtrace/io.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/io.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -18,7 +19,7 @@
*
* CDDL HEADER END
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/io.d 243989 2012-12-07 19:06:40Z gnn $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/io.d 248846 2013-03-28 20:22:43Z gnn $
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
Added: trunk/cddl/lib/libdtrace/ip.d
===================================================================
--- trunk/cddl/lib/libdtrace/ip.d (rev 0)
+++ trunk/cddl/lib/libdtrace/ip.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -0,0 +1,285 @@
+/* $MidnightBSD$ */
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ *
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/ip.d 288080 2015-09-22 00:45:16Z markj $
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 Mark Johnston <markj at freebsd.org>
+ */
+
+#pragma D depends_on provider ip
+
+/*
+ * pktinfo is where packet ID info can be made available for deeper
+ * analysis if packet IDs become supported by the kernel in the future.
+ * The pkt_addr member is currently always NULL.
+ */
+typedef struct pktinfo {
+ uintptr_t pkt_addr;
+} pktinfo_t;
+
+/*
+ * csinfo is where connection state info is made available.
+ */
+typedef uint32_t zoneid_t;
+typedef struct csinfo {
+ uintptr_t cs_addr;
+ uint64_t cs_cid;
+ pid_t cs_pid;
+ zoneid_t cs_zoneid;
+} csinfo_t;
+
+/*
+ * ipinfo contains common IP info for both IPv4 and IPv6.
+ */
+typedef struct ipinfo {
+ uint8_t ip_ver; /* IP version (4, 6) */
+ uint32_t ip_plength; /* payload length */
+ string ip_saddr; /* source address */
+ string ip_daddr; /* destination address */
+} ipinfo_t;
+
+/*
+ * ifinfo contains network interface info.
+ */
+typedef struct ifinfo {
+ string if_name; /* interface name */
+ int8_t if_local; /* is delivered locally */
+ /*netstackid_t if_ipstack;*/ /* ipstack ID */
+ uintptr_t if_addr; /* pointer to raw ill_t */
+} ifinfo_t;
+
+typedef uint32_t ipaddr_t;
+typedef struct {
+ uint8_t ipha_version_and_hdr_length;
+ uint8_t ipha_type_of_service;
+ uint16_t ipha_length;
+ uint16_t ipha_ident;
+ uint16_t ipha_fragment_offset_and_flags;
+ uint8_t ipha_ttl;
+ uint8_t ipha_protocol;
+ uint16_t ipha_hdr_checksum;
+ ipaddr_t ipha_src;
+ ipaddr_t ipha_dst;
+} ipha_t;
+
+/*
+ * ipv4info is a translated version of the IPv4 header (with raw pointer).
+ * These values are NULL if the packet is not IPv4.
+ */
+typedef struct ipv4info {
+ uint8_t ipv4_ver; /* IP version (4) */
+ uint8_t ipv4_ihl; /* header length, bytes */
+ uint8_t ipv4_tos; /* type of service field */
+ uint16_t ipv4_length; /* length (header + payload) */
+ uint16_t ipv4_ident; /* identification */
+ uint8_t ipv4_flags; /* IP flags */
+ uint16_t ipv4_offset; /* fragment offset */
+ uint8_t ipv4_ttl; /* time to live */
+ uint8_t ipv4_protocol; /* next level protocol */
+ string ipv4_protostr; /* next level protocol, as a string */
+ uint16_t ipv4_checksum; /* header checksum */
+ ipaddr_t ipv4_src; /* source address */
+ ipaddr_t ipv4_dst; /* destination address */
+ string ipv4_saddr; /* source address, string */
+ string ipv4_daddr; /* destination address, string */
+ ipha_t *ipv4_hdr; /* pointer to raw header */
+} ipv4info_t;
+
+/*
+ * ipv6info is a translated version of the IPv6 header (with raw pointer).
+ * These values are NULL if the packet is not IPv6.
+ */
+typedef struct in6_addr in6_addr_t;
+typedef struct ipv6info {
+ uint8_t ipv6_ver; /* IP version (6) */
+ uint8_t ipv6_tclass; /* traffic class */
+ uint32_t ipv6_flow; /* flow label */
+ uint16_t ipv6_plen; /* payload length */
+ uint8_t ipv6_nexthdr; /* next header protocol */
+ string ipv6_nextstr; /* next header protocol, as a string */
+ uint8_t ipv6_hlim; /* hop limit */
+ in6_addr_t *ipv6_src; /* source address */
+ in6_addr_t *ipv6_dst; /* destination address */
+ string ipv6_saddr; /* source address, string */
+ string ipv6_daddr; /* destination address, string */
+ struct ip6_hdr *ipv6_hdr; /* pointer to raw header */
+} ipv6info_t;
+
+#pragma D binding "1.0" IPPROTO_IP
+inline short IPPROTO_IP = 0;
+#pragma D binding "1.0" IPPROTO_ICMP
+inline short IPPROTO_ICMP = 1;
+#pragma D binding "1.0" IPPROTO_IGMP
+inline short IPPROTO_IGMP = 2;
+#pragma D binding "1.0" IPPROTO_IPV4
+inline short IPPROTO_IPV4 = 4;
+#pragma D binding "1.0" IPPROTO_TCP
+inline short IPPROTO_TCP = 6;
+#pragma D binding "1.0" IPPROTO_UDP
+inline short IPPROTO_UDP = 17;
+#pragma D binding "1.0" IPPROTO_IPV6
+inline short IPPROTO_IPV6 = 41;
+#pragma D binding "1.0" IPPROTO_ROUTING
+inline short IPPROTO_ROUTING = 43;
+#pragma D binding "1.0" IPPROTO_FRAGMENT
+inline short IPPROTO_FRAGMENT = 44;
+#pragma D binding "1.0" IPPROTO_RSVP
+inline short IPPROTO_RSVP = 46;
+#pragma D binding "1.0" IPPROTO_GRE
+inline short IPPROTO_GRE = 47;
+#pragma D binding "1.0" IPPROTO_ESP
+inline short IPPROTO_ESP = 50;
+#pragma D binding "1.0" IPPROTO_AH
+inline short IPPROTO_AH = 51;
+#pragma D binding "1.0" IPPROTO_MOBILE
+inline short IPPROTO_MOBILE = 55;
+#pragma D binding "1.0" IPPROTO_ICMPV6
+inline short IPPROTO_ICMPV6 = 58;
+#pragma D binding "1.0" IPPROTO_DSTOPTS
+inline short IPPROTO_DSTOPTS = 60;
+#pragma D binding "1.0" IPPROTO_ETHERIP
+inline short IPPROTO_ETHERIP = 97;
+#pragma D binding "1.0" IPPROTO_PIM
+inline short IPPROTO_PIM = 103;
+#pragma D binding "1.0" IPPROTO_IPCOMP
+inline short IPPROTO_IPCOMP = 108;
+#pragma D binding "1.0" IPPROTO_SCTP
+inline short IPPROTO_SCTP = 132;
+#pragma D binding "1.0" IPPROTO_RAW
+inline short IPPROTO_RAW = 255;
+
+inline uint8_t INP_IPV4 = 0x01;
+inline uint8_t INP_IPV6 = 0x02;
+
+#pragma D binding "1.0" protocols
+inline string protocols[int proto] =
+ proto == IPPROTO_IP ? "IP" :
+ proto == IPPROTO_ICMP ? "ICMP" :
+ proto == IPPROTO_IGMP ? "IGMP" :
+ proto == IPPROTO_IPV4 ? "IPV4" :
+ proto == IPPROTO_TCP ? "TCP" :
+ proto == IPPROTO_UDP ? "UDP" :
+ proto == IPPROTO_IPV6 ? "IPV6" :
+ proto == IPPROTO_ROUTING ? "ROUTING" :
+ proto == IPPROTO_FRAGMENT ? "FRAGMENT" :
+ proto == IPPROTO_RSVP ? "RSVP" :
+ proto == IPPROTO_GRE ? "GRE" :
+ proto == IPPROTO_ESP ? "ESP" :
+ proto == IPPROTO_AH ? "AH" :
+ proto == IPPROTO_MOBILE ? "MOBILE" :
+ proto == IPPROTO_ICMPV6 ? "ICMPV6" :
+ proto == IPPROTO_DSTOPTS ? "DSTOPTS" :
+ proto == IPPROTO_ETHERIP ? "ETHERIP" :
+ proto == IPPROTO_PIM ? "PIM" :
+ proto == IPPROTO_IPCOMP ? "IPCOMP" :
+ proto == IPPROTO_SCTP ? "SCTP" :
+ proto == IPPROTO_RAW ? "RAW" :
+ "<unknown>";
+
+/*
+ * This field is always NULL according to the current definition of the ip
+ * probes.
+ */
+#pragma D binding "1.0" translator
+translator pktinfo_t < void *p > {
+ pkt_addr = NULL;
+};
+
+#pragma D binding "1.0" translator
+translator csinfo_t < void *p > {
+ cs_addr = NULL;
+ cs_cid = (uint64_t)p;
+ cs_pid = 0;
+ cs_zoneid = 0;
+};
+
+#pragma D binding "1.0" translator
+translator csinfo_t < struct inpcb *p > {
+ cs_addr = NULL;
+ cs_cid = (uint64_t)p;
+ cs_pid = 0; /* XXX */
+ cs_zoneid = 0;
+};
+
+#pragma D binding "1.0" translator
+translator ipinfo_t < uint8_t *p > {
+ ip_ver = p == NULL ? 0 : ((struct ip *)p)->ip_v;
+ ip_plength = p == NULL ? 0 :
+ ((struct ip *)p)->ip_v == 4 ?
+ ntohs(((struct ip *)p)->ip_len) - (((struct ip *)p)->ip_hl << 2):
+ ntohs(((struct ip6_hdr *)p)->ip6_ctlun.ip6_un1.ip6_un1_plen);
+ ip_saddr = p == NULL ? 0 :
+ ((struct ip *)p)->ip_v == 4 ?
+ inet_ntoa(&((struct ip *)p)->ip_src.s_addr) :
+ inet_ntoa6(&((struct ip6_hdr *)p)->ip6_src);
+ ip_daddr = p == NULL ? 0 :
+ ((struct ip *)p)->ip_v == 4 ?
+ inet_ntoa(&((struct ip *)p)->ip_dst.s_addr) :
+ inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
+};
+
+#pragma D binding "1.0" IFF_LOOPBACK
+inline int IFF_LOOPBACK = 0x8;
+
+#pragma D binding "1.0" translator
+translator ifinfo_t < struct ifnet *p > {
+ if_name = p->if_xname;
+ if_local = (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
+ if_addr = (uintptr_t)p;
+};
+
+#pragma D binding "1.0" translator
+translator ipv4info_t < struct ip *p > {
+ ipv4_ver = p == NULL ? 0 : p->ip_v;
+ ipv4_ihl = p == NULL ? 0 : p->ip_hl;
+ ipv4_tos = p == NULL ? 0 : p->ip_tos;
+ ipv4_length = p == NULL ? 0 : ntohs(p->ip_len);
+ ipv4_ident = p == NULL ? 0 : ntohs(p->ip_id);
+ ipv4_flags = p == NULL ? 0 : (p->ip_off & 0xe000);
+ ipv4_offset = p == NULL ? 0 : p->ip_off;
+ ipv4_ttl = p == NULL ? 0 : p->ip_ttl;
+ ipv4_protocol = p == NULL ? 0 : p->ip_p;
+ ipv4_protostr = p == NULL ? "<null>" : protocols[p->ip_p];
+ ipv4_checksum = p == NULL ? 0 : ntohs(p->ip_sum);
+ ipv4_src = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_src.s_addr);
+ ipv4_dst = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_dst.s_addr);
+ ipv4_saddr = p == NULL ? 0 : inet_ntoa(&p->ip_src.s_addr);
+ ipv4_daddr = p == NULL ? 0 : inet_ntoa(&p->ip_dst.s_addr);
+ ipv4_hdr = (ipha_t *)p;
+};
+
+#pragma D binding "1.0" translator
+translator ipv6info_t < struct ip6_hdr *p > {
+ ipv6_ver = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0xf0000000) >> 28;
+ ipv6_tclass = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x0ff00000) >> 20;
+ ipv6_flow = p == NULL ? 0 : ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x000fffff;
+ ipv6_plen = p == NULL ? 0 : ntohs(p->ip6_ctlun.ip6_un1.ip6_un1_plen);
+ ipv6_nexthdr = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_nxt;
+ ipv6_nextstr = p == NULL ? "<null>" : protocols[p->ip6_ctlun.ip6_un1.ip6_un1_nxt];
+ ipv6_hlim = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_hlim;
+ ipv6_src = p == NULL ? 0 : (in6_addr_t *)&p->ip6_src;
+ ipv6_dst = p == NULL ? 0 : (in6_addr_t *)&p->ip6_dst;
+ ipv6_saddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_src);
+ ipv6_daddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_dst);
+ ipv6_hdr = p;
+};
Property changes on: trunk/cddl/lib/libdtrace/ip.d
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/libproc_compat.h
===================================================================
--- trunk/cddl/lib/libdtrace/libproc_compat.h 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/libproc_compat.h 2018-06-02 15:58:17 UTC (rev 10224)
@@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/libproc_compat.h 211554 2010-08-21 11:50:53Z rpaulo $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/libproc_compat.h 268578 2014-07-12 22:56:41Z rpaulo $
*/
/*
@@ -46,8 +46,10 @@
#define Pgrab_error strerror
#define Plmid_to_map(p, l, o) proc_obj2map((p), (o))
#define Plookup_by_addr proc_addr2sym
+#define Pname_to_ctf(p, obj) NULL
#define Pname_to_map proc_name2map
#define Pobject_iter proc_iter_objs
+#define Pobject_iter_resolved(p, f, arg) 1
#define Pobjname proc_objname
#define Pread proc_read
#define Prd_agent proc_rdagent
Modified: trunk/cddl/lib/libdtrace/net.d
===================================================================
--- trunk/cddl/lib/libdtrace/net.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/net.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -20,7 +21,7 @@
*
* Portions Copyright 2006-2008 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/net.d 179189 2008-05-22 04:26:42Z jb $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/net.d 179189 2008-05-22 04:26:42Z jb $
*/
/*
Property changes on: trunk/cddl/lib/libdtrace/net.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/nfs.d
===================================================================
--- trunk/cddl/lib/libdtrace/nfs.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/nfs.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -20,7 +21,7 @@
*
* Portions Copyright 2006-2008 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/nfs.d 250486 2013-05-10 21:39:41Z pfg $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/nfs.d 249600 2013-04-18 01:20:08Z pfg $
*/
/*
Property changes on: trunk/cddl/lib/libdtrace/nfs.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/nfssrv.d
===================================================================
--- trunk/cddl/lib/libdtrace/nfssrv.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/nfssrv.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -20,7 +21,7 @@
*
* Portions Copyright 2006-2008 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/nfssrv.d 250486 2013-05-10 21:39:41Z pfg $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/nfssrv.d 249600 2013-04-18 01:20:08Z pfg $
*/
/*
Modified: trunk/cddl/lib/libdtrace/psinfo.d
===================================================================
--- trunk/cddl/lib/libdtrace/psinfo.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/psinfo.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -21,7 +22,7 @@
*
* Portions Copyright 2006 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/psinfo.d 179189 2008-05-22 04:26:42Z jb $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/psinfo.d 305748 2016-09-12 17:05:42Z gnn $
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
@@ -42,6 +43,7 @@
pr_addr; /* address of process */
string pr_psargs; /* process arguments */
u_int pr_arglen; /* process argument length */
+ u_int pr_jailid; /* jail id */
} psinfo_t;
#pragma D binding "1.0" translator
@@ -56,8 +58,10 @@
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_addr = 0;
- pr_psargs = stringof(T->p_args->ar_args);
+ pr_psargs = (T->p_args == 0) ? "" :
+ memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
pr_arglen = T->p_args->ar_length;
+ pr_jailid = T->p_ucred->cr_prison->pr_id;
};
typedef struct lwpsinfo {
Property changes on: trunk/cddl/lib/libdtrace/psinfo.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/regs_x86.d
===================================================================
--- trunk/cddl/lib/libdtrace/regs_x86.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/regs_x86.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -21,7 +22,7 @@
*
* Portions Copyright 2009 Stacey Son sson at FreeBSD.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/regs_x86.d 211554 2010-08-21 11:50:53Z rpaulo $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/regs_x86.d 211554 2010-08-21 11:50:53Z rpaulo $
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Property changes on: trunk/cddl/lib/libdtrace/regs_x86.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/sched.d
===================================================================
--- trunk/cddl/lib/libdtrace/sched.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/sched.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -20,7 +21,7 @@
*
* Portions Copyright 2006-2008 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/sched.d 179189 2008-05-22 04:26:42Z jb $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/sched.d 179189 2008-05-22 04:26:42Z jb $
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
Property changes on: trunk/cddl/lib/libdtrace/sched.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/signal.d
===================================================================
--- trunk/cddl/lib/libdtrace/signal.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/signal.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -21,7 +22,7 @@
*
* Portions Copyright 2008 John Birrell jb at freebsd.org
*
- * $FreeBSD: release/9.2.0/cddl/lib/libdtrace/signal.d 179189 2008-05-22 04:26:42Z jb $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/signal.d 179189 2008-05-22 04:26:42Z jb $
*/
inline int SIGHUP = 1;
Property changes on: trunk/cddl/lib/libdtrace/signal.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/cddl/lib/libdtrace/tcp.d
===================================================================
--- trunk/cddl/lib/libdtrace/tcp.d (rev 0)
+++ trunk/cddl/lib/libdtrace/tcp.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -0,0 +1,244 @@
+/* $MidnightBSD$ */
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ *
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/tcp.d 282701 2015-05-09 22:59:11Z gnn $
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 Mark Johnston <markj at freebsd.org>
+ */
+
+#pragma D depends_on library ip.d
+#pragma D depends_on provider tcp
+
+/*
+ * Convert a TCP state value to a string.
+ */
+#pragma D binding "1.0" TCPS_CLOSED
+inline int TCPS_CLOSED = 0;
+#pragma D binding "1.0" TCPS_LISTEN
+inline int TCPS_LISTEN = 1;
+#pragma D binding "1.0" TCPS_SYN_SENT
+inline int TCPS_SYN_SENT = 2;
+#pragma D binding "1.0" TCPS_SYN_RECEIVED
+inline int TCPS_SYN_RECEIVED = 3;
+#pragma D binding "1.0" TCPS_ESTABLISHED
+inline int TCPS_ESTABLISHED = 4;
+#pragma D binding "1.0" TCPS_CLOSE_WAIT
+inline int TCPS_CLOSE_WAIT = 5;
+#pragma D binding "1.0" TCPS_FIN_WAIT_1
+inline int TCPS_FIN_WAIT_1 = 6;
+#pragma D binding "1.0" TCPS_CLOSING
+inline int TCPS_CLOSING = 7;
+#pragma D binding "1.0" TCPS_LAST_ACK
+inline int TCPS_LAST_ACK = 8;
+#pragma D binding "1.0" TCPS_FIN_WAIT_2
+inline int TCPS_FIN_WAIT_2 = 9;
+#pragma D binding "1.0" TCPS_TIME_WAIT
+inline int TCPS_TIME_WAIT = 10;
+
+/* TCP segment flags. */
+#pragma D binding "1.0" TH_FIN
+inline uint8_t TH_FIN = 0x01;
+#pragma D binding "1.0" TH_SYN
+inline uint8_t TH_SYN = 0x02;
+#pragma D binding "1.0" TH_RST
+inline uint8_t TH_RST = 0x04;
+#pragma D binding "1.0" TH_PUSH
+inline uint8_t TH_PUSH = 0x08;
+#pragma D binding "1.0" TH_ACK
+inline uint8_t TH_ACK = 0x10;
+#pragma D binding "1.0" TH_URG
+inline uint8_t TH_URG = 0x20;
+#pragma D binding "1.0" TH_ECE
+inline uint8_t TH_ECE = 0x40;
+#pragma D binding "1.0" TH_CWR
+inline uint8_t TH_CWR = 0x80;
+
+/* TCP connection state strings. */
+#pragma D binding "1.0" tcp_state_string
+inline string tcp_state_string[int32_t state] =
+ state == TCPS_CLOSED ? "state-closed" :
+ state == TCPS_LISTEN ? "state-listen" :
+ state == TCPS_SYN_SENT ? "state-syn-sent" :
+ state == TCPS_SYN_RECEIVED ? "state-syn-received" :
+ state == TCPS_ESTABLISHED ? "state-established" :
+ state == TCPS_CLOSE_WAIT ? "state-close-wait" :
+ state == TCPS_FIN_WAIT_1 ? "state-fin-wait-1" :
+ state == TCPS_CLOSING ? "state-closing" :
+ state == TCPS_LAST_ACK ? "state-last-ack" :
+ state == TCPS_FIN_WAIT_2 ? "state-fin-wait-2" :
+ state == TCPS_TIME_WAIT ? "state-time-wait" :
+ "<unknown>";
+
+/*
+ * tcpsinfo contains stable TCP details from tcp_t.
+ */
+typedef struct tcpsinfo {
+ uintptr_t tcps_addr;
+ int tcps_local; /* is delivered locally, boolean */
+ int tcps_active; /* active open (from here), boolean */
+ uint16_t tcps_lport; /* local port */
+ uint16_t tcps_rport; /* remote port */
+ string tcps_laddr; /* local address, as a string */
+ string tcps_raddr; /* remote address, as a string */
+ int32_t tcps_state; /* TCP state */
+ uint32_t tcps_iss; /* Initial sequence # sent */
+ uint32_t tcps_suna; /* sequence # sent but unacked */
+ uint32_t tcps_snxt; /* next sequence # to send */
+ uint32_t tcps_rack; /* sequence # we have acked */
+ uint32_t tcps_rnxt; /* next sequence # expected */
+ uint32_t tcps_swnd; /* send window size */
+ int32_t tcps_snd_ws; /* send window scaling */
+ uint32_t tcps_rwnd; /* receive window size */
+ int32_t tcps_rcv_ws; /* receive window scaling */
+ uint32_t tcps_cwnd; /* congestion window */
+ uint32_t tcps_cwnd_ssthresh; /* threshold for congestion avoidance */
+ uint32_t tcps_sack_fack; /* SACK sequence # we have acked */
+ uint32_t tcps_sack_snxt; /* next SACK seq # for retransmission */
+ uint32_t tcps_rto; /* round-trip timeout, msec */
+ uint32_t tcps_mss; /* max segment size */
+ int tcps_retransmit; /* retransmit send event, boolean */
+ int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
+} tcpsinfo_t;
+
+/*
+ * tcplsinfo provides the old tcp state for state changes.
+ */
+typedef struct tcplsinfo {
+ int32_t tcps_state; /* previous TCP state */
+} tcplsinfo_t;
+
+/*
+ * tcpinfo is the TCP header fields.
+ */
+typedef struct tcpinfo {
+ uint16_t tcp_sport; /* source port */
+ uint16_t tcp_dport; /* destination port */
+ uint32_t tcp_seq; /* sequence number */
+ uint32_t tcp_ack; /* acknowledgment number */
+ uint8_t tcp_offset; /* data offset, in bytes */
+ uint8_t tcp_flags; /* flags */
+ uint16_t tcp_window; /* window size */
+ uint16_t tcp_checksum; /* checksum */
+ uint16_t tcp_urgent; /* urgent data pointer */
+ struct tcphdr *tcp_hdr; /* raw TCP header */
+} tcpinfo_t;
+
+/*
+ * A clone of tcpinfo_t used to handle the fact that the TCP input path
+ * overwrites some fields of the TCP header with their host-order equivalents.
+ * Unfortunately, DTrace doesn't let us simply typedef a new name for struct
+ * tcpinfo and define a separate translator for it.
+ */
+typedef struct tcpinfoh {
+ uint16_t tcp_sport; /* source port */
+ uint16_t tcp_dport; /* destination port */
+ uint32_t tcp_seq; /* sequence number */
+ uint32_t tcp_ack; /* acknowledgment number */
+ uint8_t tcp_offset; /* data offset, in bytes */
+ uint8_t tcp_flags; /* flags */
+ uint16_t tcp_window; /* window size */
+ uint16_t tcp_checksum; /* checksum */
+ uint16_t tcp_urgent; /* urgent data pointer */
+ struct tcphdr *tcp_hdr; /* raw TCP header */
+} tcpinfoh_t;
+
+#pragma D binding "1.0" translator
+translator csinfo_t < struct tcpcb *p > {
+ cs_addr = NULL;
+ cs_cid = (uint64_t)(p == NULL ? 0 : p->t_inpcb);
+ cs_pid = 0;
+ cs_zoneid = 0;
+};
+
+#pragma D binding "1.0" translator
+translator tcpsinfo_t < struct tcpcb *p > {
+ tcps_addr = (uintptr_t)p;
+ tcps_local = -1; /* XXX */
+ tcps_active = -1; /* XXX */
+ tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_lport);
+ tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport);
+ tcps_laddr = p == NULL ? 0 :
+ p->t_inpcb->inp_vflag == INP_IPV4 ?
+ inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local);
+ tcps_raddr = p == NULL ? 0 :
+ p->t_inpcb->inp_vflag == INP_IPV4 ?
+ inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign);
+ tcps_state = p == NULL ? -1 : p->t_state;
+ tcps_iss = p == NULL ? 0 : p->iss;
+ tcps_suna = p == NULL ? 0 : p->snd_una;
+ tcps_snxt = p == NULL ? 0 : p->snd_nxt;
+ tcps_rack = p == NULL ? 0 : p->last_ack_sent;
+ tcps_rnxt = p == NULL ? 0 : p->rcv_nxt;
+ tcps_swnd = p == NULL ? -1 : p->snd_wnd;
+ tcps_snd_ws = p == NULL ? -1 : p->snd_scale;
+ tcps_rwnd = p == NULL ? -1 : p->rcv_wnd;
+ tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale;
+ tcps_cwnd = p == NULL ? -1 : p->snd_cwnd;
+ tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh;
+ tcps_sack_fack = p == NULL ? 0 : p->snd_fack;
+ tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata;
+ tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz;
+ tcps_mss = p == NULL ? -1 : p->t_maxseg;
+ tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
+ tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
+};
+
+#pragma D binding "1.0" translator
+translator tcpinfo_t < struct tcphdr *p > {
+ tcp_sport = p == NULL ? 0 : ntohs(p->th_sport);
+ tcp_dport = p == NULL ? 0 : ntohs(p->th_dport);
+ tcp_seq = p == NULL ? -1 : ntohl(p->th_seq);
+ tcp_ack = p == NULL ? -1 : ntohl(p->th_ack);
+ tcp_offset = p == NULL ? -1 : (p->th_off >> 2);
+ tcp_flags = p == NULL ? 0 : p->th_flags;
+ tcp_window = p == NULL ? 0 : ntohs(p->th_win);
+ tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum);
+ tcp_urgent = p == NULL ? 0 : ntohs(p->th_urp);
+ tcp_hdr = (struct tcphdr *)p;
+};
+
+/*
+ * This translator differs from the one for tcpinfo_t in that the sequence
+ * number, acknowledgement number, window size and urgent pointer are already
+ * in host order and thus don't need to be converted.
+ */
+#pragma D binding "1.0" translator
+translator tcpinfoh_t < struct tcphdr *p > {
+ tcp_sport = p == NULL ? 0 : ntohs(p->th_sport);
+ tcp_dport = p == NULL ? 0 : ntohs(p->th_dport);
+ tcp_seq = p == NULL ? -1 : p->th_seq;
+ tcp_ack = p == NULL ? -1 : p->th_ack;
+ tcp_offset = p == NULL ? -1 : (p->th_off >> 2);
+ tcp_flags = p == NULL ? 0 : p->th_flags;
+ tcp_window = p == NULL ? 0 : (p->th_win);
+ tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum);
+ tcp_urgent = p == NULL ? 0 : p->th_urp;
+ tcp_hdr = (struct tcphdr *)p;
+};
+
+#pragma D binding "1.0" translator
+translator tcplsinfo_t < int s > {
+ tcps_state = s;
+};
Property changes on: trunk/cddl/lib/libdtrace/tcp.d
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/cddl/lib/libdtrace/udp.d
===================================================================
--- trunk/cddl/lib/libdtrace/udp.d (rev 0)
+++ trunk/cddl/lib/libdtrace/udp.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -0,0 +1,76 @@
+/* $MidnightBSD$ */
+/*
+ * CDDL HEADER START
+ *
+ * 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]
+ *
+ * CDDL HEADER END
+ *
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/udp.d 254889 2013-08-25 21:54:41Z markj $
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013 Mark Johnston <markj at FreeBSD.org>
+ */
+
+#pragma D depends_on library ip.d
+#pragma D depends_on provider udp
+
+/*
+ * udpsinfo contains stable UDP details.
+ */
+typedef struct udpsinfo {
+ uintptr_t udps_addr;
+ uint16_t udps_lport; /* local port */
+ uint16_t udps_rport; /* remote port */
+ string udps_laddr; /* local address, as a string */
+ string udps_raddr; /* remote address, as a string */
+} udpsinfo_t;
+
+/*
+ * udpinfo is the UDP header fields.
+ */
+typedef struct udpinfo {
+ uint16_t udp_sport; /* source port */
+ uint16_t udp_dport; /* destination port */
+ uint16_t udp_length; /* total length */
+ uint16_t udp_checksum; /* headers + data checksum */
+ struct udphdr *udp_hdr; /* raw UDP header */
+} udpinfo_t;
+
+#pragma D binding "1.0" translator
+translator udpsinfo_t < struct inpcb *p > {
+ udps_addr = (uintptr_t)p;
+ udps_lport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_lport);
+ udps_rport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_fport);
+ udps_laddr = p == NULL ? "" :
+ p->inp_vflag == INP_IPV4 ?
+ inet_ntoa(&p->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->inp_inc.inc_ie.ie_dependladdr.ie6_local);
+ udps_raddr = p == NULL ? "" :
+ p->inp_vflag == INP_IPV4 ?
+ inet_ntoa(&p->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr) :
+ inet_ntoa6(&p->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign);
+};
+
+#pragma D binding "1.0" translator
+translator udpinfo_t < struct udphdr *p > {
+ udp_sport = p == NULL ? 0 : ntohs(p->uh_sport);
+ udp_dport = p == NULL ? 0 : ntohs(p->uh_dport);
+ udp_length = p == NULL ? 0 : ntohs(p->uh_ulen);
+ udp_checksum = p == NULL ? 0 : ntohs(p->uh_sum);
+ udp_hdr = p;
+};
Property changes on: trunk/cddl/lib/libdtrace/udp.d
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/cddl/lib/libdtrace/unistd.d
===================================================================
--- trunk/cddl/lib/libdtrace/unistd.d 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libdtrace/unistd.d 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* CDDL HEADER START
*
@@ -18,7 +19,7 @@
*
* CDDL HEADER END
*
- * $FreeBSD: src/cddl/lib/libdtrace/unistd.d,v 1.1.2.1.2.1 2008/11/25 02:59:29 kensmith Exp $
+ * $FreeBSD: stable/10/cddl/lib/libdtrace/unistd.d 179189 2008-05-22 04:26:42Z jb $
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
Property changes on: trunk/cddl/lib/libdtrace/unistd.d
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/cddl/lib/libnvpair/Makefile
===================================================================
--- trunk/cddl/lib/libnvpair/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libnvpair/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,25 +1,35 @@
# $MidnightBSD$
-# $FreeBSD: src/cddl/lib/libnvpair/Makefile,v 1.2 2007/04/16 21:20:25 ru Exp $
+# $FreeBSD: stable/10/cddl/lib/libnvpair/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/nvpair
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/nvpair
LIB= nvpair
SRCS= libnvpair.c \
nvpair_alloc_system.c \
- nvpair_alloc_fixed.c \
- nvpair.c \
- fnvpair.c
+ nvpair_json.c \
+ opensolaris_fnvpair.c \
+ opensolaris_nvpair.c \
+ opensolaris_nvpair_alloc_fixed.c
-WARNS?= 0
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
+WARNS?= 1
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
+# This library uses macros to define fprintf behavior for several object types
+# The compiler will see the non-string literal arguments to the fprintf calls and
+# omit warnings for them. Quiesce these warnings in contrib code:
+#
+# cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c:743:12: warning: format
+# string is not a string literal (potentially insecure) [-Wformat-security]
+# ARENDER(pctl, nvlist_array, nvl, name, val, nelem);
+#
+CFLAGS+= -Wno-format-security
.include <bsd.lib.mk>
Modified: trunk/cddl/lib/libumem/Makefile
===================================================================
--- trunk/cddl/lib/libumem/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libumem/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,11 +1,11 @@
-# $MidnightBSD: src/cddl/lib/libumem/Makefile,v 1.2 2008/10/15 19:10:19 laffer1 Exp $
-# $FreeBSD: src/cddl/lib/libumem/Makefile,v 1.2 2007/04/16 21:20:25 ru Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libumem/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
+.PATH: ${SRCTOP}/cddl/compat/opensolaris/lib/libumem
LIB= umem
SRCS= umem.c
-WARNS?= 0
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
+WARNS?= 3
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
.include <bsd.lib.mk>
Modified: trunk/cddl/lib/libuutil/Makefile
===================================================================
--- trunk/cddl/lib/libuutil/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libuutil/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,8 +1,8 @@
-# $MidnightBSD: src/cddl/lib/libuutil/Makefile,v 1.2 2008/10/15 19:10:20 laffer1 Exp $
-# $FreeBSD: src/cddl/lib/libuutil/Makefile,v 1.2 2007/04/16 21:20:25 ru Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libuutil/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/avl
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/avl
LIB= uutil
SRCS= avl.c \
@@ -16,12 +16,12 @@
uu_pname.c \
uu_strtoint.c
-WARNS?= 0
+WARNS?= 1
CFLAGS+= -DNATIVE_BUILD
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
.include <bsd.lib.mk>
Modified: trunk/cddl/lib/libzfs/Makefile
===================================================================
--- trunk/cddl/lib/libzfs/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzfs/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,22 +1,30 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libzfs/Makefile 325915 2017-11-16 23:36:19Z avg $
-.PATH: ${.CURDIR}/../../../cddl/compat/opensolaris/misc
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+.PATH: ${SRCTOP}/cddl/compat/opensolaris/misc
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils/common
LIB= zfs
DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} \
- ${LIBZFS_CORE}
-LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lzfs_core
+ ${LIBAVL} ${LIBZFS_CORE} ${LIBUUTIL} ${LIBBSDXML} ${LIBGEOM} \
+ ${LIBNVPAIR} ${LIBZ}
+LDADD= -lmd -lpthread -lumem -lutil -luutil -lm -lnvpair -lavl \
+ -lbsdxml -lgeom -lnvpair -lz -lzfs_core
+
SRCS= deviceid.c \
fsshare.c \
mkdirp.c \
mnttab.c \
+ thread_pool.c \
zmount.c \
zone.c
+SRCS+= nicenum.c
+
SRCS+= libzfs_changelist.c \
libzfs_compat.c \
libzfs_config.c \
@@ -33,7 +41,6 @@
zfs_comutil.c \
zfs_deleg.c \
zfs_fletcher.c \
- zfs_ioctl_compat.c \
zfs_namecheck.c \
zfs_prop.c \
zpool_prop.c \
@@ -42,20 +49,20 @@
WARNS?= 0
CSTD= c99
CFLAGS+= -DZFS_NO_ACL
-CFLAGS+= -I${.CURDIR}/../../../sbin/mount
-CFLAGS+= -I${.CURDIR}/../../../cddl/lib/libumem
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
+CFLAGS+= -I${SRCTOP}/sbin/mount
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils
.include <bsd.lib.mk>
Modified: trunk/cddl/lib/libzfs_core/Makefile
===================================================================
--- trunk/cddl/lib/libzfs_core/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzfs_core/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,10 +1,11 @@
-# $FreeBSD: release/9.2.0/cddl/lib/libzfs_core/Makefile 248461 2013-03-18 09:32:29Z mm $
+# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libzfs_core/Makefile 321270 2017-07-20 01:01:16Z ngie $
-.PATH: ${.CURDIR}/../../../cddl/compat/opensolaris/misc
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+.PATH: ${SRCTOP}/cddl/compat/opensolaris/misc
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
LIB= zfs_core
DPADD= ${LIBNVPAIR}
@@ -11,7 +12,8 @@
LDADD= -lnvpair
SRCS= libzfs_core.c \
- libzfs_core_compat.c
+ libzfs_core_compat.c \
+ zfs_ioctl_compat.c
SRCS+= libzfs_compat.c
@@ -18,20 +20,19 @@
WARNS?= 0
CSTD= c99
CFLAGS+= -DZFS_NO_ACL
-CFLAGS+= -I${.CURDIR}/../../../sbin/mount
-CFLAGS+= -I${.CURDIR}/../../../cddl/lib/libumem
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include
-CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
-CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+= -I${SRCTOP}/sbin/mount
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
.include <bsd.lib.mk>
Deleted: trunk/cddl/lib/libzfs_core/libzfs_core.c
===================================================================
--- trunk/cddl/lib/libzfs_core/libzfs_core.c 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzfs_core/libzfs_core.c 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,618 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * 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]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2012 by Delphix. All rights reserved.
- */
-
-/*
- * LibZFS_Core (lzc) is intended to replace most functionality in libzfs.
- * It has the following characteristics:
- *
- * - Thread Safe. libzfs_core is accessible concurrently from multiple
- * threads. This is accomplished primarily by avoiding global data
- * (e.g. caching). Since it's thread-safe, there is no reason for a
- * process to have multiple libzfs "instances". Therefore, we store
- * our few pieces of data (e.g. the file descriptor) in global
- * variables. The fd is reference-counted so that the libzfs_core
- * library can be "initialized" multiple times (e.g. by different
- * consumers within the same process).
- *
- * - Committed Interface. The libzfs_core interface will be committed,
- * therefore consumers can compile against it and be confident that
- * their code will continue to work on future releases of this code.
- * Currently, the interface is Evolving (not Committed), but we intend
- * to commit to it once it is more complete and we determine that it
- * meets the needs of all consumers.
- *
- * - Programatic Error Handling. libzfs_core communicates errors with
- * defined error numbers, and doesn't print anything to stdout/stderr.
- *
- * - Thin Layer. libzfs_core is a thin layer, marshaling arguments
- * to/from the kernel ioctls. There is generally a 1:1 correspondence
- * between libzfs_core functions and ioctls to /dev/zfs.
- *
- * - Clear Atomicity. Because libzfs_core functions are generally 1:1
- * with kernel ioctls, and kernel ioctls are general atomic, each
- * libzfs_core function is atomic. For example, creating multiple
- * snapshots with a single call to lzc_snapshot() is atomic -- it
- * can't fail with only some of the requested snapshots created, even
- * in the event of power loss or system crash.
- *
- * - Continued libzfs Support. Some higher-level operations (e.g.
- * support for "zfs send -R") are too complicated to fit the scope of
- * libzfs_core. This functionality will continue to live in libzfs.
- * Where appropriate, libzfs will use the underlying atomic operations
- * of libzfs_core. For example, libzfs may implement "zfs send -R |
- * zfs receive" by using individual "send one snapshot", rename,
- * destroy, and "receive one snapshot" operations in libzfs_core.
- * /sbin/zfs and /zbin/zpool will link with both libzfs and
- * libzfs_core. Other consumers should aim to use only libzfs_core,
- * since that will be the supported, stable interface going forwards.
- */
-
-#define _IN_LIBZFS_CORE_
-
-#include <libzfs_core.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <sys/nvpair.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/zfs_ioctl.h>
-#include "libzfs_core_compat.h"
-#include "libzfs_compat.h"
-
-#ifdef __FreeBSD__
-extern int zfs_ioctl_version;
-#endif
-
-static int g_fd;
-static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
-static int g_refcount;
-
-int
-libzfs_core_init(void)
-{
- (void) pthread_mutex_lock(&g_lock);
- if (g_refcount == 0) {
- g_fd = open("/dev/zfs", O_RDWR);
- if (g_fd < 0) {
- (void) pthread_mutex_unlock(&g_lock);
- return (errno);
- }
- }
- g_refcount++;
- (void) pthread_mutex_unlock(&g_lock);
-
- return (0);
-}
-
-void
-libzfs_core_fini(void)
-{
- (void) pthread_mutex_lock(&g_lock);
- ASSERT3S(g_refcount, >, 0);
- g_refcount--;
- if (g_refcount == 0)
- (void) close(g_fd);
- (void) pthread_mutex_unlock(&g_lock);
-}
-
-static int
-lzc_ioctl(zfs_ioc_t ioc, const char *name,
- nvlist_t *source, nvlist_t **resultp)
-{
- zfs_cmd_t zc = { 0 };
- int error = 0;
- char *packed;
-#ifdef __FreeBSD__
- nvlist_t *oldsource;
-#endif
- size_t size;
-
- ASSERT3S(g_refcount, >, 0);
-
- (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name));
-
-#ifdef __FreeBSD__
- if (zfs_ioctl_version == ZFS_IOCVER_UNDEF)
- zfs_ioctl_version = get_zfs_ioctl_version();
-
- if (zfs_ioctl_version < ZFS_IOCVER_LZC) {
- oldsource = source;
- error = lzc_compat_pre(&zc, &ioc, &source);
- if (error)
- return (error);
- }
-#endif
-
- packed = fnvlist_pack(source, &size);
- zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed;
- zc.zc_nvlist_src_size = size;
-
- if (resultp != NULL) {
- *resultp = NULL;
- zc.zc_nvlist_dst_size = MAX(size * 2, 128 * 1024);
- zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
- malloc(zc.zc_nvlist_dst_size);
-#ifdef illumos
- if (zc.zc_nvlist_dst == NULL) {
-#else
- if (zc.zc_nvlist_dst == 0) {
-#endif
- error = ENOMEM;
- goto out;
- }
- }
-
- while (ioctl(g_fd, ioc, &zc) != 0) {
- if (errno == ENOMEM && resultp != NULL) {
- free((void *)(uintptr_t)zc.zc_nvlist_dst);
- zc.zc_nvlist_dst_size *= 2;
- zc.zc_nvlist_dst = (uint64_t)(uintptr_t)
- malloc(zc.zc_nvlist_dst_size);
-#ifdef illumos
- if (zc.zc_nvlist_dst == NULL) {
-#else
- if (zc.zc_nvlist_dst == 0) {
-#endif
- error = ENOMEM;
- goto out;
- }
- } else {
- error = errno;
- break;
- }
- }
-
-#ifdef __FreeBSD__
- if (zfs_ioctl_version < ZFS_IOCVER_LZC)
- lzc_compat_post(&zc, ioc);
-#endif
- if (zc.zc_nvlist_dst_filled) {
- *resultp = fnvlist_unpack((void *)(uintptr_t)zc.zc_nvlist_dst,
- zc.zc_nvlist_dst_size);
- }
-#ifdef __FreeBSD__
- if (zfs_ioctl_version < ZFS_IOCVER_LZC)
- lzc_compat_outnvl(&zc, ioc, resultp);
-#endif
-out:
-#ifdef __FreeBSD__
- if (zfs_ioctl_version < ZFS_IOCVER_LZC) {
- if (source != oldsource)
- nvlist_free(source);
- source = oldsource;
- }
-#endif
- fnvlist_pack_free(packed, size);
- free((void *)(uintptr_t)zc.zc_nvlist_dst);
- return (error);
-}
-
-int
-lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props)
-{
- int error;
- nvlist_t *args = fnvlist_alloc();
- fnvlist_add_int32(args, "type", type);
- if (props != NULL)
- fnvlist_add_nvlist(args, "props", props);
- error = lzc_ioctl(ZFS_IOC_CREATE, fsname, args, NULL);
- nvlist_free(args);
- return (error);
-}
-
-int
-lzc_clone(const char *fsname, const char *origin,
- nvlist_t *props)
-{
- int error;
- nvlist_t *args = fnvlist_alloc();
- fnvlist_add_string(args, "origin", origin);
- if (props != NULL)
- fnvlist_add_nvlist(args, "props", props);
- error = lzc_ioctl(ZFS_IOC_CLONE, fsname, args, NULL);
- nvlist_free(args);
- return (error);
-}
-
-/*
- * Creates snapshots.
- *
- * The keys in the snaps nvlist are the snapshots to be created.
- * They must all be in the same pool.
- *
- * The props nvlist is properties to set. Currently only user properties
- * are supported. { user:prop_name -> string value }
- *
- * The returned results nvlist will have an entry for each snapshot that failed.
- * The value will be the (int32) error code.
- *
- * The return value will be 0 if all snapshots were created, otherwise it will
- * be the errno of a (unspecified) snapshot that failed.
- */
-int
-lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist)
-{
- nvpair_t *elem;
- nvlist_t *args;
- int error;
- char pool[MAXNAMELEN];
-
- *errlist = NULL;
-
- /* determine the pool name */
- elem = nvlist_next_nvpair(snaps, NULL);
- if (elem == NULL)
- return (0);
- (void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
- pool[strcspn(pool, "/@")] = '\0';
-
- args = fnvlist_alloc();
- fnvlist_add_nvlist(args, "snaps", snaps);
- if (props != NULL)
- fnvlist_add_nvlist(args, "props", props);
-
- error = lzc_ioctl(ZFS_IOC_SNAPSHOT, pool, args, errlist);
- nvlist_free(args);
-
- return (error);
-}
-
-/*
- * Destroys snapshots.
- *
- * The keys in the snaps nvlist are the snapshots to be destroyed.
- * They must all be in the same pool.
- *
- * Snapshots that do not exist will be silently ignored.
- *
- * If 'defer' is not set, and a snapshot has user holds or clones, the
- * destroy operation will fail and none of the snapshots will be
- * destroyed.
- *
- * If 'defer' is set, and a snapshot has user holds or clones, it will be
- * marked for deferred destruction, and will be destroyed when the last hold
- * or clone is removed/destroyed.
- *
- * The return value will be 0 if all snapshots were destroyed (or marked for
- * later destruction if 'defer' is set) or didn't exist to begin with.
- *
- * Otherwise the return value will be the errno of a (unspecified) snapshot
- * that failed, no snapshots will be destroyed, and the errlist will have an
- * entry for each snapshot that failed. The value in the errlist will be
- * the (int32) error code.
- */
-int
-lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist)
-{
- nvpair_t *elem;
- nvlist_t *args;
- int error;
- char pool[MAXNAMELEN];
-
- /* determine the pool name */
- elem = nvlist_next_nvpair(snaps, NULL);
- if (elem == NULL)
- return (0);
- (void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
- pool[strcspn(pool, "/@")] = '\0';
-
- args = fnvlist_alloc();
- fnvlist_add_nvlist(args, "snaps", snaps);
- if (defer)
- fnvlist_add_boolean(args, "defer");
-
- error = lzc_ioctl(ZFS_IOC_DESTROY_SNAPS, pool, args, errlist);
- nvlist_free(args);
-
- return (error);
-
-}
-
-int
-lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
- uint64_t *usedp)
-{
- nvlist_t *args;
- nvlist_t *result;
- int err;
- char fs[MAXNAMELEN];
- char *atp;
-
- /* determine the fs name */
- (void) strlcpy(fs, firstsnap, sizeof (fs));
- atp = strchr(fs, '@');
- if (atp == NULL)
- return (EINVAL);
- *atp = '\0';
-
- args = fnvlist_alloc();
- fnvlist_add_string(args, "firstsnap", firstsnap);
-
- err = lzc_ioctl(ZFS_IOC_SPACE_SNAPS, lastsnap, args, &result);
- nvlist_free(args);
- if (err == 0)
- *usedp = fnvlist_lookup_uint64(result, "used");
- fnvlist_free(result);
-
- return (err);
-}
-
-boolean_t
-lzc_exists(const char *dataset)
-{
- /*
- * The objset_stats ioctl is still legacy, so we need to construct our
- * own zfs_cmd_t rather than using zfsc_ioctl().
- */
- zfs_cmd_t zc = { 0 };
-
- (void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
- return (ioctl(g_fd, ZFS_IOC_OBJSET_STATS, &zc) == 0);
-}
-
-/*
- * Create "user holds" on snapshots. If there is a hold on a snapshot,
- * the snapshot can not be destroyed. (However, it can be marked for deletion
- * by lzc_destroy_snaps(defer=B_TRUE).)
- *
- * The keys in the nvlist are snapshot names.
- * The snapshots must all be in the same pool.
- * The value is the name of the hold (string type).
- *
- * If cleanup_fd is not -1, it must be the result of open("/dev/zfs", O_EXCL).
- * In this case, when the cleanup_fd is closed (including on process
- * termination), the holds will be released. If the system is shut down
- * uncleanly, the holds will be released when the pool is next opened
- * or imported.
- *
- * The return value will be 0 if all holds were created. Otherwise the return
- * value will be the errno of a (unspecified) hold that failed, no holds will
- * be created, and the errlist will have an entry for each hold that
- * failed (name = snapshot). The value in the errlist will be the error
- * code (int32).
- */
-int
-lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
-{
- char pool[MAXNAMELEN];
- nvlist_t *args;
- nvpair_t *elem;
- int error;
-
- /* determine the pool name */
- elem = nvlist_next_nvpair(holds, NULL);
- if (elem == NULL)
- return (0);
- (void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
- pool[strcspn(pool, "/@")] = '\0';
-
- args = fnvlist_alloc();
- fnvlist_add_nvlist(args, "holds", holds);
- if (cleanup_fd != -1)
- fnvlist_add_int32(args, "cleanup_fd", cleanup_fd);
-
- error = lzc_ioctl(ZFS_IOC_HOLD, pool, args, errlist);
- nvlist_free(args);
- return (error);
-}
-
-/*
- * Release "user holds" on snapshots. If the snapshot has been marked for
- * deferred destroy (by lzc_destroy_snaps(defer=B_TRUE)), it does not have
- * any clones, and all the user holds are removed, then the snapshot will be
- * destroyed.
- *
- * The keys in the nvlist are snapshot names.
- * The snapshots must all be in the same pool.
- * The value is a nvlist whose keys are the holds to remove.
- *
- * The return value will be 0 if all holds were removed.
- * Otherwise the return value will be the errno of a (unspecified) release
- * that failed, no holds will be released, and the errlist will have an
- * entry for each snapshot that has failed releases (name = snapshot).
- * The value in the errlist will be the error code (int32) of a failed release.
- */
-int
-lzc_release(nvlist_t *holds, nvlist_t **errlist)
-{
- char pool[MAXNAMELEN];
- nvpair_t *elem;
-
- /* determine the pool name */
- elem = nvlist_next_nvpair(holds, NULL);
- if (elem == NULL)
- return (0);
- (void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
- pool[strcspn(pool, "/@")] = '\0';
-
- return (lzc_ioctl(ZFS_IOC_RELEASE, pool, holds, errlist));
-}
-
-/*
- * Retrieve list of user holds on the specified snapshot.
- *
- * On success, *holdsp will be set to a nvlist which the caller must free.
- * The keys are the names of the holds, and the value is the creation time
- * of the hold (uint64) in seconds since the epoch.
- */
-int
-lzc_get_holds(const char *snapname, nvlist_t **holdsp)
-{
- int error;
- nvlist_t *innvl = fnvlist_alloc();
- error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp);
- fnvlist_free(innvl);
- return (error);
-}
-
-/*
- * If fromsnap is NULL, a full (non-incremental) stream will be sent.
- */
-int
-lzc_send(const char *snapname, const char *fromsnap, int fd)
-{
- nvlist_t *args;
- int err;
-
- args = fnvlist_alloc();
- fnvlist_add_int32(args, "fd", fd);
- if (fromsnap != NULL)
- fnvlist_add_string(args, "fromsnap", fromsnap);
- err = lzc_ioctl(ZFS_IOC_SEND_NEW, snapname, args, NULL);
- nvlist_free(args);
- return (err);
-}
-
-/*
- * If fromsnap is NULL, a full (non-incremental) stream will be estimated.
- */
-int
-lzc_send_space(const char *snapname, const char *fromsnap, uint64_t *spacep)
-{
- nvlist_t *args;
- nvlist_t *result;
- int err;
-
- args = fnvlist_alloc();
- if (fromsnap != NULL)
- fnvlist_add_string(args, "fromsnap", fromsnap);
- err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result);
- nvlist_free(args);
- if (err == 0)
- *spacep = fnvlist_lookup_uint64(result, "space");
- nvlist_free(result);
- return (err);
-}
-
-static int
-recv_read(int fd, void *buf, int ilen)
-{
- char *cp = buf;
- int rv;
- int len = ilen;
-
- do {
- rv = read(fd, cp, len);
- cp += rv;
- len -= rv;
- } while (rv > 0);
-
- if (rv < 0 || len != 0)
- return (EIO);
-
- return (0);
-}
-
-/*
- * The simplest receive case: receive from the specified fd, creating the
- * specified snapshot. Apply the specified properties a "received" properties
- * (which can be overridden by locally-set properties). If the stream is a
- * clone, its origin snapshot must be specified by 'origin'. The 'force'
- * flag will cause the target filesystem to be rolled back or destroyed if
- * necessary to receive.
- *
- * Return 0 on success or an errno on failure.
- *
- * Note: this interface does not work on dedup'd streams
- * (those with DMU_BACKUP_FEATURE_DEDUP).
- */
-int
-lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
- boolean_t force, int fd)
-{
- /*
- * The receive ioctl is still legacy, so we need to construct our own
- * zfs_cmd_t rather than using zfsc_ioctl().
- */
- zfs_cmd_t zc = { 0 };
- char *atp;
- char *packed = NULL;
- size_t size;
- dmu_replay_record_t drr;
- int error;
-
- ASSERT3S(g_refcount, >, 0);
-
- /* zc_name is name of containing filesystem */
- (void) strlcpy(zc.zc_name, snapname, sizeof (zc.zc_name));
- atp = strchr(zc.zc_name, '@');
- if (atp == NULL)
- return (EINVAL);
- *atp = '\0';
-
- /* if the fs does not exist, try its parent. */
- if (!lzc_exists(zc.zc_name)) {
- char *slashp = strrchr(zc.zc_name, '/');
- if (slashp == NULL)
- return (ENOENT);
- *slashp = '\0';
-
- }
-
- /* zc_value is full name of the snapshot to create */
- (void) strlcpy(zc.zc_value, snapname, sizeof (zc.zc_value));
-
- if (props != NULL) {
- /* zc_nvlist_src is props to set */
- packed = fnvlist_pack(props, &size);
- zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed;
- zc.zc_nvlist_src_size = size;
- }
-
- /* zc_string is name of clone origin (if DRR_FLAG_CLONE) */
- if (origin != NULL)
- (void) strlcpy(zc.zc_string, origin, sizeof (zc.zc_string));
-
- /* zc_begin_record is non-byteswapped BEGIN record */
- error = recv_read(fd, &drr, sizeof (drr));
- if (error != 0)
- goto out;
- zc.zc_begin_record = drr.drr_u.drr_begin;
-
- /* zc_cookie is fd to read from */
- zc.zc_cookie = fd;
-
- /* zc guid is force flag */
- zc.zc_guid = force;
-
- /* zc_cleanup_fd is unused */
- zc.zc_cleanup_fd = -1;
-
- error = ioctl(g_fd, ZFS_IOC_RECV, &zc);
- if (error != 0)
- error = errno;
-
-out:
- if (packed != NULL)
- fnvlist_pack_free(packed, size);
- free((void*)(uintptr_t)zc.zc_nvlist_dst);
- return (error);
-}
Deleted: trunk/cddl/lib/libzfs_core/libzfs_core.h
===================================================================
--- trunk/cddl/lib/libzfs_core/libzfs_core.h 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzfs_core/libzfs_core.h 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,67 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * 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]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2012 by Delphix. All rights reserved.
- * Copyright (c) 2013 by Martin Matuska <mm at FreeBSD.org>. All rights reserved.
- */
-
-#ifndef _LIBZFS_CORE_H
-#define _LIBZFS_CORE_H
-
-#include <libnvpair.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/fs/zfs.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int libzfs_core_init(void);
-void libzfs_core_fini(void);
-
-int lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist);
-int lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props);
-int lzc_clone(const char *fsname, const char *origin, nvlist_t *props);
-int lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist);
-
-int lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
- uint64_t *usedp);
-
-int lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist);
-int lzc_release(nvlist_t *holds, nvlist_t **errlist);
-int lzc_get_holds(const char *snapname, nvlist_t **holdsp);
-
-int lzc_send(const char *snapname, const char *fromsnap, int fd);
-int lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
- boolean_t force, int fd);
-int lzc_send_space(const char *snapname, const char *fromsnap,
- uint64_t *result);
-
-boolean_t lzc_exists(const char *dataset);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LIBZFS_CORE_H */
Deleted: trunk/cddl/lib/libzfs_core/libzfs_core_compat.c
===================================================================
--- trunk/cddl/lib/libzfs_core/libzfs_core_compat.c 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzfs_core/libzfs_core_compat.c 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,189 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * 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]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2013 Martin Matuska <mm at FreeBSD.org>. All rights reserved.
- */
-
-#include <sys/zfs_ioctl.h>
-#include <zfs_ioctl_compat.h>
-#include "libzfs_core_compat.h"
-
-extern int zfs_ioctl_version;
-
-int
-lzc_compat_pre(zfs_cmd_t *zc, zfs_ioc_t *ioc, nvlist_t **source)
-{
- nvlist_t *nvl = NULL;
- nvpair_t *pair, *hpair;
- char *buf, *val;
- zfs_ioc_t vecnum;
- uint32_t type32;
- int32_t cleanup_fd;
- int error = 0;
- int pos;
-
- if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
- return (0);
-
- vecnum = *ioc;
-
- switch (vecnum) {
- case ZFS_IOC_CREATE:
- type32 = fnvlist_lookup_int32(*source, "type");
- zc->zc_objset_type = (uint64_t)type32;
- nvlist_lookup_nvlist(*source, "props", &nvl);
- *source = nvl;
- break;
- case ZFS_IOC_CLONE:
- buf = fnvlist_lookup_string(*source, "origin");
- strlcpy(zc->zc_value, buf, MAXPATHLEN);
- nvlist_lookup_nvlist(*source, "props", &nvl);
- *ioc = ZFS_IOC_CREATE;
- *source = nvl;
- break;
- case ZFS_IOC_SNAPSHOT:
- nvl = fnvlist_lookup_nvlist(*source, "snaps");
- pair = nvlist_next_nvpair(nvl, NULL);
- if (pair != NULL) {
- buf = nvpair_name(pair);
- pos = strcspn(buf, "@");
- strlcpy(zc->zc_name, buf, pos + 1);
- strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
- } else
- error = EINVAL;
- /* old kernel cannot create multiple snapshots */
- if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
- error = EOPNOTSUPP;
- nvlist_free(nvl);
- nvl = NULL;
- nvlist_lookup_nvlist(*source, "props", &nvl);
- *source = nvl;
- break;
- case ZFS_IOC_SPACE_SNAPS:
- buf = fnvlist_lookup_string(*source, "firstsnap");
- strlcpy(zc->zc_value, buf, MAXPATHLEN);
- break;
- case ZFS_IOC_DESTROY_SNAPS:
- nvl = fnvlist_lookup_nvlist(*source, "snaps");
- pair = nvlist_next_nvpair(nvl, NULL);
- if (pair != NULL) {
- buf = nvpair_name(pair);
- pos = strcspn(buf, "@");
- strlcpy(zc->zc_name, buf, pos + 1);
- } else
- error = EINVAL;
- /* old kernel cannot atomically destroy multiple snaps */
- if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
- error = EOPNOTSUPP;
- *source = nvl;
- break;
- case ZFS_IOC_HOLD:
- nvl = fnvlist_lookup_nvlist(*source, "holds");
- pair = nvlist_next_nvpair(nvl, NULL);
- if (pair != NULL) {
- buf = nvpair_name(pair);
- pos = strcspn(buf, "@");
- strlcpy(zc->zc_name, buf, pos + 1);
- strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
- if (nvpair_value_string(pair, &val) == 0)
- strlcpy(zc->zc_string, val, MAXNAMELEN);
- else
- error = EINVAL;
- } else
- error = EINVAL;
- /* old kernel cannot atomically create multiple holds */
- if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
- error = EOPNOTSUPP;
- nvlist_free(nvl);
- if (nvlist_lookup_int32(*source, "cleanup_fd",
- &cleanup_fd) == 0)
- zc->zc_cleanup_fd = cleanup_fd;
- else
- zc->zc_cleanup_fd = -1;
- break;
- case ZFS_IOC_RELEASE:
- pair = nvlist_next_nvpair(*source, NULL);
- if (pair != NULL) {
- buf = nvpair_name(pair);
- pos = strcspn(buf, "@");
- strlcpy(zc->zc_name, buf, pos + 1);
- strlcpy(zc->zc_value, buf + pos + 1, MAXPATHLEN);
- if (nvpair_value_nvlist(pair, &nvl) == 0) {
- hpair = nvlist_next_nvpair(nvl, NULL);
- if (hpair != NULL)
- strlcpy(zc->zc_string,
- nvpair_name(hpair), MAXNAMELEN);
- else
- error = EINVAL;
- if (!error && nvlist_next_nvpair(nvl,
- hpair) != NULL)
- error = EOPNOTSUPP;
- } else
- error = EINVAL;
- } else
- error = EINVAL;
- /* old kernel cannot atomically release multiple holds */
- if (!error && nvlist_next_nvpair(nvl, pair) != NULL)
- error = EOPNOTSUPP;
- break;
- }
-
- return (error);
-}
-
-void
-lzc_compat_post(zfs_cmd_t *zc, const zfs_ioc_t ioc)
-{
- if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
- return;
-
- switch (ioc) {
- case ZFS_IOC_CREATE:
- case ZFS_IOC_CLONE:
- case ZFS_IOC_SNAPSHOT:
- case ZFS_IOC_SPACE_SNAPS:
- case ZFS_IOC_DESTROY_SNAPS:
- zc->zc_nvlist_dst_filled = B_FALSE;
- break;
- }
-}
-
-int
-lzc_compat_outnvl(zfs_cmd_t *zc, const zfs_ioc_t ioc, nvlist_t **outnvl)
-{
- nvlist_t *nvl;
-
- if (zfs_ioctl_version >= ZFS_IOCVER_LZC)
- return (0);
-
- switch (ioc) {
- case ZFS_IOC_SPACE_SNAPS:
- nvl = fnvlist_alloc();
- fnvlist_add_uint64(nvl, "used", zc->zc_cookie);
- fnvlist_add_uint64(nvl, "compressed", zc->zc_objset_type);
- fnvlist_add_uint64(nvl, "uncompressed", zc->zc_perm_action);
- *outnvl = nvl;
- break;
- }
-
- return (0);
-}
Deleted: trunk/cddl/lib/libzfs_core/libzfs_core_compat.h
===================================================================
--- trunk/cddl/lib/libzfs_core/libzfs_core_compat.h 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzfs_core/libzfs_core_compat.h 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * 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]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2013 by Martin Matuska <mm at FreeBSD.org>. All rights reserved.
- */
-
-#ifndef _LIBZFS_CORE_COMPAT_H
-#define _LIBZFS_CORE_COMPAT_H
-
-#include <libnvpair.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/fs/zfs.h>
-#include <sys/zfs_ioctl.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int lzc_compat_pre(zfs_cmd_t *, zfs_ioc_t *, nvlist_t **);
-void lzc_compat_post(zfs_cmd_t *, const zfs_ioc_t);
-int lzc_compat_outnvl(zfs_cmd_t *, const zfs_ioc_t, nvlist_t **);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LIBZFS_CORE_COMPAT_H */
Modified: trunk/cddl/lib/libzpool/Makefile
===================================================================
--- trunk/cddl/lib/libzpool/Makefile 2018-06-02 15:56:55 UTC (rev 10223)
+++ trunk/cddl/lib/libzpool/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -1,28 +1,31 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/libzpool/Makefile 325915 2017-11-16 23:36:19Z avg $
-.include "${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/Makefile.files"
+.include "${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/Makefile.files"
# ZFS_COMMON_SRCS
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
# ZFS_SHARED_SRCS
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
# KERNEL_SRCS
-.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
# LIST_SRCS
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/os
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/os
# ATOMIC_SRCS
-.if exists(${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
+.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
ATOMIC_SRCS= opensolaris_atomic.S
-.if ${MACHINE_ARCH} != "sparc64"
+.if ${MACHINE_ARCH} != "ia64" && ${MACHINE_ARCH} != "sparc64"
ACFLAGS+= -Wa,--noexecstack
.endif
.else
-.PATH: ${.CURDIR}/../../../sys/cddl/compat/opensolaris/kern
+.PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern
ATOMIC_SRCS= opensolaris_atomic.c
.endif
# UNICODE_SRCS
-.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/unicode
+.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/unicode
+# LIBCMDUTILS_SRCS
+.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils/common
LIB= zpool
@@ -31,33 +34,35 @@
KERNEL_SRCS= kernel.c taskq.c util.c
LIST_SRCS= list.c
UNICODE_SRCS= u8_textprep.c
+LIBCMDUTILS_SRCS=nicenum.c
SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} \
${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \
- ${UNICODE_SRCS}
+ ${UNICODE_SRCS} ${LIBCMDUTILS_SRCS}
WARNS?= 0
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris
-CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/include
-CFLAGS+= -I${.CURDIR}/../../compat/opensolaris/lib/libumem
-CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
-CFLAGS+= -I${.CURDIR}/../../lib/libumem
-CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
+CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
+CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils
# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look
# into libthr private structures. That's sooo evil, but it's only for
# ZFS debugging tools needs.
CFLAGS+= -DWANTS_MUTEX_OWNED
-CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/thread
-CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys
-CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
+CFLAGS+= -I${SRCTOP}/lib/libpthread/thread
+CFLAGS+= -I${SRCTOP}/lib/libpthread/sys
+CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include
-DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ}
-LDADD= -lmd -lpthread -lz
+DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ} ${LIBNVPAIR} \
+ ${LIBAVL} ${LIBUMEM}
+LDADD= -lmd -lpthread -lz -lnvpair -lavl -lumem
# atomic.S doesn't like profiling.
NO_PROFILE=
@@ -64,7 +69,9 @@
CSTD= c99
-CFLAGS+= -DDEBUG=1
-#DEBUG_FLAGS+= -g
+# Since there are many asserts in this library, it makes no sense to compile
+# it without debugging.
+CFLAGS+= -g -DDEBUG=1
+
.include <bsd.lib.mk>
Added: trunk/cddl/lib/tests/Makefile
===================================================================
--- trunk/cddl/lib/tests/Makefile (rev 0)
+++ trunk/cddl/lib/tests/Makefile 2018-06-02 15:58:17 UTC (rev 10224)
@@ -0,0 +1,9 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/cddl/lib/tests/Makefile 313488 2017-02-09 22:49:48Z ngie $
+
+.include <bsd.own.mk>
+
+.PATH: ${SRCTOP}/tests
+KYUAFILE= yes
+
+.include <bsd.test.mk>
Property changes on: trunk/cddl/lib/tests/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list